chore: extend form component for override

This commit is contained in:
AkaraChen
2024-12-27 11:30:43 +08:00
parent 1f128729f4
commit 7f5e27d001
6 changed files with 66 additions and 8 deletions

View File

@ -39,7 +39,6 @@ function formatStrategy(input: StrategyPluginDetail[], getIcon: (i: string) => s
return input.map((item) => {
const res: ToolWithProvider = {
id: item.provider,
// TODO: replace this
author: item.declaration.identity.author,
name: item.declaration.identity.name,
description: item.declaration.identity.description as any,

View File

@ -84,7 +84,6 @@ export const AgentStrategy = (props: AgentStrategyProps) => {
}
}
}
console.log(formSchema)
return <div className='space-y-2'>
<AgentStrategySelector value={strategy} onChange={onStrategyChange} />
{

View File

@ -32,6 +32,7 @@ import {
} from '@/app/components/workflow/constants'
import type { PromptItem } from '@/models/debug'
import { VAR_REGEX } from '@/config'
import type { AgentNodeType } from '../../../agent/types'
export const isSystemVar = (valueSelector: ValueSelector) => {
return valueSelector[0] === 'sys' || valueSelector[1] === 'sys'
@ -316,7 +317,18 @@ const formatItem = (
}
case BlockEnum.Agent: {
res.vars = []
const payload = data as AgentNodeType
if (!payload.agent_parameters) {
res.vars = []
break
}
res.vars = Object.keys(payload.agent_parameters).map((key) => {
return {
variable: key,
// TODO: is this correct?
type: payload.agent_parameters![key].type as unknown as VarType,
}
})
break
}
@ -789,6 +801,14 @@ export const getNodeUsedVars = (node: Node): ValueSelector[] => {
res = [(data as ListFilterNodeType).variable]
break
}
case BlockEnum.Agent: {
const payload = data as AgentNodeType
const params = payload.agent_parameters || {}
const mixVars = matchNotSystemVars(Object.keys(params)?.filter(key => params[key].type === ToolVarType.mixed).map(key => params[key].value) as string[])
const vars = Object.keys(params).filter(key => params[key].type === ToolVarType.variable).map(key => params[key].value as string) || []
res = [...(mixVars as ValueSelector[]), ...(vars as any)]
}
}
return res || []
}