Build Agentic workflows, RAG pipelines, with rich AI model and tool support on one collaborative workspace. Deploy on cloud, VPC, or self-hosted, so teams move from prototype to production without rebuilding the stack.
Python agentagentic-aiagentic-frameworkagentic-workflowaiautomationclaudedeepseekgenaigptllmlow-codemcpnextjsno-codeopenaipythonskillsworkflow
Fix variable config (#23070)
GuanMu77216488675d
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.tsxindex 72c66cf76a1..27072f52085 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@@ -244,6 +244,7 @@ const ConfigModal: FC<IConfigModalProps> = ({<SimpleSelectkey={`default-select-${options.join('-')}`}className="w-full"+ optionWrapClassName="max-h-[140px] overflow-y-auto"items={[{ value: '', name: t('appDebug.variableConfig.noDefaultValue') },...options.filter(opt => opt.trim() !== '').map(option => ({diff --git a/web/app/components/base/select/index.tsx b/web/app/components/base/select/index.tsxindex 77d229672fc..d9285c10615 100644--- a/web/app/components/base/select/index.tsx+++ b/web/app/components/base/select/index.tsx@@ -77,7 +77,6 @@ const Select: FC<ISelectProps> = ({defaultSelect = existedsetSelectedItem(defaultSelect)- // eslint-disable-next-line react-hooks/exhaustive-deps}, [defaultValue])const filteredItems: Item[]@@ -201,7 +200,6 @@ const SimpleSelect: FC<ISelectProps> = ({defaultSelect = existedsetSelectedItem(defaultSelect)- // eslint-disable-next-line react-hooks/exhaustive-deps}, [defaultValue])const listboxRef = useRef<HTMLDivElement>(null)@@ -344,7 +342,7 @@ const PortalSelect: FC<PortalSelectProps> = ({><spanclassName={`- grow truncate+ grow truncate text-text-secondary${!selectedItem?.name && 'text-components-input-text-placeholder'}`}>diff --git a/web/app/components/share/text-generation/run-once/index.tsx b/web/app/components/share/text-generation/run-once/index.tsxindex 546b21d2b0a..cfafe73bf29 100644--- a/web/app/components/share/text-generation/run-once/index.tsx+++ b/web/app/components/share/text-generation/run-once/index.tsx@@ -66,7 +66,9 @@ const RunOnce: FC<IRunOnceProps> = ({useEffect(() => {const newInputs: Record<string, any> = {}promptConfig.prompt_variables.forEach((item) => {- if (item.type === 'string' || item.type === 'paragraph')+ if (item.type === 'select')+ newInputs[item.key] = item.default+ else if (item.type === 'string' || item.type === 'paragraph')newInputs[item.key] = ''elsenewInputs[item.key] = undefineddiff --git a/web/app/components/workflow/panel/inputs-panel.tsx b/web/app/components/workflow/panel/inputs-panel.tsxindex 8be8d810f0f..64ac6d86865 100644--- a/web/app/components/workflow/panel/inputs-panel.tsx+++ b/web/app/components/workflow/panel/inputs-panel.tsx@@ -1,6 +1,7 @@import {memo,useCallback,+ useEffect,useMemo,} from 'react'import { useTranslation } from 'react-i18next'@@ -32,9 +33,12 @@ type Props = {const InputsPanel = ({ onRun }: Props) => {const { t } = useTranslation()const workflowStore = useWorkflowStore()+ const { inputs, setInputs } = useStore(s => ({+ inputs: s.inputs,+ setInputs: s.setInputs,+ }))const fileSettings = useFeatures(s => s.features.file)const nodes = useNodes<StartNodeType>()- const inputs = useStore(s => s.inputs)const files = useStore(s => s.files)const workflowRunningData = useStore(s => s.workflowRunningData)const {@@ -44,6 +48,24 @@ const InputsPanel = ({ onRun }: Props) => {const startVariables = startNode?.data.variablesconst { checkInputsForm } = useCheckInputsForms()+ const initialInputs = useMemo(() => {+ const initInputs: Record<string, any> = {}+ if (startVariables) {+ startVariables.forEach((variable) => {+ if (variable.default)+ initInputs[variable.variable] = variable.default+ })+ }+ return initInputs+ }, [startVariables])++ useEffect(() => {+ setInputs({+ ...initialInputs,+ ...inputs,+ })+ }, [initialInputs])+const variables = useMemo(() => {const data = startVariables || []if (fileSettings?.image?.enabled) {diff --git a/web/utils/model-config.ts b/web/utils/model-config.tsindex 330d8f9b528..3a500f22bcd 100644--- a/web/utils/model-config.ts+++ b/web/utils/model-config.ts@@ -62,6 +62,7 @@ export const userInputsFormToPromptVariables = (useInputs: UserInputFormItem[] |options: content.options,is_context_var,hide: content.hide,+ default: content.default,})}else if (type === 'file') {@@ -148,7 +149,7 @@ export const promptVariablesToUserInputsForm = (promptVariables: PromptVariable[variable: item.key,required: item.required !== false, // default trueoptions: item.options,- default: '',+ default: item.default ?? '',hide: item.hide,},} as any)