This commit is contained in:
Joel 2024-12-30 15:47:24 +08:00
parent 9b6f580365
commit 128410902c
2 changed files with 41 additions and 0 deletions

View File

@ -89,3 +89,39 @@ export const agentNodeData = (() => {
}],
}
})()
export const oneStepCircle = (() => {
const node = {
node_type: BlockEnum.Agent,
execution_metadata: {
agent_log: [
{ id: '1', label: 'Node 1' },
{ id: '1', parent_id: '1', label: 'Node 1' },
{ id: '1', parent_id: '1', label: 'Node 1' },
{ id: '1', parent_id: '1', label: 'Node 1' },
{ id: '1', parent_id: '1', label: 'Node 1' },
{ id: '1', parent_id: '1', label: 'Node 1' },
],
},
}
return {
in: [node],
expect: [{
...node,
agentLog: [
{
id: '1',
label: 'Node 1',
hasCircle: true,
},
],
}],
}
})()
export const multiStepsCircle = () => {
}
export const CircleNestCircle = (() => {
})()

View File

@ -3,6 +3,10 @@ import type { AgentLogItem, AgentLogItemWithChildren, NodeTracing } from '@/type
const supportedAgentLogNodes = [BlockEnum.Agent, BlockEnum.Tool]
const removeCircle = (node: NodeTracing) => {
}
const listToTree = (logs: AgentLogItem[]) => {
if (!logs || logs.length === 0)
return []
@ -24,6 +28,7 @@ const listToTree = (logs: AgentLogItem[]) => {
})
return tree
}
const format = (list: NodeTracing[]): NodeTracing[] => {
const result: NodeTracing[] = list.map((item) => {
if (supportedAgentLogNodes.includes(item.node_type) && item.execution_metadata?.agent_log && item.execution_metadata?.agent_log.length > 0)