From ffe1685b5426d6a5fa3daa45e75a0d9882133b2d Mon Sep 17 00:00:00 2001 From: 17hz <0x149527@gmail.com> Date: Fri, 22 Aug 2025 18:44:48 +0800 Subject: [PATCH] feat: Add default value support for all workflow start node variable types (#24129) Co-authored-by: crazywoola <100913391+crazywoola@users.noreply.github.com> Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --- .../config-var/config-modal/index.tsx | 70 +++++++++++++++++-- .../base/chat/chat-with-history/hooks.tsx | 6 +- .../base/chat/embedded-chatbot/hooks.tsx | 6 +- .../share/text-generation/run-once/index.tsx | 17 ++++- .../workflow/panel/inputs-panel.tsx | 33 +++------ web/utils/model-config.ts | 4 ++ 6 files changed, 100 insertions(+), 36 deletions(-) diff --git a/web/app/components/app/configuration/config-var/config-modal/index.tsx b/web/app/components/app/configuration/config-var/config-modal/index.tsx index 861020545d..4ba451452c 100644 --- a/web/app/components/app/configuration/config-var/config-modal/index.tsx +++ b/web/app/components/app/configuration/config-var/config-modal/index.tsx @@ -21,6 +21,10 @@ import Checkbox from '@/app/components/base/checkbox' import { DEFAULT_FILE_UPLOAD_SETTING } from '@/app/components/workflow/constants' import { DEFAULT_VALUE_MAX_LEN } from '@/config' import { SimpleSelect } from '@/app/components/base/select' +import Textarea from '@/app/components/base/textarea' +import { FileUploaderInAttachmentWrapper } from '@/app/components/base/file-uploader' +import { TransferMethod } from '@/types/app' +import type { FileEntity } from '@/app/components/base/file-uploader/types' const TEXT_MAX_LENGTH = 256 @@ -82,6 +86,8 @@ const ConfigModal: FC = ({ return () => { const newPayload = produce(tempPayload, (draft) => { draft.type = type + // Clear default value when switching types + draft.default = undefined if ([InputVarType.singleFile, InputVarType.multiFiles].includes(type)) { (Object.keys(DEFAULT_FILE_UPLOAD_SETTING)).forEach((key) => { if (key !== 'max_length') @@ -234,6 +240,41 @@ const ConfigModal: FC = ({ )} + + {/* Default value for text input */} + {type === InputVarType.textInput && ( + + handlePayloadChange('default')(e.target.value || undefined)} + placeholder={t('appDebug.variableConfig.inputPlaceholder')!} + /> + + )} + + {/* Default value for paragraph */} + {type === InputVarType.paragraph && ( + +