refact workflow run log
parent
b56acb825f
commit
26901b2c87
@ -0,0 +1,29 @@
|
|||||||
|
import { RiArrowRightLine } from '@remixicon/react'
|
||||||
|
|
||||||
|
type AgentLogTriggerProps = {
|
||||||
|
onDetail?: () => void
|
||||||
|
}
|
||||||
|
const AgentLogTrigger = ({
|
||||||
|
onDetail,
|
||||||
|
}: AgentLogTriggerProps) => {
|
||||||
|
return (
|
||||||
|
<div className='bg-components-button-tertiary-bg rounded-[10px]'>
|
||||||
|
<div className='flex items-center px-3 pt-2 system-2xs-medium-uppercase text-text-tertiary'>
|
||||||
|
Agent strategy
|
||||||
|
</div>
|
||||||
|
<div className='flex items-center pl-3 pt-1 pr-2 pb-1.5'>
|
||||||
|
<div className='shrink-0 w-5 h-5'></div>
|
||||||
|
<div className='grow mx-0.5 px-1 system-xs-medium text-text-secondary'></div>
|
||||||
|
<div
|
||||||
|
className='shrink-0 flex items-center px-[1px] system-xs-regular-uppercase text-text-tertiary cursor-pointer'
|
||||||
|
onClick={onDetail}
|
||||||
|
>
|
||||||
|
Detail
|
||||||
|
<RiArrowRightLine className='ml-0.5 w-3.5 h-3.5' />
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
export default AgentLogTrigger
|
||||||
@ -0,0 +1,43 @@
|
|||||||
|
import Button from '@/app/components/base/button'
|
||||||
|
import { RiArrowLeftLine } from '@remixicon/react'
|
||||||
|
import TracingPanel from '../tracing-panel'
|
||||||
|
|
||||||
|
type AgentResultPanelProps = {
|
||||||
|
onBack: () => void
|
||||||
|
}
|
||||||
|
const AgentResultPanel = ({
|
||||||
|
onBack,
|
||||||
|
}: AgentResultPanelProps) => {
|
||||||
|
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'>
|
||||||
|
Agent strategy
|
||||||
|
</div>
|
||||||
|
<Button
|
||||||
|
className='px-[5px]'
|
||||||
|
size='small'
|
||||||
|
variant='ghost-accent'
|
||||||
|
onClick={onBack}
|
||||||
|
>
|
||||||
|
close
|
||||||
|
</Button>
|
||||||
|
</div>
|
||||||
|
<TracingPanel
|
||||||
|
list={[]}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
export default AgentResultPanel
|
||||||
@ -0,0 +1,45 @@
|
|||||||
|
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
|
||||||
@ -0,0 +1,48 @@
|
|||||||
|
import {
|
||||||
|
useCallback,
|
||||||
|
useState,
|
||||||
|
} from 'react'
|
||||||
|
import { useBoolean } from 'ahooks'
|
||||||
|
import type { IterationDurationMap, NodeTracing } from '@/types/workflow'
|
||||||
|
|
||||||
|
export const useLogs = () => {
|
||||||
|
const [showRetryDetail, {
|
||||||
|
setTrue: setShowRetryDetailTrue,
|
||||||
|
setFalse: setShowRetryDetailFalse,
|
||||||
|
}] = useBoolean(false)
|
||||||
|
const [retryResultList, setRetryResultList] = useState<NodeTracing[]>([])
|
||||||
|
const handleShowRetryResultList = useCallback((detail: NodeTracing[]) => {
|
||||||
|
setShowRetryDetailTrue()
|
||||||
|
setRetryResultList(detail)
|
||||||
|
}, [setShowRetryDetailTrue, setRetryResultList])
|
||||||
|
|
||||||
|
const [showIteratingDetail, {
|
||||||
|
setTrue: setShowIteratingDetailTrue,
|
||||||
|
setFalse: setShowIteratingDetailFalse,
|
||||||
|
}] = useBoolean(false)
|
||||||
|
const [iterationResultList, setIterationResultList] = useState<NodeTracing[][]>([])
|
||||||
|
const [iterationResultDurationMap, setIterationResultDurationMap] = useState<IterationDurationMap>({})
|
||||||
|
const handleShowIterationResultList = useCallback((detail: NodeTracing[][], iterDurationMap: IterationDurationMap) => {
|
||||||
|
setShowIteratingDetailTrue()
|
||||||
|
setIterationResultList(detail)
|
||||||
|
setIterationResultDurationMap(iterDurationMap)
|
||||||
|
}, [setShowIteratingDetailTrue, setIterationResultList, setIterationResultDurationMap])
|
||||||
|
|
||||||
|
return {
|
||||||
|
showSpecialResultPanel: !showRetryDetail && !showIteratingDetail,
|
||||||
|
showRetryDetail,
|
||||||
|
setShowRetryDetailTrue,
|
||||||
|
setShowRetryDetailFalse,
|
||||||
|
retryResultList,
|
||||||
|
setRetryResultList,
|
||||||
|
handleShowRetryResultList,
|
||||||
|
showIteratingDetail,
|
||||||
|
setShowIteratingDetailTrue,
|
||||||
|
setShowIteratingDetailFalse,
|
||||||
|
iterationResultList,
|
||||||
|
setIterationResultList,
|
||||||
|
iterationResultDurationMap,
|
||||||
|
setIterationResultDurationMap,
|
||||||
|
handleShowIterationResultList,
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,49 @@
|
|||||||
|
import RetryResultPanel from './retry-result-panel'
|
||||||
|
import IterationResultPanel from './iteration-result-panel'
|
||||||
|
import type { IterationDurationMap, NodeTracing } from '@/types/workflow'
|
||||||
|
|
||||||
|
type SpecialResultPanelProps = {
|
||||||
|
showRetryDetail: boolean
|
||||||
|
setShowRetryDetailFalse: () => void
|
||||||
|
retryResultList: NodeTracing[]
|
||||||
|
|
||||||
|
showIteratingDetail: boolean
|
||||||
|
setShowIteratingDetailFalse: () => void
|
||||||
|
iterationResultList: NodeTracing[][]
|
||||||
|
iterationResultDurationMap: IterationDurationMap
|
||||||
|
}
|
||||||
|
const SpecialResultPanel = ({
|
||||||
|
showRetryDetail,
|
||||||
|
setShowRetryDetailFalse,
|
||||||
|
retryResultList,
|
||||||
|
|
||||||
|
showIteratingDetail,
|
||||||
|
setShowIteratingDetailFalse,
|
||||||
|
iterationResultList,
|
||||||
|
iterationResultDurationMap,
|
||||||
|
}: SpecialResultPanelProps) => {
|
||||||
|
return (
|
||||||
|
<>
|
||||||
|
{
|
||||||
|
showRetryDetail && (
|
||||||
|
<RetryResultPanel
|
||||||
|
list={retryResultList}
|
||||||
|
onBack={setShowRetryDetailFalse}
|
||||||
|
/>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
{
|
||||||
|
showIteratingDetail && (
|
||||||
|
<IterationResultPanel
|
||||||
|
list={iterationResultList}
|
||||||
|
onHide={setShowIteratingDetailFalse}
|
||||||
|
onBack={setShowIteratingDetailFalse}
|
||||||
|
iterDurationMap={iterationResultDurationMap}
|
||||||
|
/>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
</>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
export default SpecialResultPanel
|
||||||
Loading…
Reference in New Issue