Merge branch 'feat/plugins' into dev/plugin-deploy
This commit is contained in:
commit
76d7a64c37
@ -355,7 +355,7 @@ function Form<
|
|||||||
label={label[language] || label.en_US}
|
label={label[language] || label.en_US}
|
||||||
required={required}
|
required={required}
|
||||||
tooltip={tooltip?.[language] || tooltip?.en_US}
|
tooltip={tooltip?.[language] || tooltip?.en_US}
|
||||||
value={value[variable]}
|
value={value[variable] || []}
|
||||||
onChange={item => handleFormChange(variable, item as any)}
|
onChange={item => handleFormChange(variable, item as any)}
|
||||||
/>
|
/>
|
||||||
{fieldMoreInfo?.(formSchema)}
|
{fieldMoreInfo?.(formSchema)}
|
||||||
|
@ -25,7 +25,7 @@ type Props = {
|
|||||||
|
|
||||||
const MultipleToolSelector = ({
|
const MultipleToolSelector = ({
|
||||||
disabled,
|
disabled,
|
||||||
value,
|
value = [],
|
||||||
label,
|
label,
|
||||||
required,
|
required,
|
||||||
tooltip,
|
tooltip,
|
||||||
|
@ -179,7 +179,7 @@ export const AgentStrategy = (props: AgentStrategyProps) => {
|
|||||||
return (
|
return (
|
||||||
<MultipleToolSelector
|
<MultipleToolSelector
|
||||||
scope={schema.scope}
|
scope={schema.scope}
|
||||||
value={value}
|
value={value || []}
|
||||||
label={schema.label[language]}
|
label={schema.label[language]}
|
||||||
tooltip={schema.tooltip?.[language]}
|
tooltip={schema.tooltip?.[language]}
|
||||||
onChange={onChange}
|
onChange={onChange}
|
||||||
|
@ -12,9 +12,11 @@ import { CodeLanguage } from '@/app/components/workflow/nodes/code/types'
|
|||||||
|
|
||||||
type AgentLogItemProps = {
|
type AgentLogItemProps = {
|
||||||
item: AgentLogItemWithChildren
|
item: AgentLogItemWithChildren
|
||||||
|
onShowAgentOrToolLog: (detail: AgentLogItemWithChildren) => void
|
||||||
}
|
}
|
||||||
const AgentLogItem = ({
|
const AgentLogItem = ({
|
||||||
item,
|
item,
|
||||||
|
onShowAgentOrToolLog,
|
||||||
}: AgentLogItemProps) => {
|
}: AgentLogItemProps) => {
|
||||||
const {
|
const {
|
||||||
label,
|
label,
|
||||||
@ -51,7 +53,7 @@ const AgentLogItem = ({
|
|||||||
<Button
|
<Button
|
||||||
className='flex items-center justify-between mb-1 w-full'
|
className='flex items-center justify-between mb-1 w-full'
|
||||||
variant='tertiary'
|
variant='tertiary'
|
||||||
onClick={() => {}}
|
onClick={() => onShowAgentOrToolLog(item)}
|
||||||
>
|
>
|
||||||
<div className='flex items-center'>
|
<div className='flex items-center'>
|
||||||
<RiListView className='mr-1 w-4 h-4 text-components-button-tertiary-text shrink-0' />
|
<RiListView className='mr-1 w-4 h-4 text-components-button-tertiary-text shrink-0' />
|
||||||
|
@ -6,12 +6,15 @@ import {
|
|||||||
PortalToFollowElemTrigger,
|
PortalToFollowElemTrigger,
|
||||||
} from '@/app/components/base/portal-to-follow-elem'
|
} from '@/app/components/base/portal-to-follow-elem'
|
||||||
import Button from '@/app/components/base/button'
|
import Button from '@/app/components/base/button'
|
||||||
|
import type { AgentLogItemWithChildren } from '@/types/workflow'
|
||||||
|
|
||||||
type AgentLogNavMoreProps = {
|
type AgentLogNavMoreProps = {
|
||||||
options: { id: string; label: string }[]
|
options: { id: string; label: string }[]
|
||||||
|
onShowAgentOrToolLog: (detail?: AgentLogItemWithChildren) => void
|
||||||
}
|
}
|
||||||
const AgentLogNavMore = ({
|
const AgentLogNavMore = ({
|
||||||
options,
|
options,
|
||||||
|
onShowAgentOrToolLog,
|
||||||
}: AgentLogNavMoreProps) => {
|
}: AgentLogNavMoreProps) => {
|
||||||
const [open, setOpen] = useState(false)
|
const [open, setOpen] = useState(false)
|
||||||
|
|
||||||
@ -40,6 +43,10 @@ const AgentLogNavMore = ({
|
|||||||
<div
|
<div
|
||||||
key={option.id}
|
key={option.id}
|
||||||
className='flex items-center px-2 h-8 rounded-lg system-md-regular text-text-secondary hover:bg-state-base-hover cursor-pointer'
|
className='flex items-center px-2 h-8 rounded-lg system-md-regular text-text-secondary hover:bg-state-base-hover cursor-pointer'
|
||||||
|
onClick={() => {
|
||||||
|
onShowAgentOrToolLog(option as AgentLogItemWithChildren)
|
||||||
|
setOpen(false)
|
||||||
|
}}
|
||||||
>
|
>
|
||||||
{option.label}
|
{option.label}
|
||||||
</div>
|
</div>
|
||||||
|
@ -1,15 +1,25 @@
|
|||||||
import { RiArrowLeftLine } from '@remixicon/react'
|
import { RiArrowLeftLine } from '@remixicon/react'
|
||||||
import AgentLogNavMore from './agent-log-nav-more'
|
import AgentLogNavMore from './agent-log-nav-more'
|
||||||
import Button from '@/app/components/base/button'
|
import Button from '@/app/components/base/button'
|
||||||
|
import type { AgentLogItemWithChildren } from '@/types/workflow'
|
||||||
|
|
||||||
|
type AgentLogNavProps = {
|
||||||
|
agentOrToolLogItemStack: { id: string; label: string }[]
|
||||||
|
onShowAgentOrToolLog: (detail?: AgentLogItemWithChildren) => void
|
||||||
|
}
|
||||||
|
const AgentLogNav = ({
|
||||||
|
agentOrToolLogItemStack,
|
||||||
|
onShowAgentOrToolLog,
|
||||||
|
}: AgentLogNavProps) => {
|
||||||
|
const options = agentOrToolLogItemStack.slice(2)
|
||||||
|
|
||||||
const AgentLogNav = () => {
|
|
||||||
return (
|
return (
|
||||||
<div className='flex items-center p-1 pr-3 h-8'>
|
<div className='flex items-center p-1 pr-3 h-8'>
|
||||||
<Button
|
<Button
|
||||||
className='shrink-0 px-[5px]'
|
className='shrink-0 px-[5px]'
|
||||||
size='small'
|
size='small'
|
||||||
variant='ghost-accent'
|
variant='ghost-accent'
|
||||||
onClick={() => {}}
|
onClick={() => onShowAgentOrToolLog()}
|
||||||
>
|
>
|
||||||
<RiArrowLeftLine className='mr-1 w-3.5 h-3.5' />
|
<RiArrowLeftLine className='mr-1 w-3.5 h-3.5' />
|
||||||
Agent
|
Agent
|
||||||
@ -24,10 +34,17 @@ const AgentLogNav = () => {
|
|||||||
<RiArrowLeftLine className='mr-1 w-3.5 h-3.5' />
|
<RiArrowLeftLine className='mr-1 w-3.5 h-3.5' />
|
||||||
Agent strategy
|
Agent strategy
|
||||||
</Button>
|
</Button>
|
||||||
<div className='shrink-0 mx-0.5 system-xs-regular text-divider-deep'>/</div>
|
{
|
||||||
<AgentLogNavMore
|
!!options.length && (
|
||||||
options={[]}
|
<>
|
||||||
/>
|
<div className='shrink-0 mx-0.5 system-xs-regular text-divider-deep'>/</div>
|
||||||
|
<AgentLogNavMore
|
||||||
|
options={options}
|
||||||
|
onShowAgentOrToolLog={onShowAgentOrToolLog}
|
||||||
|
/>
|
||||||
|
</>
|
||||||
|
)
|
||||||
|
}
|
||||||
<div className='shrink-0 mx-0.5 system-xs-regular text-divider-deep'>/</div>
|
<div className='shrink-0 mx-0.5 system-xs-regular text-divider-deep'>/</div>
|
||||||
<div className='flex items-center px-[5px] system-xs-medium-uppercase text-text-tertiary'>
|
<div className='flex items-center px-[5px] system-xs-medium-uppercase text-text-tertiary'>
|
||||||
Run Actions
|
Run Actions
|
||||||
|
@ -6,11 +6,11 @@ import type {
|
|||||||
|
|
||||||
type AgentLogTriggerProps = {
|
type AgentLogTriggerProps = {
|
||||||
nodeInfo: NodeTracing
|
nodeInfo: NodeTracing
|
||||||
onShowAgentResultList: (agentLogs: AgentLogItemWithChildren[]) => void
|
onShowAgentOrToolLog: (detail?: AgentLogItemWithChildren) => void
|
||||||
}
|
}
|
||||||
const AgentLogTrigger = ({
|
const AgentLogTrigger = ({
|
||||||
nodeInfo,
|
nodeInfo,
|
||||||
onShowAgentResultList,
|
onShowAgentOrToolLog,
|
||||||
}: AgentLogTriggerProps) => {
|
}: AgentLogTriggerProps) => {
|
||||||
const { agentLog } = nodeInfo
|
const { agentLog } = nodeInfo
|
||||||
|
|
||||||
@ -24,7 +24,7 @@ const AgentLogTrigger = ({
|
|||||||
<div className='grow mx-0.5 px-1 system-xs-medium text-text-secondary'></div>
|
<div className='grow mx-0.5 px-1 system-xs-medium text-text-secondary'></div>
|
||||||
<div
|
<div
|
||||||
className='shrink-0 flex items-center px-[1px] system-xs-regular-uppercase text-text-tertiary cursor-pointer'
|
className='shrink-0 flex items-center px-[1px] system-xs-regular-uppercase text-text-tertiary cursor-pointer'
|
||||||
onClick={() => onShowAgentResultList(agentLog || [])}
|
onClick={() => onShowAgentOrToolLog({ id: nodeInfo.id, children: agentLog || [] } as AgentLogItemWithChildren)}
|
||||||
>
|
>
|
||||||
Detail
|
Detail
|
||||||
<RiArrowRightLine className='ml-0.5 w-3.5 h-3.5' />
|
<RiArrowRightLine className='ml-0.5 w-3.5 h-3.5' />
|
||||||
|
@ -3,15 +3,24 @@ import AgentLogNav from './agent-log-nav'
|
|||||||
import type { AgentLogItemWithChildren } from '@/types/workflow'
|
import type { AgentLogItemWithChildren } from '@/types/workflow'
|
||||||
|
|
||||||
type AgentResultPanelProps = {
|
type AgentResultPanelProps = {
|
||||||
list: AgentLogItemWithChildren[]
|
agentOrToolLogItemStack: { id: string; label: string }[]
|
||||||
setAgentResultList: (list: AgentLogItemWithChildren[]) => void
|
agentOrToolLogListMap: Record<string, AgentLogItemWithChildren[]>
|
||||||
|
onShowAgentOrToolLog: (detail?: AgentLogItemWithChildren) => void
|
||||||
}
|
}
|
||||||
const AgentResultPanel = ({
|
const AgentResultPanel = ({
|
||||||
list,
|
agentOrToolLogItemStack,
|
||||||
|
agentOrToolLogListMap,
|
||||||
|
onShowAgentOrToolLog,
|
||||||
}: AgentResultPanelProps) => {
|
}: AgentResultPanelProps) => {
|
||||||
|
const top = agentOrToolLogItemStack[agentOrToolLogItemStack.length - 1]
|
||||||
|
const list = agentOrToolLogListMap[top.id]
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className='overflow-y-auto'>
|
<div className='overflow-y-auto'>
|
||||||
<AgentLogNav />
|
<AgentLogNav
|
||||||
|
agentOrToolLogItemStack={agentOrToolLogItemStack}
|
||||||
|
onShowAgentOrToolLog={onShowAgentOrToolLog}
|
||||||
|
/>
|
||||||
{
|
{
|
||||||
<div className='p-2'>
|
<div className='p-2'>
|
||||||
{
|
{
|
||||||
@ -19,6 +28,7 @@ const AgentResultPanel = ({
|
|||||||
<AgentLogItem
|
<AgentLogItem
|
||||||
key={item.id}
|
key={item.id}
|
||||||
item={item}
|
item={item}
|
||||||
|
onShowAgentOrToolLog={onShowAgentOrToolLog}
|
||||||
/>
|
/>
|
||||||
))
|
))
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
import {
|
import {
|
||||||
useCallback,
|
useCallback,
|
||||||
|
useRef,
|
||||||
useState,
|
useState,
|
||||||
} from 'react'
|
} from 'react'
|
||||||
import { useBoolean } from 'ahooks'
|
import { useBoolean } from 'ahooks'
|
||||||
@ -32,10 +33,38 @@ export const useLogs = () => {
|
|||||||
setIterationResultDurationMap(iterDurationMap)
|
setIterationResultDurationMap(iterDurationMap)
|
||||||
}, [setShowIteratingDetailTrue, setIterationResultList, setIterationResultDurationMap])
|
}, [setShowIteratingDetailTrue, setIterationResultList, setIterationResultDurationMap])
|
||||||
|
|
||||||
const [agentResultList, setAgentResultList] = useState<AgentLogItemWithChildren[]>([])
|
const [agentOrToolLogItemStack, setAgentOrToolLogItemStack] = useState<{ id: string; label: string }[]>([])
|
||||||
|
const agentOrToolLogItemStackRef = useRef(agentOrToolLogItemStack)
|
||||||
|
const [agentOrToolLogListMap, setAgentOrToolLogListMap] = useState<Record<string, AgentLogItemWithChildren[]>>({})
|
||||||
|
const agentOrToolLogListMapRef = useRef(agentOrToolLogListMap)
|
||||||
|
const handleShowAgentOrToolLog = useCallback((detail?: AgentLogItemWithChildren) => {
|
||||||
|
if (!detail) {
|
||||||
|
setAgentOrToolLogItemStack([])
|
||||||
|
agentOrToolLogItemStackRef.current = []
|
||||||
|
return
|
||||||
|
}
|
||||||
|
const { id, label, children } = detail
|
||||||
|
let currentAgentOrToolLogItemStack = agentOrToolLogItemStackRef.current.slice()
|
||||||
|
const index = currentAgentOrToolLogItemStack.findIndex(logItem => logItem.id === id)
|
||||||
|
|
||||||
|
if (index > -1)
|
||||||
|
currentAgentOrToolLogItemStack = currentAgentOrToolLogItemStack.slice(0, index + 1)
|
||||||
|
else
|
||||||
|
currentAgentOrToolLogItemStack = [...currentAgentOrToolLogItemStack.slice(), { id, label }]
|
||||||
|
|
||||||
|
setAgentOrToolLogItemStack(currentAgentOrToolLogItemStack)
|
||||||
|
agentOrToolLogItemStackRef.current = currentAgentOrToolLogItemStack
|
||||||
|
|
||||||
|
if (children) {
|
||||||
|
setAgentOrToolLogListMap({
|
||||||
|
...agentOrToolLogListMapRef.current,
|
||||||
|
[id]: children,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}, [setAgentOrToolLogItemStack, setAgentOrToolLogListMap])
|
||||||
|
|
||||||
return {
|
return {
|
||||||
showSpecialResultPanel: showRetryDetail || showIteratingDetail || !!agentResultList.length,
|
showSpecialResultPanel: showRetryDetail || showIteratingDetail || !!agentOrToolLogItemStack.length,
|
||||||
showRetryDetail,
|
showRetryDetail,
|
||||||
setShowRetryDetailTrue,
|
setShowRetryDetailTrue,
|
||||||
setShowRetryDetailFalse,
|
setShowRetryDetailFalse,
|
||||||
@ -52,7 +81,8 @@ export const useLogs = () => {
|
|||||||
setIterationResultDurationMap,
|
setIterationResultDurationMap,
|
||||||
handleShowIterationResultList,
|
handleShowIterationResultList,
|
||||||
|
|
||||||
agentResultList,
|
agentOrToolLogItemStack,
|
||||||
setAgentResultList,
|
agentOrToolLogListMap,
|
||||||
|
handleShowAgentOrToolLog,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -34,7 +34,7 @@ type Props = {
|
|||||||
hideProcessDetail?: boolean
|
hideProcessDetail?: boolean
|
||||||
onShowIterationDetail?: (detail: NodeTracing[][], iterDurationMap: IterationDurationMap) => void
|
onShowIterationDetail?: (detail: NodeTracing[][], iterDurationMap: IterationDurationMap) => void
|
||||||
onShowRetryDetail?: (detail: NodeTracing[]) => void
|
onShowRetryDetail?: (detail: NodeTracing[]) => void
|
||||||
onShowAgentResultList?: (detail: AgentLogItemWithChildren[]) => void
|
onShowAgentOrToolLog?: (detail?: AgentLogItemWithChildren) => void
|
||||||
notShowIterationNav?: boolean
|
notShowIterationNav?: boolean
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -46,7 +46,7 @@ const NodePanel: FC<Props> = ({
|
|||||||
hideProcessDetail,
|
hideProcessDetail,
|
||||||
onShowIterationDetail,
|
onShowIterationDetail,
|
||||||
onShowRetryDetail,
|
onShowRetryDetail,
|
||||||
onShowAgentResultList,
|
onShowAgentOrToolLog,
|
||||||
notShowIterationNav,
|
notShowIterationNav,
|
||||||
}) => {
|
}) => {
|
||||||
const [collapseState, doSetCollapseState] = useState<boolean>(true)
|
const [collapseState, doSetCollapseState] = useState<boolean>(true)
|
||||||
@ -144,10 +144,10 @@ const NodePanel: FC<Props> = ({
|
|||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
{
|
{
|
||||||
isAgentNode && onShowAgentResultList && (
|
isAgentNode && onShowAgentOrToolLog && (
|
||||||
<AgentLogTrigger
|
<AgentLogTrigger
|
||||||
nodeInfo={nodeInfo}
|
nodeInfo={nodeInfo}
|
||||||
onShowAgentResultList={onShowAgentResultList}
|
onShowAgentOrToolLog={onShowAgentOrToolLog}
|
||||||
/>
|
/>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
@ -6,7 +6,10 @@ import MetaData from './meta'
|
|||||||
import CodeEditor from '@/app/components/workflow/nodes/_base/components/editor/code-editor'
|
import CodeEditor from '@/app/components/workflow/nodes/_base/components/editor/code-editor'
|
||||||
import { CodeLanguage } from '@/app/components/workflow/nodes/code/types'
|
import { CodeLanguage } from '@/app/components/workflow/nodes/code/types'
|
||||||
import ErrorHandleTip from '@/app/components/workflow/nodes/_base/components/error-handle/error-handle-tip'
|
import ErrorHandleTip from '@/app/components/workflow/nodes/_base/components/error-handle/error-handle-tip'
|
||||||
import type { NodeTracing } from '@/types/workflow'
|
import type {
|
||||||
|
AgentLogItemWithChildren,
|
||||||
|
NodeTracing,
|
||||||
|
} from '@/types/workflow'
|
||||||
import { BlockEnum } from '@/app/components/workflow/types'
|
import { BlockEnum } from '@/app/components/workflow/types'
|
||||||
import { hasRetryNode } from '@/app/components/workflow/utils'
|
import { hasRetryNode } from '@/app/components/workflow/utils'
|
||||||
import { IterationLogTrigger } from '@/app/components/workflow/run/iteration-log'
|
import { IterationLogTrigger } from '@/app/components/workflow/run/iteration-log'
|
||||||
@ -31,7 +34,7 @@ type ResultPanelProps = {
|
|||||||
execution_metadata?: any
|
execution_metadata?: any
|
||||||
handleShowIterationResultList?: (detail: NodeTracing[][], iterDurationMap: any) => void
|
handleShowIterationResultList?: (detail: NodeTracing[][], iterDurationMap: any) => void
|
||||||
onShowRetryDetail?: (detail: NodeTracing[]) => void
|
onShowRetryDetail?: (detail: NodeTracing[]) => void
|
||||||
onShowAgentResultList?: () => void
|
handleShowAgentOrToolLog?: (detail?: AgentLogItemWithChildren) => void
|
||||||
}
|
}
|
||||||
|
|
||||||
const ResultPanel: FC<ResultPanelProps> = ({
|
const ResultPanel: FC<ResultPanelProps> = ({
|
||||||
@ -51,7 +54,7 @@ const ResultPanel: FC<ResultPanelProps> = ({
|
|||||||
execution_metadata,
|
execution_metadata,
|
||||||
handleShowIterationResultList,
|
handleShowIterationResultList,
|
||||||
onShowRetryDetail,
|
onShowRetryDetail,
|
||||||
onShowAgentResultList,
|
handleShowAgentOrToolLog,
|
||||||
}) => {
|
}) => {
|
||||||
const { t } = useTranslation()
|
const { t } = useTranslation()
|
||||||
const isIterationNode = nodeInfo?.node_type === BlockEnum.Iteration
|
const isIterationNode = nodeInfo?.node_type === BlockEnum.Iteration
|
||||||
@ -87,10 +90,10 @@ const ResultPanel: FC<ResultPanelProps> = ({
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
isAgentNode && onShowAgentResultList && (
|
isAgentNode && handleShowAgentOrToolLog && (
|
||||||
<AgentLogTrigger
|
<AgentLogTrigger
|
||||||
nodeInfo={nodeInfo}
|
nodeInfo={nodeInfo}
|
||||||
onShowAgentResultList={onShowAgentResultList}
|
onShowAgentOrToolLog={handleShowAgentOrToolLog}
|
||||||
/>
|
/>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
@ -17,8 +17,9 @@ export type SpecialResultPanelProps = {
|
|||||||
iterationResultList?: NodeTracing[][]
|
iterationResultList?: NodeTracing[][]
|
||||||
iterationResultDurationMap?: IterationDurationMap
|
iterationResultDurationMap?: IterationDurationMap
|
||||||
|
|
||||||
agentResultList?: AgentLogItemWithChildren[]
|
agentOrToolLogItemStack?: { id: string; label: string }[]
|
||||||
setAgentResultList?: (list: AgentLogItemWithChildren[]) => void
|
agentOrToolLogListMap?: Record<string, AgentLogItemWithChildren[]>
|
||||||
|
handleShowAgentOrToolLog?: (detail?: AgentLogItemWithChildren) => void
|
||||||
}
|
}
|
||||||
const SpecialResultPanel = ({
|
const SpecialResultPanel = ({
|
||||||
showRetryDetail,
|
showRetryDetail,
|
||||||
@ -30,8 +31,9 @@ const SpecialResultPanel = ({
|
|||||||
iterationResultList,
|
iterationResultList,
|
||||||
iterationResultDurationMap,
|
iterationResultDurationMap,
|
||||||
|
|
||||||
agentResultList,
|
agentOrToolLogItemStack,
|
||||||
setAgentResultList,
|
agentOrToolLogListMap,
|
||||||
|
handleShowAgentOrToolLog,
|
||||||
}: SpecialResultPanelProps) => {
|
}: SpecialResultPanelProps) => {
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
@ -53,10 +55,11 @@ const SpecialResultPanel = ({
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
!!agentResultList?.length && setAgentResultList && (
|
!!agentOrToolLogItemStack?.length && agentOrToolLogListMap && handleShowAgentOrToolLog && (
|
||||||
<AgentResultPanel
|
<AgentResultPanel
|
||||||
list={agentResultList}
|
agentOrToolLogItemStack={agentOrToolLogItemStack}
|
||||||
setAgentResultList={setAgentResultList}
|
agentOrToolLogListMap={agentOrToolLogListMap}
|
||||||
|
onShowAgentOrToolLog={handleShowAgentOrToolLog}
|
||||||
/>
|
/>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
@ -79,8 +79,9 @@ const TracingPanel: FC<TracingPanelProps> = ({
|
|||||||
iterationResultDurationMap,
|
iterationResultDurationMap,
|
||||||
handleShowIterationResultList,
|
handleShowIterationResultList,
|
||||||
|
|
||||||
agentResultList,
|
agentOrToolLogItemStack,
|
||||||
setAgentResultList,
|
agentOrToolLogListMap,
|
||||||
|
handleShowAgentOrToolLog,
|
||||||
} = useLogs()
|
} = useLogs()
|
||||||
|
|
||||||
const renderNode = (node: NodeTracing) => {
|
const renderNode = (node: NodeTracing) => {
|
||||||
@ -136,7 +137,7 @@ const TracingPanel: FC<TracingPanelProps> = ({
|
|||||||
nodeInfo={node!}
|
nodeInfo={node!}
|
||||||
onShowIterationDetail={handleShowIterationResultList}
|
onShowIterationDetail={handleShowIterationResultList}
|
||||||
onShowRetryDetail={handleShowRetryResultList}
|
onShowRetryDetail={handleShowRetryResultList}
|
||||||
onShowAgentResultList={setAgentResultList}
|
onShowAgentOrToolLog={handleShowAgentOrToolLog}
|
||||||
hideInfo={hideNodeInfo}
|
hideInfo={hideNodeInfo}
|
||||||
hideProcessDetail={hideNodeProcessDetail}
|
hideProcessDetail={hideNodeProcessDetail}
|
||||||
/>
|
/>
|
||||||
@ -157,8 +158,9 @@ const TracingPanel: FC<TracingPanelProps> = ({
|
|||||||
iterationResultList={iterationResultList}
|
iterationResultList={iterationResultList}
|
||||||
iterationResultDurationMap={iterationResultDurationMap}
|
iterationResultDurationMap={iterationResultDurationMap}
|
||||||
|
|
||||||
agentResultList={agentResultList}
|
agentOrToolLogItemStack={agentOrToolLogItemStack}
|
||||||
setAgentResultList={setAgentResultList}
|
agentOrToolLogListMap={agentOrToolLogListMap}
|
||||||
|
handleShowAgentOrToolLog={handleShowAgentOrToolLog}
|
||||||
/>
|
/>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
@ -3,9 +3,10 @@ import formatIterationNode from './iteration'
|
|||||||
import formatParallelNode from './parallel'
|
import formatParallelNode from './parallel'
|
||||||
import formatRetryNode from './retry'
|
import formatRetryNode from './retry'
|
||||||
import formatAgentNode from './agent'
|
import formatAgentNode from './agent'
|
||||||
|
import { cloneDeep } from 'lodash-es'
|
||||||
|
|
||||||
const formatToTracingNodeList = (list: NodeTracing[], t: any) => {
|
const formatToTracingNodeList = (list: NodeTracing[], t: any) => {
|
||||||
const allItems = [...list].sort((a, b) => a.index - b.index)
|
const allItems = cloneDeep([...list]).sort((a, b) => a.index - b.index)
|
||||||
/*
|
/*
|
||||||
* First handle not change list structure node
|
* First handle not change list structure node
|
||||||
* Because Handle struct node will put the node in different
|
* Because Handle struct node will put the node in different
|
||||||
|
@ -69,8 +69,10 @@ function addTitle({
|
|||||||
}
|
}
|
||||||
|
|
||||||
// list => group by parallel_id(parallel tree).
|
// list => group by parallel_id(parallel tree).
|
||||||
const format = (list: NodeTracing[], t: any): NodeTracing[] => {
|
const format = (list: NodeTracing[], t: any, isPrint?: boolean): NodeTracing[] => {
|
||||||
// console.log(list)
|
if (isPrint)
|
||||||
|
console.log(list)
|
||||||
|
|
||||||
const result: NodeTracing[] = [...list]
|
const result: NodeTracing[] = [...list]
|
||||||
const parallelFirstNodeMap: Record<string, string> = {}
|
const parallelFirstNodeMap: Record<string, string> = {}
|
||||||
// list to tree by parent_parallel_start_node_id and branch by parallel_start_node_id. Each parallel may has more than one branch.
|
// list to tree by parent_parallel_start_node_id and branch by parallel_start_node_id. Each parallel may has more than one branch.
|
||||||
@ -119,6 +121,7 @@ const format = (list: NodeTracing[], t: any): NodeTracing[] => {
|
|||||||
|
|
||||||
// append to parallel start node and after the same branch
|
// append to parallel start node and after the same branch
|
||||||
const parallelStartNode = result.find(item => item.node_id === parallelFirstNodeMap[parallel_id])
|
const parallelStartNode = result.find(item => item.node_id === parallelFirstNodeMap[parallel_id])
|
||||||
|
|
||||||
if (parallelStartNode && parallelStartNode.parallelDetail && parallelStartNode!.parallelDetail!.children) {
|
if (parallelStartNode && parallelStartNode.parallelDetail && parallelStartNode!.parallelDetail!.children) {
|
||||||
const sameBranchNodesLastIndex = parallelStartNode.parallelDetail.children.findLastIndex((node) => {
|
const sameBranchNodesLastIndex = parallelStartNode.parallelDetail.children.findLastIndex((node) => {
|
||||||
const currStartNodeId = node.parallel_start_node_id ?? node.execution_metadata?.parallel_start_node_id ?? null
|
const currStartNodeId = node.parallel_start_node_id ?? node.execution_metadata?.parallel_start_node_id ?? null
|
||||||
@ -153,12 +156,14 @@ const format = (list: NodeTracing[], t: any): NodeTracing[] => {
|
|||||||
})
|
})
|
||||||
|
|
||||||
// print node structure for debug
|
// print node structure for debug
|
||||||
// filteredInParallelSubNodes.forEach((node) => {
|
if (isPrint) {
|
||||||
// const now = Date.now()
|
filteredInParallelSubNodes.forEach((node) => {
|
||||||
// console.log(`----- p: ${now} start -----`)
|
const now = Date.now()
|
||||||
// printNodeStructure(node, 0)
|
console.log(`----- p: ${now} start -----`)
|
||||||
// console.log(`----- p: ${now} end -----`)
|
printNodeStructure(node, 0)
|
||||||
// })
|
console.log(`----- p: ${now} end -----`)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
addTitle({
|
addTitle({
|
||||||
list: filteredInParallelSubNodes,
|
list: filteredInParallelSubNodes,
|
||||||
|
Loading…
Reference in New Issue
Block a user