feat: reset parameters when switch agent strategy
This commit is contained in:
parent
da8e1ded55
commit
b59030ff93
@ -15,6 +15,7 @@ import formatTracing from '@/app/components/workflow/run/utils/format-log'
|
|||||||
import { useLogs } from '@/app/components/workflow/run/hooks'
|
import { useLogs } from '@/app/components/workflow/run/hooks'
|
||||||
import type { Props as FormProps } from '@/app/components/workflow/nodes/_base/components/before-run-form/form'
|
import type { Props as FormProps } from '@/app/components/workflow/nodes/_base/components/before-run-form/form'
|
||||||
import { toType } from '@/app/components/tools/utils/to-form-schema'
|
import { toType } from '@/app/components/tools/utils/to-form-schema'
|
||||||
|
import { useStore } from '../../store'
|
||||||
|
|
||||||
const i18nPrefix = 'workflow.nodes.agent'
|
const i18nPrefix = 'workflow.nodes.agent'
|
||||||
|
|
||||||
@ -72,6 +73,8 @@ const AgentPanel: FC<NodePanelProps<AgentNodeType>> = (props) => {
|
|||||||
return forms
|
return forms
|
||||||
})()
|
})()
|
||||||
|
|
||||||
|
const resetEditor = useStore(s => s.setControlPromptEditorRerenderKey)
|
||||||
|
|
||||||
return <div className='my-2'>
|
return <div className='my-2'>
|
||||||
<Field title={t('workflow.nodes.agent.strategy.label')} className='px-4 py-2' tooltip={t('workflow.nodes.agent.strategy.tooltip')} >
|
<Field title={t('workflow.nodes.agent.strategy.label')} className='px-4 py-2' tooltip={t('workflow.nodes.agent.strategy.tooltip')} >
|
||||||
<AgentStrategy
|
<AgentStrategy
|
||||||
@ -90,7 +93,9 @@ const AgentPanel: FC<NodePanelProps<AgentNodeType>> = (props) => {
|
|||||||
agent_strategy_label: strategy?.agent_strategy_label,
|
agent_strategy_label: strategy?.agent_strategy_label,
|
||||||
output_schema: strategy!.agent_output_schema,
|
output_schema: strategy!.agent_output_schema,
|
||||||
plugin_unique_identifier: strategy!.plugin_unique_identifier,
|
plugin_unique_identifier: strategy!.plugin_unique_identifier,
|
||||||
|
agent_parameters: {},
|
||||||
})
|
})
|
||||||
|
resetEditor(Date.now())
|
||||||
}}
|
}}
|
||||||
formSchema={currentStrategy?.parameters?.map(strategyParamToCredientialForm) || []}
|
formSchema={currentStrategy?.parameters?.map(strategyParamToCredientialForm) || []}
|
||||||
formValue={formData}
|
formValue={formData}
|
||||||
|
Loading…
Reference in New Issue
Block a user