From c330f89c779ffc084a7322961f28a9dad6708f38 Mon Sep 17 00:00:00 2001 From: Joel Date: Mon, 1 Apr 2024 12:55:10 +0800 Subject: [PATCH] feat: support llm single run --- .../components/workflow/nodes/_base/hooks/use-one-step-run.ts | 4 ++-- web/app/components/workflow/nodes/llm/use-config.ts | 3 ++- web/app/components/workflow/types.ts | 1 + 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/web/app/components/workflow/nodes/_base/hooks/use-one-step-run.ts b/web/app/components/workflow/nodes/_base/hooks/use-one-step-run.ts index dcddb9829c..63b36bf429 100644 --- a/web/app/components/workflow/nodes/_base/hooks/use-one-step-run.ts +++ b/web/app/components/workflow/nodes/_base/hooks/use-one-step-run.ts @@ -211,14 +211,14 @@ const useOneStepRun = ({ const originalVar = getVar(item.value_selector) if (!originalVar) { return { - label: item.variable, + label: item.label || item.variable, variable: item.variable, type: InputVarType.textInput, required: true, } } return { - label: item.variable, + label: item.label || item.variable, variable: item.variable, type: varTypeToInputVarType(originalVar.type, { isSelect: !!originalVar.isSelect, diff --git a/web/app/components/workflow/nodes/llm/use-config.ts b/web/app/components/workflow/nodes/llm/use-config.ts index 90cf1d866c..2661c88508 100644 --- a/web/app/components/workflow/nodes/llm/use-config.ts +++ b/web/app/components/workflow/nodes/llm/use-config.ts @@ -286,7 +286,8 @@ const useConfig = (id: string, payload: LLMNodeType) => { variable[0] = varInfo?.title || availableNodes[0]?.data.title // default start node title return { - variable: `${variable[0]}/${variable[variable.length - 1]}`, + label: `${variable[0]}/${variable[variable.length - 1]}`, + variable: `#${item.join('.')}#`, value_selector: item, } }) diff --git a/web/app/components/workflow/types.ts b/web/app/components/workflow/types.ts index e8713dcb6c..75d405ff12 100644 --- a/web/app/components/workflow/types.ts +++ b/web/app/components/workflow/types.ts @@ -63,6 +63,7 @@ export type ValueSelector = string[] // [nodeId, key | obj key path] export type Variable = { variable: string + label?: string value_selector: ValueSelector variable_type?: VarKindType value?: string