安裝#
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 = "用作模板來創建您自己的組件。"
documentation: str = "https://dmentx.github.io/law-langflow/components-custom-components"
icon = "custom_components"
name = "CustomComponent"
inputs = [
MessageTextInput(name="input_value", display_name="輸入值", value="Hello, World!"),
]
outputs = [
Output(display_name="輸出", name="output", method="build_output"),
]
def build_output(self) -> Data:
data = Data(text=self.input_value, character="vtuber")
self.status = data
return data