mirror of
https://github.com/langgenius/dify.git
synced 2026-05-04 08:26:27 +08:00
Merge branch 'feat/plugins' of https://github.com/langgenius/dify into feat/plugins
This commit is contained in:
commit
c867584049
@ -2,8 +2,9 @@ import format from '.'
|
|||||||
import { simpleIterationData } from './data'
|
import { simpleIterationData } from './data'
|
||||||
|
|
||||||
describe('format api data to tracing panel data', () => {
|
describe('format api data to tracing panel data', () => {
|
||||||
// test('result should have no nodes in iteration node', () => {
|
test('result should have no nodes in iteration node', () => {
|
||||||
// }
|
expect(format(simpleIterationData.in as any).find(item => !!(item as any).execution_metadata?.iteration_id)).toBeUndefined()
|
||||||
|
})
|
||||||
test('iteration should put nodes in details', () => {
|
test('iteration should put nodes in details', () => {
|
||||||
expect(format(simpleIterationData.in as any)).toEqual(simpleIterationData.output)
|
expect(format(simpleIterationData.in as any)).toEqual(simpleIterationData.output)
|
||||||
})
|
})
|
||||||
|
|||||||
@ -31,6 +31,11 @@ const format = (list: NodeTracing[]): NodeTracing[] => {
|
|||||||
.map((item) => {
|
.map((item) => {
|
||||||
if (item.node_type === BlockEnum.Iteration) {
|
if (item.node_type === BlockEnum.Iteration) {
|
||||||
const childrenNodes = list.filter(child => child.execution_metadata?.iteration_id === item.node_id)
|
const childrenNodes = list.filter(child => child.execution_metadata?.iteration_id === item.node_id)
|
||||||
|
const error = childrenNodes.find(child => child.status === 'failed')
|
||||||
|
if (error) {
|
||||||
|
item.status = 'failed'
|
||||||
|
item.error = error.error
|
||||||
|
}
|
||||||
return addChildrenToIterationNode(item, childrenNodes)
|
return addChildrenToIterationNode(item, childrenNodes)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -0,0 +1,7 @@
|
|||||||
|
import type { NodeTracing } from '@/types/workflow'
|
||||||
|
|
||||||
|
const format = (list: NodeTracing[]): NodeTracing[] => {
|
||||||
|
return list
|
||||||
|
}
|
||||||
|
|
||||||
|
export default format
|
||||||
Loading…
Reference in New Issue
Block a user