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

@@ -1,7 +1,7 @@
/* eslint-disable n8n-nodes-base/node-filename-against-convention */
/* eslint-disable n8n-nodes-base/node-dirname-against-convention */
import type { VectorStore } from 'langchain/vectorstores/base';
import { NodeConnectionType, NodeOperationError } from 'n8n-workflow';
import { NodeConnectionType, NodeOperationError, jsonStringify } from 'n8n-workflow';
import type {
INodeCredentialDescription,
INodeProperties,
@@ -237,6 +237,7 @@ export const createVectorStoreNode = (args: VectorStoreNodeConstructorArgs) =>
});
resultData.push(...serializedDocs);
void this.logAiEvent('n8n.ai.vector.store.searched', jsonStringify({ query: prompt }));
}
return await this.prepareOutputData(resultData);
@@ -262,6 +263,8 @@ export const createVectorStoreNode = (args: VectorStoreNodeConstructorArgs) =>
try {
await args.populateVectorStore(this, embeddings, processedDocuments, itemIndex);
void this.logAiEvent('n8n.ai.vector.store.populated');
} catch (error) {
throw error;
}