From 0d0a4cfaa180a596abf04d228100bff29a34ba49 Mon Sep 17 00:00:00 2001 From: AkaraChen Date: Fri, 27 Dec 2024 16:04:48 +0800 Subject: [PATCH] fix: select var --- .../nodes/_base/components/agent-strategy.tsx | 7 ++++++- web/app/components/workflow/nodes/agent/panel.tsx | 12 +++++++++++- 2 files changed, 17 insertions(+), 2 deletions(-) diff --git a/web/app/components/workflow/nodes/_base/components/agent-strategy.tsx b/web/app/components/workflow/nodes/_base/components/agent-strategy.tsx index c14f9a54c6..3f0b05b8e6 100644 --- a/web/app/components/workflow/nodes/_base/components/agent-strategy.tsx +++ b/web/app/components/workflow/nodes/_base/components/agent-strategy.tsx @@ -102,7 +102,12 @@ const devMockForm = [{ pt_BR: 'The maximum number of iterations to run', ja_JP: 'The maximum number of iterations to run', }, -}] +}].map((item) => { + return { + ...item, + variable: item.name, + } +}) export const AgentStrategy = (props: AgentStrategyProps) => { const { strategy, onStrategyChange, formSchema, formValue, onFormValueChange } = props diff --git a/web/app/components/workflow/nodes/agent/panel.tsx b/web/app/components/workflow/nodes/agent/panel.tsx index b9bafa78b0..4f1d208948 100644 --- a/web/app/components/workflow/nodes/agent/panel.tsx +++ b/web/app/components/workflow/nodes/agent/panel.tsx @@ -6,9 +6,19 @@ import { AgentStrategy } from '../_base/components/agent-strategy' import useConfig from './use-config' import { useTranslation } from 'react-i18next' import OutputVars, { VarItem } from '../_base/components/output-vars' +import type { StrategyParamItem } from '@/app/components/plugins/types' +import type { CredentialFormSchema } from '@/app/components/header/account-setting/model-provider-page/declarations' const i18nPrefix = 'workflow.nodes.agent' +function strategyParamToCredientialForm(param: StrategyParamItem): CredentialFormSchema { + return { + ...param as any, + variable: param.name, + show_on: [], + } +} + const AgentPanel: FC> = (props) => { const { inputs, setInputs, currentStrategy } = useConfig(props.id, props.data) const { t } = useTranslation() @@ -32,7 +42,7 @@ const AgentPanel: FC> = (props) => { output_schema: strategy!.agent_output_schema, }) }} - formSchema={currentStrategy?.parameters as any || []} + formSchema={currentStrategy?.parameters?.map(strategyParamToCredientialForm) || []} formValue={inputs.agent_parameters || {}} onFormValueChange={value => setInputs({ ...inputs,