yzbtdiy

yzbtdiy

github
bilibili

Langflow 简单使用

安装#

uv pip install langflow -U

运行#

uv run langflow run --env-file .env

.env 配置

LANGFLOW_AUTO_LOGIN=False
LANGFLOW_SUPERUSER=admin
LANGFLOW_SUPERUSER_PASSWORD=password
LANGFLOW_SECRET_KEY=secret_key
LANGFLOW_NEW_USER_IS_ACTIVE=False
LANGFLOW_CONFIG_DIR=./config

自定义 python 代码组件#

# from langflow.field_typing import Data
from langflow.custom import Component
from langflow.io import MessageTextInput, Output
from langflow.schema import Data


class CustomComponent(Component):
    display_name = "ParseChatResponse"
    description = "Use as a template to create your own component."
    documentation: str = "https://dmentx.github.io/law-langflow/components-custom-components"
    icon = "custom_components"
    name = "CustomComponent"

    inputs = [
        MessageTextInput(name="input_value", display_name="Input Value", value="Hello, World!"),
    ]

    outputs = [
        Output(display_name="Output", name="output", method="build_output"),
    ]

    def build_output(self) -> Data:
        data = Data(text=self.input_value, character="vtuber")
        self.status = data
        return data
加载中...
此文章数据所有权由区块链加密技术和智能合约保障仅归创作者所有。