feat: Add support for AI log streaming (#8526)

Co-authored-by: Oleg Ivaniv <me@olegivaniv.com>
This commit is contained in:
Omar Ajoue
2024-02-09 09:41:01 +00:00
committed by GitHub
parent ccc0ad5009
commit 7501ad8f3c
12 changed files with 259 additions and 38 deletions

View File

@@ -23,6 +23,7 @@ import type {
WorkflowExecuteMode,
ExecutionStatus,
ExecutionError,
EventNamesAiNodesType,
} from 'n8n-workflow';
import {
ApplicationError,
@@ -68,6 +69,7 @@ import { WorkflowStaticDataService } from './workflows/workflowStaticData.servic
import { WorkflowRepository } from './databases/repositories/workflow.repository';
import { UrlService } from './services/url.service';
import { WorkflowExecutionService } from './workflows/workflowExecution.service';
import { MessageEventBus } from '@/eventbus/MessageEventBus/MessageEventBus';
const ERROR_TRIGGER_TYPE = config.getEnv('nodes.errorTriggerType');
@@ -982,6 +984,22 @@ export async function getBase(
setExecutionStatus,
variables,
secretsHelpers: Container.get(SecretsHelper),
logAiEvent: async (
eventName: EventNamesAiNodesType,
payload: {
msg?: string | undefined;
executionId: string;
nodeName: string;
workflowId?: string | undefined;
workflowName: string;
nodeType?: string | undefined;
},
) => {
return await Container.get(MessageEventBus).sendAiNodeEvent({
eventName,
payload,
});
},
};
}