From b860a893c8da26557184dfc0c350eaaed94bf4cb Mon Sep 17 00:00:00 2001 From: -LAN- Date: Thu, 14 Nov 2024 23:35:07 +0800 Subject: [PATCH] feat(config-prompt): add support for file variables Extended the `ConfigPromptItem` component to support file variables by including the `isSupportFileVar` prop. Updated `useConfig` hooks to accept `arrayFile` variable types for both input and memory prompt filtering. This enhancement allows handling of file data types seamlessly, improving flexibility in configuring prompts. --- .../workflow/nodes/llm/components/config-prompt-item.tsx | 1 + web/app/components/workflow/nodes/llm/use-config.ts | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/web/app/components/workflow/nodes/llm/components/config-prompt-item.tsx b/web/app/components/workflow/nodes/llm/components/config-prompt-item.tsx index c8d4d92fda..d8d47a157f 100644 --- a/web/app/components/workflow/nodes/llm/components/config-prompt-item.tsx +++ b/web/app/components/workflow/nodes/llm/components/config-prompt-item.tsx @@ -144,6 +144,7 @@ const ConfigPromptItem: FC = ({ onEditionTypeChange={onEditionTypeChange} varList={varList} handleAddVariable={handleAddVariable} + isSupportFileVar /> ) } diff --git a/web/app/components/workflow/nodes/llm/use-config.ts b/web/app/components/workflow/nodes/llm/use-config.ts index 33742b0726..1b84f81110 100644 --- a/web/app/components/workflow/nodes/llm/use-config.ts +++ b/web/app/components/workflow/nodes/llm/use-config.ts @@ -278,11 +278,11 @@ const useConfig = (id: string, payload: LLMNodeType) => { }, [inputs, setInputs]) const filterInputVar = useCallback((varPayload: Var) => { - return [VarType.number, VarType.string, VarType.secret, VarType.arrayString, VarType.arrayNumber].includes(varPayload.type) + return [VarType.number, VarType.string, VarType.secret, VarType.arrayString, VarType.arrayNumber, VarType.arrayFile].includes(varPayload.type) }, []) const filterMemoryPromptVar = useCallback((varPayload: Var) => { - return [VarType.arrayObject, VarType.array, VarType.number, VarType.string, VarType.secret, VarType.arrayString, VarType.arrayNumber].includes(varPayload.type) + return [VarType.arrayObject, VarType.array, VarType.number, VarType.string, VarType.secret, VarType.arrayString, VarType.arrayNumber, VarType.arrayFile].includes(varPayload.type) }, []) const {