fix: select var

This commit is contained in:
AkaraChen 2024-12-27 16:04:48 +08:00
parent 0d2a74b8cb
commit 0d0a4cfaa1
2 changed files with 17 additions and 2 deletions

View File

@ -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

View File

@ -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<NodePanelProps<AgentNodeType>> = (props) => {
const { inputs, setInputs, currentStrategy } = useConfig(props.id, props.data)
const { t } = useTranslation()
@ -32,7 +42,7 @@ const AgentPanel: FC<NodePanelProps<AgentNodeType>> = (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,