From 11299a8e8faf8eb6c8d948a2b0d1a57de27c3026 Mon Sep 17 00:00:00 2001 From: Joel Date: Tue, 6 May 2025 14:57:41 +0800 Subject: [PATCH] chore: start sys params --- .../nodes/start/use-single-run-form-params.ts | 33 +++++++++++++++---- 1 file changed, 26 insertions(+), 7 deletions(-) diff --git a/web/app/components/workflow/nodes/start/use-single-run-form-params.ts b/web/app/components/workflow/nodes/start/use-single-run-form-params.ts index 454d8a9923..d3c8ee61f8 100644 --- a/web/app/components/workflow/nodes/start/use-single-run-form-params.ts +++ b/web/app/components/workflow/nodes/start/use-single-run-form-params.ts @@ -1,8 +1,9 @@ import type { MutableRefObject } from 'react' import { useTranslation } from 'react-i18next' import type { Props as FormProps } from '@/app/components/workflow/nodes/_base/components/before-run-form/form' -import type { InputVar, Variable } from '@/app/components/workflow/types' +import { type InputVar, InputVarType, type Variable } from '@/app/components/workflow/types' import type { StartNodeType } from './types' +import { useIsChatMode } from '../../hooks' type Params = { id: string, @@ -19,18 +20,36 @@ const useSingleRunFormParams = ({ setRunInputData, }: Params) => { const { t } = useTranslation() + const isChatMode = useIsChatMode() const forms = (() => { const forms: FormProps[] = [] + const inputs = payload.variables.map((item: InputVar) => ({ + label: item.variable, + variable: item.variable, + type: item.type, + required: item.required, + })) + + if (isChatMode) { + inputs.push({ + label: 'sys.query', + variable: '#sys.query#', + type: InputVarType.textInput, + required: true, + }) + } + + inputs.push({ + label: 'sys.files', + variable: '#sys.files#', + type: InputVarType.multiFiles, + required: false, + }) forms.push( { label: t('workflow.nodes.llm.singleRun.variable')!, - inputs: payload.variables.map((item: InputVar) => ({ - label: item.variable, - variable: item.variable, - type: item.type, - required: item.required, - })), + inputs, values: runInputData, onChange: setRunInputData, },