chore: not use step_boundary field (#7231)
This commit is contained in:
@@ -63,30 +63,25 @@ const RunPanel: FC<RunProps> = ({ hideResult, activeTab = 'RESULT', runID, getRe
|
|||||||
const formatNodeList = useCallback((list: NodeTracing[]) => {
|
const formatNodeList = useCallback((list: NodeTracing[]) => {
|
||||||
const allItems = list.reverse()
|
const allItems = list.reverse()
|
||||||
const result: NodeTracing[] = []
|
const result: NodeTracing[] = []
|
||||||
let iterationIndexInfos: {
|
let iterationIndex = 0
|
||||||
start: number
|
|
||||||
end: number
|
|
||||||
}[] = []
|
|
||||||
allItems.forEach((item) => {
|
allItems.forEach((item) => {
|
||||||
const { node_type, index, execution_metadata } = item
|
const { node_type, execution_metadata } = item
|
||||||
if (node_type !== BlockEnum.Iteration) {
|
if (node_type !== BlockEnum.Iteration) {
|
||||||
let isInIteration = false
|
const isInIteration = !!execution_metadata?.iteration_id
|
||||||
let isIterationFirstNode = false
|
|
||||||
iterationIndexInfos.forEach(({ start, end }) => {
|
|
||||||
if (index >= start && index < end) {
|
|
||||||
if (index === start)
|
|
||||||
isIterationFirstNode = true
|
|
||||||
|
|
||||||
isInIteration = true
|
|
||||||
}
|
|
||||||
})
|
|
||||||
if (isInIteration) {
|
if (isInIteration) {
|
||||||
const iterationDetails = result[result.length - 1].details!
|
const iterationDetails = result[result.length - 1].details!
|
||||||
if (isIterationFirstNode)
|
const currentIterationIndex = execution_metadata?.iteration_index
|
||||||
iterationDetails!.push([item])
|
const isIterationFirstNode = iterationIndex !== currentIterationIndex || iterationDetails.length === 0
|
||||||
|
|
||||||
else
|
if (isIterationFirstNode) {
|
||||||
|
iterationDetails!.push([item])
|
||||||
|
iterationIndex = currentIterationIndex!
|
||||||
|
}
|
||||||
|
|
||||||
|
else {
|
||||||
iterationDetails[iterationDetails.length - 1].push(item)
|
iterationDetails[iterationDetails.length - 1].push(item)
|
||||||
|
}
|
||||||
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@@ -96,26 +91,6 @@ const RunPanel: FC<RunProps> = ({ hideResult, activeTab = 'RESULT', runID, getRe
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
const { steps_boundary } = execution_metadata
|
|
||||||
iterationIndexInfos = []
|
|
||||||
steps_boundary.forEach((boundary, index) => {
|
|
||||||
if (index === 0) {
|
|
||||||
iterationIndexInfos.push({
|
|
||||||
start: boundary,
|
|
||||||
end: 0,
|
|
||||||
})
|
|
||||||
}
|
|
||||||
else if (index === steps_boundary.length - 1) {
|
|
||||||
iterationIndexInfos[iterationIndexInfos.length - 1].end = boundary
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
iterationIndexInfos[iterationIndexInfos.length - 1].end = boundary
|
|
||||||
iterationIndexInfos.push({
|
|
||||||
start: boundary,
|
|
||||||
end: 0,
|
|
||||||
})
|
|
||||||
}
|
|
||||||
})
|
|
||||||
result.push({
|
result.push({
|
||||||
...item,
|
...item,
|
||||||
details: [],
|
details: [],
|
||||||
|
@@ -123,7 +123,7 @@ const NodePanel: FC<Props> = ({
|
|||||||
<div
|
<div
|
||||||
className='flex items-center h-[34px] justify-between px-3 bg-gray-100 border-[0.5px] border-gray-200 rounded-lg cursor-pointer'
|
className='flex items-center h-[34px] justify-between px-3 bg-gray-100 border-[0.5px] border-gray-200 rounded-lg cursor-pointer'
|
||||||
onClick={handleOnShowIterationDetail}>
|
onClick={handleOnShowIterationDetail}>
|
||||||
<div className='leading-[18px] text-[13px] font-medium text-gray-700'>{t('workflow.nodes.iteration.iteration', { count: nodeInfo.metadata?.iterator_length || (nodeInfo.execution_metadata?.steps_boundary?.length - 1) })}</div>
|
<div className='leading-[18px] text-[13px] font-medium text-gray-700'>{t('workflow.nodes.iteration.iteration', { count: nodeInfo.metadata?.iterator_length })}</div>
|
||||||
{justShowIterationNavArrow
|
{justShowIterationNavArrow
|
||||||
? (
|
? (
|
||||||
<RiArrowRightSLine className='w-3.5 h-3.5 text-gray-500' />
|
<RiArrowRightSLine className='w-3.5 h-3.5 text-gray-500' />
|
||||||
|
@@ -24,7 +24,8 @@ export type NodeTracing = {
|
|||||||
total_tokens: number
|
total_tokens: number
|
||||||
total_price: number
|
total_price: number
|
||||||
currency: string
|
currency: string
|
||||||
steps_boundary: number[]
|
iteration_id?: string
|
||||||
|
iteration_index?: number
|
||||||
}
|
}
|
||||||
metadata: {
|
metadata: {
|
||||||
iterator_length: number
|
iterator_length: number
|
||||||
|
Reference in New Issue
Block a user