refact workflow run log
parent
1429b30e84
commit
7e94056507
@ -0,0 +1,43 @@
|
|||||||
|
import {
|
||||||
|
RiAlertFill,
|
||||||
|
RiCheckboxCircleFill,
|
||||||
|
RiErrorWarningLine,
|
||||||
|
RiLoader2Line,
|
||||||
|
} from '@remixicon/react'
|
||||||
|
import cn from '@/utils/classnames'
|
||||||
|
|
||||||
|
type NodeStatusIconProps = {
|
||||||
|
status: string
|
||||||
|
className?: string
|
||||||
|
}
|
||||||
|
const NodeStatusIcon = ({
|
||||||
|
status,
|
||||||
|
className,
|
||||||
|
}: NodeStatusIconProps) => {
|
||||||
|
return (
|
||||||
|
<>
|
||||||
|
{
|
||||||
|
status === 'succeeded' && (
|
||||||
|
<RiCheckboxCircleFill className={cn('shrink-0 w-4 h-4 text-text-success', className)} />
|
||||||
|
)
|
||||||
|
}
|
||||||
|
{
|
||||||
|
status === 'failed' && (
|
||||||
|
<RiErrorWarningLine className={cn('shrink-0 w-4 h-4 text-text-warning', className)} />
|
||||||
|
)
|
||||||
|
}
|
||||||
|
{
|
||||||
|
(status === 'stopped' || status === 'exception') && (
|
||||||
|
<RiAlertFill className={cn('shrink-0 w-4 h-4 text-text-warning-secondary', className)} />
|
||||||
|
)
|
||||||
|
}
|
||||||
|
{
|
||||||
|
status === 'running' && (
|
||||||
|
<RiLoader2Line className={cn('shrink-0 w-4 h-4 text-text-accent animate-spin', className)} />
|
||||||
|
)
|
||||||
|
}
|
||||||
|
</>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
export default NodeStatusIcon
|
||||||
@ -0,0 +1,84 @@
|
|||||||
|
import { useState } from 'react'
|
||||||
|
import {
|
||||||
|
RiArrowRightSLine,
|
||||||
|
RiListView,
|
||||||
|
} from '@remixicon/react'
|
||||||
|
import cn from '@/utils/classnames'
|
||||||
|
import Button from '@/app/components/base/button'
|
||||||
|
import type { AgentLogItemWithChildren } from '@/types/workflow'
|
||||||
|
import NodeStatusIcon from '@/app/components/workflow/nodes/_base/components/node-status-icon'
|
||||||
|
import CodeEditor from '@/app/components/workflow/nodes/_base/components/editor/code-editor'
|
||||||
|
import { CodeLanguage } from '@/app/components/workflow/nodes/code/types'
|
||||||
|
|
||||||
|
type AgentLogItemProps = {
|
||||||
|
item: AgentLogItemWithChildren
|
||||||
|
}
|
||||||
|
const AgentLogItem = ({
|
||||||
|
item,
|
||||||
|
}: AgentLogItemProps) => {
|
||||||
|
const {
|
||||||
|
label,
|
||||||
|
status,
|
||||||
|
children,
|
||||||
|
data,
|
||||||
|
} = item
|
||||||
|
const [expanded, setExpanded] = useState(false)
|
||||||
|
|
||||||
|
return (
|
||||||
|
<div className='border-[0.5px] border-components-panel-border rounded-[10px]'>
|
||||||
|
<div
|
||||||
|
className={cn(
|
||||||
|
'flex items-center pl-1.5 pt-2 pr-3 pb-2',
|
||||||
|
expanded && 'pb-1',
|
||||||
|
)}
|
||||||
|
onClick={() => setExpanded(!expanded)}
|
||||||
|
>
|
||||||
|
{
|
||||||
|
expanded
|
||||||
|
? <RiArrowRightSLine className='shrink-0 w-4 h-4 rotate-90' />
|
||||||
|
: <RiArrowRightSLine className='shrink-0 w-4 h-4' />
|
||||||
|
}
|
||||||
|
<div className='shrink-0 mr-1.5 w-5 h-5'></div>
|
||||||
|
<div className='grow system-sm-semibold-uppercase text-text-secondary truncate'>{label}</div>
|
||||||
|
<div className='shrink-0 mr-2 system-xs-regular text-text-tertiary'>0.02s</div>
|
||||||
|
<NodeStatusIcon status={status} />
|
||||||
|
</div>
|
||||||
|
{
|
||||||
|
expanded && (
|
||||||
|
<div className='p-1 pt-0'>
|
||||||
|
{
|
||||||
|
!!children.length && (
|
||||||
|
<Button
|
||||||
|
className='flex items-center justify-between mb-1 w-full'
|
||||||
|
variant='tertiary'
|
||||||
|
onClick={() => {}}
|
||||||
|
>
|
||||||
|
<div className='flex items-center'>
|
||||||
|
<RiListView className='mr-1 w-4 h-4 text-components-button-tertiary-text shrink-0' />
|
||||||
|
{`${children.length} Action Logs`}
|
||||||
|
</div>
|
||||||
|
<div className='flex'>
|
||||||
|
<RiArrowRightSLine className='w-4 h-4 text-components-button-tertiary-text shrink-0' />
|
||||||
|
</div>
|
||||||
|
</Button>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
{
|
||||||
|
data && (
|
||||||
|
<CodeEditor
|
||||||
|
readOnly
|
||||||
|
title={<div>{'data'.toLocaleUpperCase()}</div>}
|
||||||
|
language={CodeLanguage.json}
|
||||||
|
value={data}
|
||||||
|
isJSONStringifyBeauty
|
||||||
|
/>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
</div>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
</div>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
export default AgentLogItem
|
||||||
@ -1,45 +0,0 @@
|
|||||||
import Button from '@/app/components/base/button'
|
|
||||||
import { RiArrowLeftLine } from '@remixicon/react'
|
|
||||||
import TracingPanel from '../tracing-panel'
|
|
||||||
|
|
||||||
type ToolCallResultPanelProps = {
|
|
||||||
onBack: () => void
|
|
||||||
onClose: () => void
|
|
||||||
}
|
|
||||||
const ToolCallResultPanel = ({
|
|
||||||
onBack,
|
|
||||||
onClose,
|
|
||||||
}: ToolCallResultPanelProps) => {
|
|
||||||
return (
|
|
||||||
<div className='overflow-y-auto'>
|
|
||||||
<div className='flex items-center p-1 pr-3 h-8'>
|
|
||||||
<Button
|
|
||||||
className='shrink-0 px-[5px]'
|
|
||||||
size='small'
|
|
||||||
variant='ghost-accent'
|
|
||||||
onClick={onBack}
|
|
||||||
>
|
|
||||||
<RiArrowLeftLine className='mr-1 w-3.5 h-3.5' />
|
|
||||||
Back
|
|
||||||
</Button>
|
|
||||||
<div className='shrink-0 mx-0.5 system-xs-regular text-divider-deep'>/</div>
|
|
||||||
<div className='grow px-[5px] system-xs-medium-uppercase'>
|
|
||||||
10 Logs
|
|
||||||
</div>
|
|
||||||
<Button
|
|
||||||
className='px-[5px]'
|
|
||||||
size='small'
|
|
||||||
variant='ghost-accent'
|
|
||||||
onClick={onClose}
|
|
||||||
>
|
|
||||||
close
|
|
||||||
</Button>
|
|
||||||
</div>
|
|
||||||
<TracingPanel
|
|
||||||
list={[]}
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
export default ToolCallResultPanel
|
|
||||||
Loading…
Reference in New Issue