chore: temp change tools support schema for test

This commit is contained in:
Joel 2025-03-31 14:13:14 +08:00
parent 9a06b4d248
commit b5f74cbf62
2 changed files with 16 additions and 7 deletions

View File

@ -318,12 +318,19 @@ const formatItem = (
const outputSchema: any[] = [] const outputSchema: any[] = []
Object.keys(output_schema.properties).forEach((outputKey) => { Object.keys(output_schema.properties).forEach((outputKey) => {
const output = output_schema.properties[outputKey] const output = output_schema.properties[outputKey]
const dataType = output.type
outputSchema.push({ outputSchema.push({
variable: outputKey, variable: outputKey,
type: output.type === 'array' type: dataType
? `array[${output.items?.type.slice(0, 1).toLocaleLowerCase()}${output.items?.type.slice(1)}]` ? `array[${output.items?.type.slice(0, 1).toLocaleLowerCase()}${output.items?.type.slice(1)}]`
: `${output.type.slice(0, 1).toLocaleLowerCase()}${output.type.slice(1)}`, : `${output.type.slice(0, 1).toLocaleLowerCase()}${output.type.slice(1)}`,
description: output.description, description: output.description,
children: output.type === 'object' ? {
schema: {
type: 'object',
properties: output.properties,
},
} : undefined,
}) })
}) })
res.vars = [ res.vars = [

View File

@ -17,6 +17,7 @@ import ResultPanel from '@/app/components/workflow/run/result-panel'
import { useToolIcon } from '@/app/components/workflow/hooks' import { useToolIcon } from '@/app/components/workflow/hooks'
import { useLogs } from '@/app/components/workflow/run/hooks' import { useLogs } from '@/app/components/workflow/run/hooks'
import formatToTracingNodeList from '@/app/components/workflow/run/utils/format-log' import formatToTracingNodeList from '@/app/components/workflow/run/utils/format-log'
import StructureOutputItem from '@/app/components/workflow/nodes/_base/components/variable/object-child-tree-panel/show'
const i18nPrefix = 'workflow.nodes.tool' const i18nPrefix = 'workflow.nodes.tool'
@ -148,12 +149,13 @@ const Panel: FC<NodePanelProps<ToolNodeType>> = ({
description={t(`${i18nPrefix}.outputVars.json`)} description={t(`${i18nPrefix}.outputVars.json`)}
/> />
{outputSchema.map(outputItem => ( {outputSchema.map(outputItem => (
<VarItem // <VarItem
key={outputItem.name} // key={outputItem.name}
name={outputItem.name} // name={outputItem.name}
type={outputItem.type} // type={outputItem.type}
description={outputItem.description} // description={outputItem.description}
/> // />
<StructureOutputItem payload={outputItem} />
))} ))}
</> </>
</OutputVars> </OutputVars>