update styling and iteration log

This commit is contained in:
Yi 2024-09-03 11:46:04 +08:00
parent b28c7b1cda
commit 3431b19f9a
2 changed files with 15 additions and 18 deletions

View File

@ -255,7 +255,7 @@ export const useWorkflowRun = () => {
setWorkflowRunningData(produce(workflowRunningData!, (draft) => { setWorkflowRunningData(produce(workflowRunningData!, (draft) => {
const tracing = draft.tracing! const tracing = draft.tracing!
const iterations = tracing[tracing.length - 1] const iterations = tracing[tracing.length - 1]
const currIteration = iterations.details![iterations.details!.length - 1] const currIteration = [iterations.details![iterations.details!.length - 1]]
currIteration.push({ currIteration.push({
...data, ...data,
status: NodeRunningStatus.Running, status: NodeRunningStatus.Running,
@ -320,10 +320,6 @@ export const useWorkflowRun = () => {
if (iterations && iterations.details) { if (iterations && iterations.details) {
const iterationIndex = data.execution_metadata?.iteration_index || 0 const iterationIndex = data.execution_metadata?.iteration_index || 0
// console.log(`the current iteration index is ${iterationIndex}`)
// console.log(JSON.parse(JSON.stringify(iterations.details)))
if (!iterations.details[iterationIndex]) if (!iterations.details[iterationIndex])
iterations.details[iterationIndex] = [] iterations.details[iterationIndex] = []
@ -331,17 +327,18 @@ export const useWorkflowRun = () => {
const nodeIndex = currIteration.findIndex(node => const nodeIndex = currIteration.findIndex(node =>
node.node_id === data.node_id, node.node_id === data.node_id,
) )
if (data.status === NodeRunningStatus.Succeeded) {
if (nodeIndex !== -1) { if (nodeIndex !== -1) {
currIteration[nodeIndex] = { currIteration[nodeIndex] = {
...(currIteration[nodeIndex].extras ? { extras: currIteration[nodeIndex].extras } : {}), ...currIteration[nodeIndex],
...data, ...data,
} as any } as any
} }
else { else {
currIteration.push({ currIteration.push({
...data, ...data,
} as any) } as any)
}
} }
} }
})) }))

View File

@ -99,13 +99,13 @@ const NodePanel: FC<Props> = ({
hideInfo && '!text-xs', hideInfo && '!text-xs',
)} title={nodeInfo.title}>{nodeInfo.title}</div> )} title={nodeInfo.title}>{nodeInfo.title}</div>
{nodeInfo.status !== 'running' && !hideInfo && ( {nodeInfo.status !== 'running' && !hideInfo && (
<div className='shrink-0 text-gray-500 text-xs leading-[18px]'>{`${getTime(nodeInfo.elapsed_time || 0)} · ${getTokenCount(nodeInfo.execution_metadata?.total_tokens || 0)} tokens`}</div> <div className='shrink-0 text-text-tertiary system-xs-regular'>{nodeInfo.execution_metadata?.total_tokens ? `${getTokenCount(nodeInfo.execution_metadata?.total_tokens || 0)} tokens · ` : ''}{`${getTime(nodeInfo.elapsed_time || 0)}`}</div>
)} )}
{nodeInfo.status === 'succeeded' && ( {nodeInfo.status === 'succeeded' && (
<RiCheckboxCircleFill className='shrink-0 ml-2 w-3.5 h-3.5 text-text-success' /> <RiCheckboxCircleFill className='shrink-0 ml-2 w-3.5 h-3.5 text-text-success' />
)} )}
{nodeInfo.status === 'failed' && ( {nodeInfo.status === 'failed' && (
<RiErrorWarningLine className='shrink-0 ml-2 w-3.5 h-3.5 text-[#F04438]' /> <RiErrorWarningLine className='shrink-0 ml-2 w-3.5 h-3.5 text-text-warning' />
)} )}
{nodeInfo.status === 'stopped' && ( {nodeInfo.status === 'stopped' && (
<AlertTriangle className='shrink-0 ml-2 w-3.5 h-3.5 text-[#F79009]' /> <AlertTriangle className='shrink-0 ml-2 w-3.5 h-3.5 text-[#F79009]' />