refactor(core): Persist node execution order, and forward it to the frontend (#14455)

This commit is contained in:
कारतोफ्फेलस्क्रिप्ट™
2025-04-09 10:19:58 +02:00
committed by GitHub
parent 707ecb63ae
commit 9ba58ca80b
41 changed files with 235 additions and 113 deletions

View File

@@ -256,6 +256,7 @@ describe('CanvasChat', () => {
],
],
},
executionIndex: 0,
executionStatus: 'success',
executionTime: 0,
source: [null],

View File

@@ -71,7 +71,8 @@ export const aiChatExecutionResponse: IExecutionResponse = {
'AI Agent': [
{
executionStatus: 'success',
startTime: +new Date('2025-03-26T00:00:00.002Z'),
startTime: Date.parse('2025-03-26T00:00:00.002Z'),
executionIndex: 0,
executionTime: 1778,
source: [],
data: {},
@@ -80,7 +81,8 @@ export const aiChatExecutionResponse: IExecutionResponse = {
'AI Model': [
{
executionStatus: 'error',
startTime: +new Date('2025-03-26T00:00:00.003Z'),
startTime: Date.parse('2025-03-26T00:00:00.003Z'),
executionIndex: 1,
executionTime: 1777,
source: [],
error: new WorkflowOperationError('Test error', aiModelNode, 'Test error description'),
@@ -121,7 +123,8 @@ export const aiManualExecutionResponse: IExecutionResponse = {
'AI Agent': [
{
executionStatus: 'success',
startTime: +new Date('2025-03-30T00:00:00.002Z'),
startTime: Date.parse('2025-03-30T00:00:00.002Z'),
executionIndex: 0,
executionTime: 12,
source: [],
data: {},
@@ -130,7 +133,8 @@ export const aiManualExecutionResponse: IExecutionResponse = {
'AI Model': [
{
executionStatus: 'success',
startTime: +new Date('2025-03-30T00:00:00.003Z'),
startTime: Date.parse('2025-03-30T00:00:00.003Z'),
executionIndex: 1,
executionTime: 3456,
source: [],
data: {

View File

@@ -130,8 +130,9 @@ export function useChatMessaging({
inputPayload.binary = binaryData;
}
const nodeData: ITaskData = {
startTime: new Date().getTime(),
startTime: Date.now(),
executionTime: 0,
executionIndex: 0,
executionStatus: 'success',
data: {
main: [[inputPayload]],

View File

@@ -128,6 +128,7 @@ describe('InputPanel', () => {
{
startTime: 0,
executionTime: 0,
executionIndex: 0,
source: [],
data: {},
},

View File

@@ -359,8 +359,9 @@ describe('RunData', () => {
const { getByTestId, queryByTestId } = render({
runs: [
{
startTime: new Date().getTime(),
executionTime: new Date().getTime(),
startTime: Date.now(),
executionIndex: 0,
executionTime: 1,
data: {
main: [[{ json: {} }]],
},
@@ -368,8 +369,9 @@ describe('RunData', () => {
metadata,
},
{
startTime: new Date().getTime(),
executionTime: new Date().getTime(),
startTime: Date.now(),
executionIndex: 1,
executionTime: 1,
data: {
main: [[{ json: {} }]],
},
@@ -413,6 +415,7 @@ describe('RunData', () => {
{
hints: [],
startTime: 1737643696893,
executionIndex: 0,
executionTime: 2,
source: [
{
@@ -598,8 +601,9 @@ describe('RunData', () => {
runs?: ITaskData[];
}) => {
const defaultRun: ITaskData = {
startTime: new Date().getTime(),
executionTime: new Date().getTime(),
startTime: Date.now(),
executionIndex: 0,
executionTime: 1,
data: {
main: [defaultRunItems ?? [{ json: {} }]],
},

View File

@@ -6,6 +6,7 @@ describe(getTreeNodeData, () => {
function createTaskData(partialData: Partial<ITaskData>): ITaskData {
return {
startTime: 0,
executionIndex: 0,
executionTime: 1,
source: [],
executionStatus: 'success',
@@ -29,10 +30,10 @@ describe(getTreeNodeData, () => {
},
});
const taskDataByNodeName: Record<string, ITaskData[]> = {
A: [createTaskData({ startTime: +new Date('2025-02-26T00:00:00.000Z') })],
A: [createTaskData({ startTime: Date.parse('2025-02-26T00:00:00.000Z') })],
B: [
createTaskData({
startTime: +new Date('2025-02-26T00:00:01.000Z'),
startTime: Date.parse('2025-02-26T00:00:01.000Z'),
data: {
main: [
[
@@ -50,7 +51,7 @@ describe(getTreeNodeData, () => {
},
}),
createTaskData({
startTime: +new Date('2025-02-26T00:00:03.000Z'),
startTime: Date.parse('2025-02-26T00:00:03.000Z'),
data: {
main: [
[
@@ -70,7 +71,7 @@ describe(getTreeNodeData, () => {
],
C: [
createTaskData({
startTime: +new Date('2025-02-26T00:00:02.000Z'),
startTime: Date.parse('2025-02-26T00:00:02.000Z'),
data: {
main: [
[
@@ -87,7 +88,7 @@ describe(getTreeNodeData, () => {
],
},
}),
createTaskData({ startTime: +new Date('2025-02-26T00:00:04.000Z') }),
createTaskData({ startTime: Date.parse('2025-02-26T00:00:04.000Z') }),
],
};
@@ -117,7 +118,7 @@ describe(getTreeNodeData, () => {
id: 'B',
node: 'B',
runIndex: 0,
startTime: +new Date('2025-02-26T00:00:01.000Z'),
startTime: Date.parse('2025-02-26T00:00:01.000Z'),
parent: expect.objectContaining({ node: 'A' }),
consumedTokens: {
completionTokens: 1,
@@ -132,7 +133,7 @@ describe(getTreeNodeData, () => {
id: 'C',
node: 'C',
runIndex: 0,
startTime: +new Date('2025-02-26T00:00:02.000Z'),
startTime: Date.parse('2025-02-26T00:00:02.000Z'),
parent: expect.objectContaining({ node: 'B' }),
consumedTokens: {
completionTokens: 7,
@@ -148,7 +149,7 @@ describe(getTreeNodeData, () => {
id: 'B',
node: 'B',
runIndex: 1,
startTime: +new Date('2025-02-26T00:00:03.000Z'),
startTime: Date.parse('2025-02-26T00:00:03.000Z'),
parent: expect.objectContaining({ node: 'A' }),
consumedTokens: {
completionTokens: 4,
@@ -163,7 +164,7 @@ describe(getTreeNodeData, () => {
id: 'C',
node: 'C',
runIndex: 1,
startTime: +new Date('2025-02-26T00:00:04.000Z'),
startTime: Date.parse('2025-02-26T00:00:04.000Z'),
parent: expect.objectContaining({ node: 'B' }),
consumedTokens: {
completionTokens: 0,

View File

@@ -68,8 +68,9 @@ async function createPiniaWithActiveNode() {
runData: {
[node.name]: [
{
startTime: new Date().getTime(),
executionTime: new Date().getTime(),
startTime: Date.now(),
executionIndex: 0,
executionTime: 1,
data: {
main: [
[
@@ -91,8 +92,9 @@ async function createPiniaWithActiveNode() {
source: [null],
},
{
startTime: new Date().getTime(),
executionTime: new Date().getTime(),
startTime: Date.now(),
executionIndex: 1,
executionTime: 1,
data: {
main: [
[