System plugin adapt reference type in plugin input (#2965)

* perf: plugin input support reference

* perf: system plugin adapt plugin input reference
This commit is contained in:
Archer
2024-10-22 14:51:15 +08:00
committed by GitHub
parent 618729a254
commit 87b4061302
16 changed files with 145 additions and 235 deletions

View File

@@ -20,15 +20,13 @@
"flowNodeType": "pluginInput",
"showStatus": false,
"position": {
"x": 335.8310044079668,
"x": 334.24111198705634,
"y": -260.8285440670886
},
"version": "481",
"inputs": [
{
"renderTypeList": [
"select"
],
"renderTypeList": ["select", "reference"],
"selectedTypeIndex": 0,
"valueType": "string",
"canEdit": true,
@@ -49,9 +47,7 @@
"required": true
},
{
"renderTypeList": [
"input"
],
"renderTypeList": ["input", "reference"],
"selectedTypeIndex": 0,
"valueType": "string",
"canEdit": true,
@@ -68,11 +64,9 @@
]
},
{
"renderTypeList": [
"input"
],
"renderTypeList": ["numberInput", "reference"],
"selectedTypeIndex": 0,
"valueType": "string",
"valueType": "number",
"canEdit": true,
"key": "port",
"label": "port",
@@ -87,9 +81,7 @@
]
},
{
"renderTypeList": [
"input"
],
"renderTypeList": ["input", "reference"],
"selectedTypeIndex": 0,
"valueType": "string",
"canEdit": true,
@@ -106,9 +98,7 @@
]
},
{
"renderTypeList": [
"input"
],
"renderTypeList": ["input", "reference"],
"selectedTypeIndex": 0,
"valueType": "string",
"canEdit": true,
@@ -125,9 +115,7 @@
"required": true
},
{
"renderTypeList": [
"input"
],
"renderTypeList": ["input", "reference"],
"selectedTypeIndex": 0,
"valueType": "string",
"canEdit": true,
@@ -144,9 +132,7 @@
"required": true
},
{
"renderTypeList": [
"reference"
],
"renderTypeList": ["input", "reference"],
"selectedTypeIndex": 0,
"valueType": "string",
"canEdit": true,
@@ -181,7 +167,7 @@
},
{
"id": "port",
"valueType": "string",
"valueType": "number",
"key": "port",
"label": "port",
"type": "hidden"
@@ -230,19 +216,14 @@
"version": "481",
"inputs": [
{
"renderTypeList": [
"reference"
],
"renderTypeList": ["reference"],
"valueType": "string",
"canEdit": true,
"key": "result",
"label": "result",
"isToolOutput": true,
"description": "数据库连接结果",
"value": [
"zBeXy7YZEiXe",
"httpRawResponse"
]
"value": ["zBeXy7YZEiXe", "httpRawResponse"]
}
],
"outputs": []
@@ -276,9 +257,7 @@
"inputs": [
{
"key": "system_addInputParam",
"renderTypeList": [
"addInputParam"
],
"renderTypeList": ["addInputParam"],
"valueType": "dynamic",
"label": "",
"required": false,
@@ -310,9 +289,7 @@
},
{
"key": "system_httpMethod",
"renderTypeList": [
"custom"
],
"renderTypeList": ["custom"],
"valueType": "string",
"label": "",
"value": "POST",
@@ -324,9 +301,7 @@
},
{
"key": "system_httpTimeout",
"renderTypeList": [
"custom"
],
"renderTypeList": ["custom"],
"valueType": "number",
"label": "",
"value": 30,
@@ -340,9 +315,7 @@
},
{
"key": "system_httpReqUrl",
"renderTypeList": [
"hidden"
],
"renderTypeList": ["hidden"],
"valueType": "string",
"label": "",
"description": "common:core.module.input.description.Http Request Url",
@@ -355,9 +328,7 @@
},
{
"key": "system_httpHeader",
"renderTypeList": [
"custom"
],
"renderTypeList": ["custom"],
"valueType": "any",
"value": [],
"label": "",
@@ -370,9 +341,7 @@
},
{
"key": "system_httpParams",
"renderTypeList": [
"hidden"
],
"renderTypeList": ["hidden"],
"valueType": "any",
"value": [],
"label": "",
@@ -384,9 +353,7 @@
},
{
"key": "system_httpJsonBody",
"renderTypeList": [
"hidden"
],
"renderTypeList": ["hidden"],
"valueType": "any",
"value": "{\r\n \"databaseType\":\"{{databaseType-H}}\",\r\n \"host\":\"{{host-H}}\",\r\n \"port\":\"{{port-H}}\",\r\n \"databaseName\":\"{{databaseName-H}}\",\r\n \"user\":\"{{databaseUser-H}}\",\r\n \"password\":\"{{databasePwd-H}}\",\r\n \"sql\":\"{{sql-H}}\"\r\n}",
"label": "",
@@ -398,9 +365,7 @@
},
{
"key": "system_httpFormBody",
"renderTypeList": [
"hidden"
],
"renderTypeList": ["hidden"],
"valueType": "any",
"value": [],
"label": "",
@@ -412,9 +377,7 @@
},
{
"key": "system_httpContentType",
"renderTypeList": [
"hidden"
],
"renderTypeList": ["hidden"],
"valueType": "string",
"value": "json",
"label": "",
@@ -425,9 +388,7 @@
"toolDescription": ""
},
{
"renderTypeList": [
"reference"
],
"renderTypeList": ["reference"],
"valueType": "string",
"canEdit": true,
"key": "databaseType-H",
@@ -454,15 +415,10 @@
"showDefaultValue": true
},
"required": true,
"value": [
"pluginInput",
"databaseType"
]
"value": ["pluginInput", "databaseType"]
},
{
"renderTypeList": [
"reference"
],
"renderTypeList": ["reference"],
"valueType": "string",
"canEdit": true,
"key": "host-H",
@@ -489,16 +445,11 @@
"showDefaultValue": true
},
"required": true,
"value": [
"pluginInput",
"host"
]
"value": ["pluginInput", "host"]
},
{
"renderTypeList": [
"reference"
],
"valueType": "string",
"renderTypeList": ["reference"],
"valueType": "number",
"canEdit": true,
"key": "port-H",
"label": "port-H",
@@ -524,15 +475,10 @@
"showDefaultValue": true
},
"required": true,
"value": [
"pluginInput",
"port"
]
"value": ["pluginInput", "port"]
},
{
"renderTypeList": [
"reference"
],
"renderTypeList": ["reference"],
"valueType": "string",
"canEdit": true,
"key": "databaseName-H",
@@ -559,15 +505,10 @@
"showDefaultValue": true
},
"required": true,
"value": [
"pluginInput",
"dataBaseName"
]
"value": ["pluginInput", "dataBaseName"]
},
{
"renderTypeList": [
"reference"
],
"renderTypeList": ["reference"],
"valueType": "string",
"canEdit": true,
"key": "databasePwd-H",
@@ -594,15 +535,10 @@
"showDefaultValue": true
},
"required": true,
"value": [
"pluginInput",
"dataBasePwd"
]
"value": ["pluginInput", "dataBasePwd"]
},
{
"renderTypeList": [
"reference"
],
"renderTypeList": ["reference"],
"valueType": "string",
"canEdit": true,
"key": "databaseUser-H",
@@ -629,15 +565,10 @@
"showDefaultValue": true
},
"required": true,
"value": [
"pluginInput",
"user"
]
"value": ["pluginInput", "user"]
},
{
"renderTypeList": [
"reference"
],
"renderTypeList": ["reference"],
"valueType": "string",
"canEdit": true,
"key": "sql-H",
@@ -664,10 +595,7 @@
"showDefaultValue": true
},
"required": true,
"value": [
"pluginInput",
"sql"
]
"value": ["pluginInput", "sql"]
}
],
"outputs": [

View File

@@ -1,6 +1,6 @@
{
"author": "",
"version": "486",
"version": "4812",
"name": "基础图表",
"avatar": "core/workflow/template/baseChart",
"intro": "根据数据生成图表可根据chartType生成柱状图折线图饼图",
@@ -8,7 +8,7 @@
"weight": 10,
"isTool": true,
"templateType": "search",
"templateType": "tools",
"workflow": {
"nodes": [
@@ -21,12 +21,12 @@
"showStatus": false,
"position": {
"x": 613.7921798611637,
"y": -124.66724109717275
"y": -123.07734867626235
},
"version": "481",
"inputs": [
{
"renderTypeList": ["reference"],
"renderTypeList": ["input", "reference"],
"selectedTypeIndex": 0,
"valueType": "string",
"canEdit": true,
@@ -44,13 +44,13 @@
"toolDescription": "BI图表的标题"
},
{
"renderTypeList": ["reference"],
"renderTypeList": ["input", "reference"],
"selectedTypeIndex": 0,
"valueType": "string",
"canEdit": true,
"key": "xAxis",
"label": "xAxis",
"description": "x轴数据",
"description": "x轴数据,例如:['A', 'B', 'C']",
"defaultValue": "",
"required": true,
"toolDescription": "x轴数据例如['A', 'B', 'C']",
@@ -62,13 +62,13 @@
]
},
{
"renderTypeList": ["reference"],
"renderTypeList": ["input", "reference"],
"selectedTypeIndex": 0,
"valueType": "string",
"canEdit": true,
"key": "yAxis",
"label": "yAxis",
"description": "y轴数据",
"description": "y轴数据,例如:['1', '2', '3']",
"defaultValue": "",
"list": [
{
@@ -77,10 +77,10 @@
}
],
"required": true,
"toolDescription": "y轴数据例如['A', 'B', 'C']"
"toolDescription": "y轴数据例如['1', '2', '3']"
},
{
"renderTypeList": ["select"],
"renderTypeList": ["select", "reference"],
"selectedTypeIndex": 0,
"valueType": "string",
"canEdit": true,
@@ -103,7 +103,7 @@
"value": "饼图"
}
],
"toolDescription": "图表类型,目前支持三种: 柱状图,折线图,饼图"
"toolDescription": "图表类型柱状图,折线图,饼图"
}
],
"outputs": [
@@ -181,7 +181,7 @@
"valueType": "dynamic",
"label": "",
"required": false,
"description": "接收前方节点的输出值作为变量,这些变量可以被 HTTP 请求参数使用。",
"description": "common:core.module.input.description.HTTP Dynamic Input",
"customInputConfig": {
"selectValueTypeList": [
"string",
@@ -192,6 +192,7 @@
"arrayNumber",
"arrayBoolean",
"arrayObject",
"arrayAny",
"any",
"chatHistory",
"datasetQuote",
@@ -237,7 +238,7 @@
"renderTypeList": ["hidden"],
"valueType": "string",
"label": "",
"description": "新的 HTTP 请求地址。如果出现两个“请求地址”,可以删除该模块重新加入,会拉取最新的模块配置。",
"description": "common:core.module.input.description.Http Request Url",
"placeholder": "https://api.ai.com/getInventory",
"required": false,
"valueDesc": "",
@@ -251,7 +252,7 @@
"valueType": "any",
"value": [],
"label": "",
"description": "自定义请求头,请严格填入 JSON 字符串。\n1. 确保最后一个属性没有逗号\n2. 确保 key 包含双引号\n例如{\"Authorization\":\"Bearer xxx\"}",
"description": "common:core.module.input.description.Http Request Header",
"placeholder": "common:core.module.input.description.Http Request Header",
"required": false,
"valueDesc": "",
@@ -322,6 +323,7 @@
"arrayNumber",
"arrayBoolean",
"arrayObject",
"arrayAny",
"any",
"chatHistory",
"datasetQuote",
@@ -351,6 +353,7 @@
"arrayNumber",
"arrayBoolean",
"arrayObject",
"arrayAny",
"any",
"chatHistory",
"datasetQuote",
@@ -380,6 +383,7 @@
"arrayNumber",
"arrayBoolean",
"arrayObject",
"arrayAny",
"any",
"chatHistory",
"datasetQuote",
@@ -409,6 +413,7 @@
"arrayNumber",
"arrayBoolean",
"arrayObject",
"arrayAny",
"any",
"chatHistory",
"datasetQuote",
@@ -424,6 +429,23 @@
}
],
"outputs": [
{
"id": "error",
"key": "error",
"label": "workflow:request_error",
"description": "HTTP请求错误信息成功时返回空",
"valueType": "object",
"type": "static"
},
{
"id": "httpRawResponse",
"key": "httpRawResponse",
"required": true,
"label": "workflow:raw_response",
"description": "HTTP请求的原始响应。只能接受字符串或JSON类型响应数据。",
"valueType": "any",
"type": "static"
},
{
"id": "system_addOutputParam",
"key": "system_addOutputParam",
@@ -453,25 +475,6 @@
"valueDesc": "",
"description": ""
},
{
"id": "error",
"key": "error",
"label": "请求错误",
"description": "HTTP请求错误信息成功时返回空",
"valueType": "object",
"type": "static",
"valueDesc": ""
},
{
"id": "httpRawResponse",
"key": "httpRawResponse",
"required": true,
"label": "原始响应",
"description": "HTTP请求的原始响应。只能接受字符串或JSON类型响应数据。",
"valueType": "any",
"type": "static",
"valueDesc": ""
},
{
"id": "bzaYjKyQFOw2",
"valueType": "string",
@@ -495,6 +498,26 @@
"sourceHandle": "ws0DFKJnCPhk-source-right",
"targetHandle": "pluginOutput-target-left"
}
]
],
"chatConfig": {
"welcomeText": "",
"variables": [],
"questionGuide": false,
"ttsConfig": {
"type": "web"
},
"whisperConfig": {
"open": false,
"autoSend": false,
"autoTTSResponse": false
},
"chatInputGuide": {
"open": false,
"textList": [],
"customUrl": ""
},
"instruction": "数据源配置,支持主流数据库配置",
"_id": "670a23b31957c5b9899b4a4d"
}
}
}

View File

@@ -26,7 +26,7 @@
"version": "481",
"inputs": [
{
"renderTypeList": ["reference"],
"renderTypeList": ["input", "reference"],
"selectedTypeIndex": 0,
"valueType": "string",
"canEdit": true,

View File

@@ -26,7 +26,7 @@
"version": "481",
"inputs": [
{
"renderTypeList": ["reference"],
"renderTypeList": ["input", "reference"],
"selectedTypeIndex": 0,
"valueType": "string",
"canEdit": true,

View File

@@ -26,7 +26,7 @@
"version": "481",
"inputs": [
{
"renderTypeList": ["reference"],
"renderTypeList": ["input", "reference"],
"selectedTypeIndex": 0,
"valueType": "string",
"canEdit": true,

View File

@@ -26,7 +26,7 @@
"version": "481",
"inputs": [
{
"renderTypeList": ["reference"],
"renderTypeList": ["input", "reference"],
"selectedTypeIndex": 0,
"valueType": "string",
"canEdit": true,

View File

@@ -5,10 +5,10 @@
"avatar": "core/workflow/template/duckduckgo",
"intro": "DuckDuckGo 服务,包含网络搜索、图片搜索、新闻搜索等。",
"showStatus": false,
"weight": 100,
"weight": 11,
"isTool": true,
"templateType": "tools",
"templateType": "search",
"workflow": {
"nodes": [],

View File

@@ -8,7 +8,7 @@
"weight": 10,
"isTool": true,
"templateType": "tools",
"templateType": "search",
"workflow": {
"nodes": [
@@ -26,7 +26,7 @@
"version": "481",
"inputs": [
{
"renderTypeList": ["input"],
"renderTypeList": ["input", "reference"],
"selectedTypeIndex": 0,
"valueType": "string",
"canEdit": true,
@@ -43,7 +43,7 @@
"required": true
},
{
"renderTypeList": ["input"],
"renderTypeList": ["input", "reference"],
"selectedTypeIndex": 0,
"valueType": "string",
"canEdit": true,
@@ -51,10 +51,11 @@
"label": "key",
"description": "Google搜索key",
"defaultValue": "",
"required": true
"required": true,
"list": []
},
{
"renderTypeList": ["reference"],
"renderTypeList": ["input", "reference"],
"selectedTypeIndex": 0,
"valueType": "string",
"canEdit": true,

View File

@@ -8,7 +8,7 @@
"weight": 10,
"isTool": true,
"templateType": "tools",
"templateType": "search",
"workflow": {
"nodes": [
@@ -26,7 +26,7 @@
"version": "481",
"inputs": [
{
"renderTypeList": ["reference"],
"renderTypeList": ["input", "reference"],
"selectedTypeIndex": 0,
"valueType": "string",
"canEdit": true,
@@ -34,7 +34,8 @@
"label": "query",
"description": "检索词",
"required": true,
"toolDescription": "检索词"
"toolDescription": "检索词",
"list": []
}
],
"outputs": [

View File

@@ -43,7 +43,6 @@ export default function Editor({
onBlur,
value,
placeholder = '',
isFlow,
bg = 'white'
}: {
minH?: number;
@@ -57,7 +56,6 @@ export default function Editor({
onBlur?: (editor: LexicalEditor) => void;
value?: string;
placeholder?: string;
isFlow?: boolean;
bg?: string;
}) {
const [key, setKey] = useState(getNanoid(6));
@@ -92,7 +90,7 @@ export default function Editor({
<PlainTextPlugin
contentEditable={
<ContentEditable
className={isFlow ? styles.contentEditable_isFlow : styles.contentEditable}
className={styles.contentEditable}
style={{
minHeight: `${minH}px`,
maxHeight: `${maxH}px`

View File

@@ -11,18 +11,6 @@
overflow-y: auto;
}
.contentEditable_isFlow {
position: relative;
height: 100%;
width: 100%;
border: 1px solid var(--chakra-colors-myGray-200);
border-radius: var(--chakra-radii-sm);
padding: 6px 8px;
// background: #fff;
font-size: var(--chakra-fontSizes-sm);
overflow-y: auto;
}
.contentEditable:focus {
outline: none;
border: 1px solid;
@@ -30,13 +18,6 @@
box-shadow: 0px 0px 0px 2.4px rgba(51, 112, 255, 0.15);
}
.contentEditable_isFlow:focus {
outline: none;
border: 1px solid;
border-color: var(--chakra-colors-primary-600);
box-shadow: 0px 0px 0px 2.4px rgba(51, 112, 255, 0.15);
}
.variable {
color: var(--chakra-colors-primary-600);
padding: 0 2px;

View File

@@ -20,7 +20,6 @@ const PromptEditor = ({
maxLength,
placeholder,
title,
isFlow,
bg = 'white'
}: {
showOpenModal?: boolean;
@@ -34,7 +33,6 @@ const PromptEditor = ({
maxLength?: number;
placeholder?: string;
title?: string;
isFlow?: boolean;
bg?: string;
}) => {
const { isOpen, onOpen, onClose } = useDisclosure();
@@ -69,7 +67,6 @@ const PromptEditor = ({
onChange={onChangeInput}
onBlur={onBlurInput}
placeholder={placeholder}
isFlow={isFlow}
bg={bg}
/>
<MyModal isOpen={isOpen} onClose={onClose} iconSrc="modal/edit" title={title} w={'full'}>

View File

@@ -49,37 +49,37 @@ const FieldEditModal = ({
{
icon: 'core/workflow/inputType/reference',
label: t('common:core.workflow.inputType.Reference'),
value: FlowNodeInputTypeEnum.reference,
value: [FlowNodeInputTypeEnum.reference],
defaultValueType: WorkflowIOValueTypeEnum.string
},
{
icon: 'core/workflow/inputType/input',
label: t('common:core.workflow.inputType.textInput'),
value: FlowNodeInputTypeEnum.input,
value: [FlowNodeInputTypeEnum.input, FlowNodeInputTypeEnum.reference],
defaultValueType: WorkflowIOValueTypeEnum.string
},
{
icon: 'core/workflow/inputType/jsonEditor',
label: t('common:core.workflow.inputType.JSON Editor'),
value: FlowNodeInputTypeEnum.JSONEditor,
value: [FlowNodeInputTypeEnum.JSONEditor, FlowNodeInputTypeEnum.reference],
defaultValueType: WorkflowIOValueTypeEnum.string
},
{
icon: 'core/workflow/inputType/numberInput',
label: t('common:core.workflow.inputType.number input'),
value: FlowNodeInputTypeEnum.numberInput,
value: [FlowNodeInputTypeEnum.numberInput, FlowNodeInputTypeEnum.reference],
defaultValueType: WorkflowIOValueTypeEnum.number
},
{
icon: 'core/workflow/inputType/option',
label: t('common:core.workflow.inputType.select'),
value: FlowNodeInputTypeEnum.select,
value: [FlowNodeInputTypeEnum.select, FlowNodeInputTypeEnum.reference],
defaultValueType: WorkflowIOValueTypeEnum.string
},
{
icon: 'core/workflow/inputType/switch',
label: t('common:core.workflow.inputType.switch'),
value: FlowNodeInputTypeEnum.switch,
value: [FlowNodeInputTypeEnum.switch, FlowNodeInputTypeEnum.reference],
defaultValueType: WorkflowIOValueTypeEnum.boolean
}
],
@@ -87,13 +87,13 @@ const FieldEditModal = ({
{
icon: 'core/workflow/inputType/selectLLM',
label: t('common:core.workflow.inputType.selectLLMModel'),
value: FlowNodeInputTypeEnum.selectLLMModel,
value: [FlowNodeInputTypeEnum.selectLLMModel],
defaultValueType: WorkflowIOValueTypeEnum.string
},
{
icon: 'core/workflow/inputType/selectDataset',
label: t('common:core.workflow.inputType.selectDataset'),
value: FlowNodeInputTypeEnum.selectDataset,
value: [FlowNodeInputTypeEnum.selectDataset],
defaultValueType: WorkflowIOValueTypeEnum.selectDataset
},
...(hasDynamicInput
@@ -102,7 +102,7 @@ const FieldEditModal = ({
{
icon: 'core/workflow/inputType/dynamic',
label: t('common:core.workflow.inputType.dynamicTargetInput'),
value: FlowNodeInputTypeEnum.addInputParam,
value: [FlowNodeInputTypeEnum.addInputParam],
defaultValueType: WorkflowIOValueTypeEnum.dynamic
}
])
@@ -111,7 +111,7 @@ const FieldEditModal = ({
{
icon: 'core/workflow/inputType/customVariable',
label: t('common:core.workflow.inputType.custom'),
value: FlowNodeInputTypeEnum.customVariable,
value: [FlowNodeInputTypeEnum.customVariable],
defaultValueType: WorkflowIOValueTypeEnum.string,
description: t('app:variable.select type_desc')
}
@@ -119,7 +119,7 @@ const FieldEditModal = ({
] as {
icon: string;
label: string;
value: FlowNodeInputTypeEnum;
value: FlowNodeInputTypeEnum[];
defaultValueType: WorkflowIOValueTypeEnum;
description?: string;
}[][],
@@ -138,27 +138,18 @@ const FieldEditModal = ({
const [isToolInput, { toggle: setIsToolInput }] = useBoolean(!!getValues('toolDescription'));
const isRefrence = renderTypeList.includes(FlowNodeInputTypeEnum.reference);
const setIsRefrence = () => {
if (isRefrence) {
setValue(
'renderTypeList',
renderTypeList.filter((item) => item !== FlowNodeInputTypeEnum.reference)
);
} else {
setValue('renderTypeList', [...getValues('renderTypeList'), FlowNodeInputTypeEnum.reference]);
}
};
const maxLength = watch('maxLength');
const max = watch('max');
const min = watch('min');
const selectValueTypeList = watch('customInputConfig.selectValueTypeList');
const defaultInputValue = watch('defaultValue');
const defaultValueType =
inputTypeList.flat().find((item) => item.value === inputType)?.defaultValueType ||
WorkflowIOValueTypeEnum.string;
const defaultValueType = useMemo(
() =>
inputTypeList.flat().find((item) => item.value[0] === inputType)?.defaultValueType ||
WorkflowIOValueTypeEnum.string,
[inputType, inputTypeList]
);
const onSubmitSuccess = useCallback(
(data: FlowNodeInputItemType, action: 'confirm' | 'continue') => {
@@ -171,6 +162,7 @@ const FieldEditModal = ({
});
}
// Auto set valueType
if (
data.renderTypeList[0] !== FlowNodeInputTypeEnum.reference &&
data.renderTypeList[0] !== FlowNodeInputTypeEnum.customVariable
@@ -178,6 +170,7 @@ const FieldEditModal = ({
data.valueType = defaultValueType;
}
// Remove required
if (
data.renderTypeList[0] === FlowNodeInputTypeEnum.addInputParam ||
data.renderTypeList[0] === FlowNodeInputTypeEnum.customVariable
@@ -273,7 +266,7 @@ const FieldEditModal = ({
mt={5}
>
{list.map((item) => {
const isSelected = inputType === item.value;
const isSelected = inputType === item.value[0];
return (
<Box
display={'flex'}
@@ -299,7 +292,7 @@ const FieldEditModal = ({
boxShadow: '0px 0px 0px 2.4px rgba(51, 112, 255, 0.15)'
}}
onClick={() => {
setValue('renderTypeList.0', item.value);
setValue('renderTypeList', item.value);
}}
>
<MyIcon
@@ -335,8 +328,6 @@ const FieldEditModal = ({
defaultValue={defaultInputValue}
isToolInput={isToolInput}
setIsToolInput={setIsToolInput}
isRefrence={isRefrence}
setIsRefrence={setIsRefrence}
valueType={valueType}
defaultValueType={defaultValueType}
onSubmitSuccess={onSubmitSuccess}

View File

@@ -51,8 +51,6 @@ const InputTypeConfig = ({
defaultValue,
isToolInput,
setIsToolInput,
isRefrence,
setIsRefrence,
valueType,
defaultValueType,
onSubmitSuccess,
@@ -75,8 +73,6 @@ const InputTypeConfig = ({
// Plugin-specific fields
isToolInput?: boolean;
setIsToolInput?: () => void;
isRefrence?: boolean;
setIsRefrence?: () => void;
valueType?: WorkflowIOValueTypeEnum;
defaultValueType?: WorkflowIOValueTypeEnum;
@@ -158,6 +154,18 @@ const InputTypeConfig = ({
return list.includes(inputType as FlowNodeInputTypeEnum);
}, [inputType]);
const showIsToolInput = useMemo(() => {
const list = [
FlowNodeInputTypeEnum.reference,
FlowNodeInputTypeEnum.JSONEditor,
FlowNodeInputTypeEnum.input,
FlowNodeInputTypeEnum.numberInput,
FlowNodeInputTypeEnum.switch,
FlowNodeInputTypeEnum.select
];
return type === 'plugin' && list.includes(inputType as FlowNodeInputTypeEnum);
}, [inputType, type]);
return (
<Stack flex={1} borderLeft={'1px solid #F0F1F6'} justifyContent={'space-between'}>
<Flex flexDirection={'column'} p={8} pb={2} gap={4} flex={'1 0 0'} overflow={'auto'}>
@@ -218,24 +226,8 @@ const InputTypeConfig = ({
<Switch {...register('required')} />
</Flex>
)}
{inputType !== FlowNodeInputTypeEnum.reference && setIsRefrence && (
<>
<Flex alignItems={'center'} minH={'40px'}>
<FormLabel flex={'0 0 132px'} fontWeight={'medium'}>
{t('workflow:field_used_as_reference')}
</FormLabel>
<Switch
isChecked={isRefrence}
onChange={(e) => {
setIsRefrence();
}}
/>
</Flex>
</>
)}
{/* reference */}
{(inputType === FlowNodeInputTypeEnum.reference || isRefrence) && (
{showIsToolInput && (
<>
<Flex alignItems={'center'} minH={'40px'}>
<FormLabel flex={'0 0 132px'} fontWeight={'medium'}>

View File

@@ -47,12 +47,11 @@ const TextInputRender = ({ inputs = [], item, nodeId }: RenderInputProps) => {
variables={variables}
title={t(item.label as any)}
maxLength={item.maxLength}
minH={40}
minH={30}
maxH={120}
placeholder={t(item.placeholder as any)}
value={item.value}
onChange={onChange}
isFlow={true}
/>
);
}, [item.label, item.maxLength, item.placeholder, item.value, onChange, t, variables]);

View File

@@ -54,7 +54,6 @@ const TextareaRender = ({ inputs = [], item, nodeId }: RenderInputProps) => {
placeholder={t((item.placeholder as any) || '')}
value={item.value}
onChange={onChange}
isFlow={true}
/>
);
}, [item.label, item.maxLength, item.placeholder, item.value, onChange, t, variables]);