From be6263d5229e82b80d2a87b1f2f5cbc4b4aac185 Mon Sep 17 00:00:00 2001 From: balibabu Date: Thu, 30 Jul 2026 10:39:01 +0800 Subject: [PATCH] Fix: The compiler operator icon is not displaying on the pipeline log page. (#17545) --- .../agent => components}/operator-icon.tsx | 16 ++++++- web/src/constants/agent.tsx | 2 +- .../pages/agent/canvas/node/begin-node.tsx | 2 +- .../pages/agent/canvas/node/chunker-node.tsx | 2 +- .../node/dropdown/accordion-operators.tsx | 6 +-- .../node/dropdown/operator-item-list.tsx | 2 +- web/src/pages/agent/canvas/node/file-node.tsx | 2 +- .../agent/canvas/node/iteration-node.tsx | 2 +- .../pages/agent/canvas/node/node-header.tsx | 2 +- web/src/pages/agent/canvas/node/tool-node.tsx | 2 +- web/src/pages/agent/constant/index.tsx | 8 ++-- .../agent/form-sheet/form-config-map.tsx | 2 +- web/src/pages/agent/form-sheet/next.tsx | 2 +- .../agent/form/agent-form/agent-tools.tsx | 2 +- .../agent-form/tool-popover/tool-command.tsx | 2 +- web/src/pages/agent/hooks/use-add-node.ts | 2 +- .../pages/agent/hooks/use-build-options.tsx | 2 +- .../pages/agent/hooks/use-get-begin-query.tsx | 2 +- .../agent/log-sheet/tool-timeline-item.tsx | 2 +- .../agent/log-sheet/workflow-timeline.tsx | 2 +- .../pipeline-log-sheet/dataflow-timeline.tsx | 2 +- .../pages/agent/webhook-sheet/timeline.tsx | 2 +- .../components/time-line/index.tsx | 44 ------------------- web/src/pages/dataflow-result/constant.ts | 1 + web/src/pages/dataflow-result/hooks.ts | 42 +++++++++++------- web/src/utils/canvas-util.tsx | 2 +- 26 files changed, 67 insertions(+), 90 deletions(-) rename web/src/{pages/agent => components}/operator-icon.tsx (90%) diff --git a/web/src/pages/agent/operator-icon.tsx b/web/src/components/operator-icon.tsx similarity index 90% rename from web/src/pages/agent/operator-icon.tsx rename to web/src/components/operator-icon.tsx index 95750b1142..0996c42dee 100644 --- a/web/src/pages/agent/operator-icon.tsx +++ b/web/src/components/operator-icon.tsx @@ -10,9 +10,15 @@ import { HousePlus, Infinity as InfinityIcon, LogOut, + LucideBlocks, + LucideFile, + LucideFilePlay, + LucideFileStack, + LucideHeading, + LucideListPlus, } from 'lucide-react'; import { Component } from 'react'; -import { Operator } from './constant'; +import { Operator } from '../constants/agent'; interface IProps { name: Operator; @@ -64,7 +70,13 @@ export const LucideIconMap = { [Operator.ExitLoop]: LogOut, [Operator.DocGenerator]: FileText, [Operator.Browser]: Globe, - [Operator.Compilation]: Columns3Cog, + [Operator.Compiler]: Columns3Cog, + [Operator.File]: LucideFile, + [Operator.Parser]: LucideFilePlay, + [Operator.Tokenizer]: LucideListPlus, + [Operator.TokenChunker]: LucideBlocks, + [Operator.TitleChunker]: LucideHeading, + [Operator.Extractor]: LucideFileStack, }; const Empty = () => { diff --git a/web/src/constants/agent.tsx b/web/src/constants/agent.tsx index 6eb5dcce0e..88080d0e53 100644 --- a/web/src/constants/agent.tsx +++ b/web/src/constants/agent.tsx @@ -114,7 +114,7 @@ export enum Operator { TokenChunker = 'TokenChunker', TitleChunker = 'TitleChunker', Extractor = 'Extractor', - Compilation = 'Compiler', + Compiler = 'Compiler', Loop = 'Loop', LoopStart = 'LoopItem', ExitLoop = 'ExitLoop', diff --git a/web/src/pages/agent/canvas/node/begin-node.tsx b/web/src/pages/agent/canvas/node/begin-node.tsx index 60c20ad9c4..b469f78c8a 100644 --- a/web/src/pages/agent/canvas/node/begin-node.tsx +++ b/web/src/pages/agent/canvas/node/begin-node.tsx @@ -14,7 +14,7 @@ import { import { BeginFormSchemaType } from '../../form/begin-form/schema'; import { useBuildWebhookUrl } from '../../hooks/use-build-webhook-url'; import { useIsPipeline } from '../../hooks/use-is-pipeline'; -import OperatorIcon from '../../operator-icon'; +import OperatorIcon from '@/components/operator-icon'; import { LabelCard } from './card'; import { CommonHandle } from './handle'; import { RightHandleStyle } from './handle-icon'; diff --git a/web/src/pages/agent/canvas/node/chunker-node.tsx b/web/src/pages/agent/canvas/node/chunker-node.tsx index 81cd6db08a..f8ce9f405d 100644 --- a/web/src/pages/agent/canvas/node/chunker-node.tsx +++ b/web/src/pages/agent/canvas/node/chunker-node.tsx @@ -2,7 +2,7 @@ import { IRagNode } from '@/interfaces/database/agent'; import { NodeProps, Position } from '@xyflow/react'; import { PropsWithChildren, memo } from 'react'; import { NodeHandleId, Operator } from '../../constant'; -import OperatorIcon from '../../operator-icon'; +import OperatorIcon from '@/components/operator-icon'; import { LabelCard } from './card'; import { CommonHandle } from './handle'; import { LeftHandleStyle, RightHandleStyle } from './handle-icon'; diff --git a/web/src/pages/agent/canvas/node/dropdown/accordion-operators.tsx b/web/src/pages/agent/canvas/node/dropdown/accordion-operators.tsx index a4a6cdd9e5..a81b362649 100644 --- a/web/src/pages/agent/canvas/node/dropdown/accordion-operators.tsx +++ b/web/src/pages/agent/canvas/node/dropdown/accordion-operators.tsx @@ -174,8 +174,8 @@ export function PipelineAccordionOperators({ ...restrictSingleOperatorOnCanvas([Operator.Parser, Operator.Tokenizer]), ]; list.push(Operator.Extractor); - if (getOperatorTypeFromId(nodeId) !== Operator.Compilation) { - list.push(Operator.Compilation); + if (getOperatorTypeFromId(nodeId) !== Operator.Compiler) { + list.push(Operator.Compiler); } return list; }, [getOperatorTypeFromId, nodeId, restrictSingleOperatorOnCanvas]); @@ -192,7 +192,7 @@ export function PipelineAccordionOperators({ const showChunker = useMemo(() => { return ( getOperatorTypeFromId(nodeId) !== Operator.Extractor && - getOperatorTypeFromId(nodeId) !== Operator.Compilation && + getOperatorTypeFromId(nodeId) !== Operator.Compiler && chunkerOperators.length > 0 ); }, [chunkerOperators.length, getOperatorTypeFromId, nodeId]); diff --git a/web/src/pages/agent/canvas/node/dropdown/operator-item-list.tsx b/web/src/pages/agent/canvas/node/dropdown/operator-item-list.tsx index 5b1860c75a..b47b996bb7 100644 --- a/web/src/pages/agent/canvas/node/dropdown/operator-item-list.tsx +++ b/web/src/pages/agent/canvas/node/dropdown/operator-item-list.tsx @@ -7,7 +7,7 @@ import { import { Operator } from '@/constants/agent'; import { IModalProps } from '@/interfaces/common'; import { AgentInstanceContext, HandleContext } from '@/pages/agent/context'; -import OperatorIcon from '@/pages/agent/operator-icon'; +import OperatorIcon from '@/components/operator-icon'; import { Position } from '@xyflow/react'; import { lowerFirst } from 'lodash'; import { createContext, useContext } from 'react'; diff --git a/web/src/pages/agent/canvas/node/file-node.tsx b/web/src/pages/agent/canvas/node/file-node.tsx index d98c53edc3..f83f9907fd 100644 --- a/web/src/pages/agent/canvas/node/file-node.tsx +++ b/web/src/pages/agent/canvas/node/file-node.tsx @@ -11,7 +11,7 @@ import { Operator, } from '../../constant'; import { BeginQuery } from '../../interface'; -import OperatorIcon from '../../operator-icon'; +import OperatorIcon from '@/components/operator-icon'; import { CommonHandle } from './handle'; import { RightHandleStyle } from './handle-icon'; import styles from './index.module.less'; diff --git a/web/src/pages/agent/canvas/node/iteration-node.tsx b/web/src/pages/agent/canvas/node/iteration-node.tsx index 13eca01336..46fe6bfbba 100644 --- a/web/src/pages/agent/canvas/node/iteration-node.tsx +++ b/web/src/pages/agent/canvas/node/iteration-node.tsx @@ -6,7 +6,7 @@ import { cn } from '@/lib/utils'; import { NodeProps, NodeResizeControl, Position } from '@xyflow/react'; import { memo } from 'react'; import { NodeHandleId, Operator } from '../../constant'; -import OperatorIcon from '../../operator-icon'; +import OperatorIcon from '@/components/operator-icon'; import { CommonHandle, LeftEndHandle } from './handle'; import NodeHeader from './node-header'; import { NodeWrapper } from './node-wrapper'; diff --git a/web/src/pages/agent/canvas/node/node-header.tsx b/web/src/pages/agent/canvas/node/node-header.tsx index de5b222ede..5263065d08 100644 --- a/web/src/pages/agent/canvas/node/node-header.tsx +++ b/web/src/pages/agent/canvas/node/node-header.tsx @@ -1,7 +1,7 @@ import { cn } from '@/lib/utils'; import { memo } from 'react'; import { Operator } from '../../constant'; -import OperatorIcon from '../../operator-icon'; +import OperatorIcon from '@/components/operator-icon'; interface IProps { id: string; label: string; diff --git a/web/src/pages/agent/canvas/node/tool-node.tsx b/web/src/pages/agent/canvas/node/tool-node.tsx index 929ea0ac9f..6b014dc2f5 100644 --- a/web/src/pages/agent/canvas/node/tool-node.tsx +++ b/web/src/pages/agent/canvas/node/tool-node.tsx @@ -6,7 +6,7 @@ import { memo } from 'react'; import { NodeHandleId, Operator } from '../../constant'; import { ToolCard } from '../../form/agent-form/agent-tools'; import { useFindMcpById } from '../../hooks/use-find-mcp-by-id'; -import OperatorIcon from '../../operator-icon'; +import OperatorIcon from '@/components/operator-icon'; import useGraphStore from '../../store'; import { NodeWrapper } from './node-wrapper'; diff --git a/web/src/pages/agent/constant/index.tsx b/web/src/pages/agent/constant/index.tsx index 15242fa3d1..8474e33817 100644 --- a/web/src/pages/agent/constant/index.tsx +++ b/web/src/pages/agent/constant/index.tsx @@ -759,7 +759,7 @@ export const RestrictedUpstreamMap = { [Operator.TitleChunker]: [Operator.Begin], [Operator.Tokenizer]: [Operator.Begin], [Operator.Extractor]: [Operator.Begin], - [Operator.Compilation]: [Operator.Begin], + [Operator.Compiler]: [Operator.Begin], [Operator.File]: [Operator.Begin], [Operator.Loop]: [Operator.Begin], [Operator.LoopStart]: [Operator.Begin], @@ -811,7 +811,7 @@ export const NodeMap = { [Operator.TokenChunker]: 'chunkerNode', [Operator.TitleChunker]: 'chunkerNode', [Operator.Extractor]: 'contextNode', - [Operator.Compilation]: 'compilationNode', + [Operator.Compiler]: 'compilationNode', [Operator.DataOperations]: 'dataOperationsNode', [Operator.ListOperations]: 'listOperationsNode', [Operator.VariableAssigner]: 'variableAssignerNode', @@ -858,7 +858,7 @@ export const NoDebugOperatorsList = [ Operator.TokenChunker, Operator.TitleChunker, Operator.Extractor, - Operator.Compilation, + Operator.Compiler, Operator.Tool, Operator.Loop, ]; @@ -870,7 +870,7 @@ export const NoCopyOperatorsList = [ Operator.TokenChunker, Operator.TitleChunker, Operator.Extractor, - Operator.Compilation, + Operator.Compiler, ]; export enum NodeHandleId { diff --git a/web/src/pages/agent/form-sheet/form-config-map.tsx b/web/src/pages/agent/form-sheet/form-config-map.tsx index 5d7261dbe1..8176fe64a5 100644 --- a/web/src/pages/agent/form-sheet/form-config-map.tsx +++ b/web/src/pages/agent/form-sheet/form-config-map.tsx @@ -180,7 +180,7 @@ export const FormConfigMap = { [Operator.Extractor]: { component: ExtractorForm, }, - [Operator.Compilation]: { + [Operator.Compiler]: { component: CompilationForm, }, [Operator.DataOperations]: { diff --git a/web/src/pages/agent/form-sheet/next.tsx b/web/src/pages/agent/form-sheet/next.tsx index 245c680947..950323badb 100644 --- a/web/src/pages/agent/form-sheet/next.tsx +++ b/web/src/pages/agent/form-sheet/next.tsx @@ -15,7 +15,7 @@ import { Operator } from '../constant'; import { AgentFormContext } from '../context'; import { RunTooltip } from '../flow-tooltip'; import { useIsMcp } from '../hooks/use-is-mcp'; -import OperatorIcon from '../operator-icon'; +import OperatorIcon from '@/components/operator-icon'; import useGraphStore from '../store'; import { needsSingleStepDebugging } from '../utils'; import { FormConfigMap } from './form-config-map'; diff --git a/web/src/pages/agent/form/agent-form/agent-tools.tsx b/web/src/pages/agent/form/agent-form/agent-tools.tsx index 347abbfd20..239e54b185 100644 --- a/web/src/pages/agent/form/agent-form/agent-tools.tsx +++ b/web/src/pages/agent/form/agent-form/agent-tools.tsx @@ -20,7 +20,7 @@ import { Operator } from '../../constant'; import { AgentInstanceContext } from '../../context'; import { useFindMcpById } from '../../hooks/use-find-mcp-by-id'; import { INextOperatorForm } from '../../interface'; -import OperatorIcon from '../../operator-icon'; +import OperatorIcon from '@/components/operator-icon'; import useGraphStore from '../../store'; import { filterDownstreamAgentNodeIds } from '../../utils/filter-downstream-nodes'; import { ToolPopover } from './tool-popover'; diff --git a/web/src/pages/agent/form/agent-form/tool-popover/tool-command.tsx b/web/src/pages/agent/form/agent-form/tool-popover/tool-command.tsx index 7ed2af7b87..ff6172ca74 100644 --- a/web/src/pages/agent/form/agent-form/tool-popover/tool-command.tsx +++ b/web/src/pages/agent/form/agent-form/tool-popover/tool-command.tsx @@ -9,7 +9,7 @@ import { } from '@/components/ui/command'; import { useListMcpServer } from '@/hooks/use-mcp-request'; import { Operator } from '@/pages/agent/constant'; -import OperatorIcon from '@/pages/agent/operator-icon'; +import OperatorIcon from '@/components/operator-icon'; import { t } from 'i18next'; import { lowerFirst } from 'lodash'; import { LucidePlus } from 'lucide-react'; diff --git a/web/src/pages/agent/hooks/use-add-node.ts b/web/src/pages/agent/hooks/use-add-node.ts index 6bb13d9ae7..82491da75e 100644 --- a/web/src/pages/agent/hooks/use-add-node.ts +++ b/web/src/pages/agent/hooks/use-add-node.ts @@ -185,7 +185,7 @@ export const useInitializeOperatorParams = () => { sys_prompt: t('flow.prompts.system.summary'), prompts: t('flow.prompts.user.summary'), }, - [Operator.Compilation]: initialCompilationValues, + [Operator.Compiler]: initialCompilationValues, [Operator.DataOperations]: initialDataOperationsValues, [Operator.ListOperations]: initialListOperationsValues, [Operator.VariableAssigner]: initialVariableAssignerValues, diff --git a/web/src/pages/agent/hooks/use-build-options.tsx b/web/src/pages/agent/hooks/use-build-options.tsx index 10523178bc..d745ef1753 100644 --- a/web/src/pages/agent/hooks/use-build-options.tsx +++ b/web/src/pages/agent/hooks/use-build-options.tsx @@ -1,7 +1,7 @@ import { buildUpstreamNodeOutputOptions } from '@/utils/canvas-util'; import { useMemo } from 'react'; import { Operator } from '../constant'; -import OperatorIcon from '../operator-icon'; +import OperatorIcon from '@/components/operator-icon'; import useGraphStore from '../store'; export function useBuildNodeOutputOptions(nodeId?: string) { diff --git a/web/src/pages/agent/hooks/use-get-begin-query.tsx b/web/src/pages/agent/hooks/use-get-begin-query.tsx index 35fa9ae0c8..f64158b611 100644 --- a/web/src/pages/agent/hooks/use-get-begin-query.tsx +++ b/web/src/pages/agent/hooks/use-get-begin-query.tsx @@ -26,7 +26,7 @@ import { import { AgentFormContext } from '../context'; import { buildBeginInputListFromObject } from '../form/begin-form/utils'; import { BeginQuery } from '../interface'; -import OperatorIcon from '../operator-icon'; +import OperatorIcon from '@/components/operator-icon'; import useGraphStore from '../store'; import { useFindAgentStructuredOutputLabelByValue, diff --git a/web/src/pages/agent/log-sheet/tool-timeline-item.tsx b/web/src/pages/agent/log-sheet/tool-timeline-item.tsx index 8ea32586b2..f7d7d71a6c 100644 --- a/web/src/pages/agent/log-sheet/tool-timeline-item.tsx +++ b/web/src/pages/agent/log-sheet/tool-timeline-item.tsx @@ -15,7 +15,7 @@ import { cn } from '@/lib/utils'; import { isEmpty } from 'lodash'; import { Operator } from '../constant'; import { JsonViewer } from '../form/components/json-viewer'; -import OperatorIcon, { SVGIconMap } from '../operator-icon'; +import OperatorIcon, { SVGIconMap } from '@/components/operator-icon'; import { getToolOperatorName } from './tool-name'; import { toLowerCaseStringAndDeleteChar, typeMap } from './workflow-timeline'; type IToolIcon = diff --git a/web/src/pages/agent/log-sheet/workflow-timeline.tsx b/web/src/pages/agent/log-sheet/workflow-timeline.tsx index d0edb7e3e7..f4db0df83f 100644 --- a/web/src/pages/agent/log-sheet/workflow-timeline.tsx +++ b/web/src/pages/agent/log-sheet/workflow-timeline.tsx @@ -27,7 +27,7 @@ import React, { useCallback, useEffect, useMemo } from 'react'; import { Operator } from '../constant'; import { JsonViewer } from '../form/components/json-viewer'; import { useCacheChatLog } from '../hooks/use-cache-chat-log'; -import OperatorIcon from '../operator-icon'; +import OperatorIcon from '@/components/operator-icon'; import ToolTimelineItem from './tool-timeline-item'; type LogFlowTimelineProps = Pick< ReturnType, diff --git a/web/src/pages/agent/pipeline-log-sheet/dataflow-timeline.tsx b/web/src/pages/agent/pipeline-log-sheet/dataflow-timeline.tsx index e15465baf9..90489b25a5 100644 --- a/web/src/pages/agent/pipeline-log-sheet/dataflow-timeline.tsx +++ b/web/src/pages/agent/pipeline-log-sheet/dataflow-timeline.tsx @@ -14,7 +14,7 @@ import { isEmpty } from 'lodash'; import { File } from 'lucide-react'; import { useCallback } from 'react'; import { Operator } from '../constant'; -import OperatorIcon from '../operator-icon'; +import OperatorIcon from '@/components/operator-icon'; import useGraphStore from '../store'; export type DataflowTimelineProps = { diff --git a/web/src/pages/agent/webhook-sheet/timeline.tsx b/web/src/pages/agent/webhook-sheet/timeline.tsx index 7bec40804c..90e9c5bb69 100644 --- a/web/src/pages/agent/webhook-sheet/timeline.tsx +++ b/web/src/pages/agent/webhook-sheet/timeline.tsx @@ -28,7 +28,7 @@ import { Operator } from '../constant'; import { JsonViewer } from '../form/components/json-viewer'; import { useCacheChatLog } from '../hooks/use-cache-chat-log'; import ToolTimelineItem from '../log-sheet/tool-timeline-item'; -import OperatorIcon from '../operator-icon'; +import OperatorIcon from '@/components/operator-icon'; type LogFlowTimelineProps = Pick< ReturnType, 'currentEventListWithoutMessage' | 'currentMessageId' diff --git a/web/src/pages/dataflow-result/components/time-line/index.tsx b/web/src/pages/dataflow-result/components/time-line/index.tsx index 3c0a3ca678..21e38819d0 100644 --- a/web/src/pages/dataflow-result/components/time-line/index.tsx +++ b/web/src/pages/dataflow-result/components/time-line/index.tsx @@ -1,51 +1,7 @@ import { CustomTimeline, TimelineNode } from '@/components/originui/timeline'; -import { - LucideBlocks, - LucideFile, - LucideFilePlay, - LucideFileStack, - LucideHeading, - LucideListPlus, -} from 'lucide-react'; import { useMemo } from 'react'; -import { TimelineNodeType } from '../../constant'; import { IPipelineFileLogDetail } from '../../interface'; -export type ITimelineNodeObj = { - title: string; - icon: JSX.Element; - clickable?: boolean; - type: TimelineNodeType; -}; - -export const TimelineNodeObj = { - [TimelineNodeType.begin]: { - title: 'File', - icon: , - clickable: false, - }, - [TimelineNodeType.parser]: { - title: 'Parser', - icon: , - }, - [TimelineNodeType.contextGenerator]: { - title: 'Context Generator', - icon: , - }, - [TimelineNodeType.titleChunker]: { - title: 'Title Chunker', - icon: , - }, - [TimelineNodeType.tokenChunker]: { - title: 'Token Chunker', - icon: , - }, - [TimelineNodeType.tokenizer]: { - title: 'Tokenizer', - icon: , - clickable: false, - }, -}; export interface TimelineDataFlowProps { activeId: number | string; activeFunc: (id: number | string, step: TimelineNode) => void; diff --git a/web/src/pages/dataflow-result/constant.ts b/web/src/pages/dataflow-result/constant.ts index bf09b3b483..1033a47506 100644 --- a/web/src/pages/dataflow-result/constant.ts +++ b/web/src/pages/dataflow-result/constant.ts @@ -10,6 +10,7 @@ export enum TimelineNodeType { titleChunker = 'titleChunker', tokenChunker = 'tokenChunker', tokenizer = 'tokenizer', + compiler = 'compiler', end = 'end', } diff --git a/web/src/pages/dataflow-result/hooks.ts b/web/src/pages/dataflow-result/hooks.ts index 4cb1bc5868..02c16aab3b 100644 --- a/web/src/pages/dataflow-result/hooks.ts +++ b/web/src/pages/dataflow-result/hooks.ts @@ -10,10 +10,17 @@ import { buildChunkHighlights } from '@/utils/document-util'; import { useMutation, useQuery } from '@tanstack/react-query'; import { t } from 'i18next'; import { camelCase, upperFirst } from 'lodash'; -import { useCallback, useEffect, useMemo, useState } from 'react'; +import { + createElement, + useCallback, + useEffect, + useMemo, + useState, +} from 'react'; import { IHighlight } from 'react-pdf-highlighter'; import { useParams, useSearchParams } from 'react-router'; -import { ITimelineNodeObj, TimelineNodeObj } from './components/time-line'; +import OperatorIcon from '@/components/operator-icon'; +import { Operator } from '@/constants/agent'; import { ChunkTextMode, PipelineResultSearchParams, @@ -214,17 +221,16 @@ export const useRerunDataflow = ({ export const useTimelineDataFlow = (data: IPipelineFileLogDetail) => { const timelineNodes: TimelineNode[] = useMemo(() => { - const nodes: Array = []; - console.log('time-->', data); + const nodes: Array< + TimelineNode & { detail: { value: IDslComponent; key: string } } + > = []; const times = data?.dsl?.components; const graphNodes = data?.dsl?.graph?.nodes; if (times) { const getNode = (key: string, index: number, type: TimelineNodeType) => { const node = times[key].obj; const graphNode = graphNodes?.find((item) => item.id === key); - const name = camelCase( - node.component_name, - ) as keyof typeof TimelineNodeObj; + const name = camelCase(node.component_name); let tempType = type; if (name === TimelineNodeType.parser) { @@ -237,9 +243,19 @@ export const useTimelineDataFlow = (data: IPipelineFileLogDetail) => { ) { tempType = name; } + const operatorName = upperFirst(name) as keyof typeof Operator; const timeNode = { - ...TimelineNodeObj[name], + icon: Operator[operatorName] + ? createElement(OperatorIcon, { + name: Operator[operatorName], + }) + : undefined, title: graphNode?.data?.name, + clickable: ![ + TimelineNodeType.begin, + TimelineNodeType.tokenizer, + TimelineNodeType.compiler, + ].includes(name as TimelineNodeType), id: index, className: 'w-32', completed: false, @@ -248,26 +264,18 @@ export const useTimelineDataFlow = (data: IPipelineFileLogDetail) => { ), type: tempType, detail: { value: times[key], key: key }, - } as ITimelineNodeObj & { - id: number | string; - className: string; - completed: boolean; - date: string; - type: TimelineNodeType; + } as TimelineNode & { detail: { value: IDslComponent; key: string }; }; - console.log('timeNodetype-->', type); nodes.push(timeNode); if (times[key].downstream && times[key].downstream.length > 0) { const nextKey = times[key].downstream[0]; - // nodes.push(timeNode); getNode(nextKey, index + 1, tempType); } }; getNode(upperFirst(TimelineNodeType.begin), 1, TimelineNodeType.begin); - // setTimelineNodeArr(nodes as unknown as ITimelineNodeObj & {id: number | string}) } return nodes; }, [data]); diff --git a/web/src/utils/canvas-util.tsx b/web/src/utils/canvas-util.tsx index 098d6b88b8..8a0d5ef6fe 100644 --- a/web/src/utils/canvas-util.tsx +++ b/web/src/utils/canvas-util.tsx @@ -4,7 +4,7 @@ import { Operator, } from '@/constants/agent'; import { BaseNode } from '@/interfaces/database/agent'; -import OperatorIcon from '@/pages/agent/operator-icon'; +import OperatorIcon from '@/components/operator-icon'; import { Edge } from '@xyflow/react'; import { get, isEmpty } from 'lodash';