mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-17 01:56:46 +00:00
refactor(core): Fix type errors in workflow, core, nodes-langchain, and nodes-base (no-changelog) (#9450)
This commit is contained in:
committed by
GitHub
parent
d9616fc36f
commit
2bdc459bb2
@@ -46,7 +46,7 @@ function getInputs(
|
||||
[NodeConnectionType.AiOutputParser]: 'Output Parser',
|
||||
};
|
||||
|
||||
return inputs.map(({ type, filter, required }) => {
|
||||
return inputs.map(({ type, filter }) => {
|
||||
const input: INodeInputConfiguration = {
|
||||
type,
|
||||
displayName: type in displayNames ? displayNames[type] : undefined,
|
||||
@@ -370,13 +370,13 @@ export class Agent implements INodeType {
|
||||
if (agentType === 'conversationalAgent') {
|
||||
return await conversationalAgentExecute.call(this, nodeVersion);
|
||||
} else if (agentType === 'toolsAgent') {
|
||||
return await toolsAgentExecute.call(this, nodeVersion);
|
||||
return await toolsAgentExecute.call(this);
|
||||
} else if (agentType === 'openAiFunctionsAgent') {
|
||||
return await openAiFunctionsAgentExecute.call(this, nodeVersion);
|
||||
} else if (agentType === 'reActAgent') {
|
||||
return await reActAgentAgentExecute.call(this, nodeVersion);
|
||||
} else if (agentType === 'sqlAgent') {
|
||||
return await sqlAgentAgentExecute.call(this, nodeVersion);
|
||||
return await sqlAgentAgentExecute.call(this);
|
||||
} else if (agentType === 'planAndExecuteAgent') {
|
||||
return await planAndExecuteAgentExecute.call(this, nodeVersion);
|
||||
}
|
||||
|
||||
@@ -123,5 +123,5 @@ export async function conversationalAgentExecute(
|
||||
}
|
||||
}
|
||||
|
||||
return await this.prepareOutputData(returnData);
|
||||
return [returnData];
|
||||
}
|
||||
|
||||
@@ -125,5 +125,5 @@ export async function openAiFunctionsAgentExecute(
|
||||
}
|
||||
}
|
||||
|
||||
return await this.prepareOutputData(returnData);
|
||||
return [returnData];
|
||||
}
|
||||
|
||||
@@ -102,5 +102,5 @@ export async function planAndExecuteAgentExecute(
|
||||
}
|
||||
}
|
||||
|
||||
return await this.prepareOutputData(returnData);
|
||||
return [returnData];
|
||||
}
|
||||
|
||||
@@ -123,5 +123,5 @@ export async function reActAgentAgentExecute(
|
||||
}
|
||||
}
|
||||
|
||||
return await this.prepareOutputData(returnData);
|
||||
return [returnData];
|
||||
}
|
||||
|
||||
@@ -28,7 +28,6 @@ const parseTablesString = (tablesString: string) =>
|
||||
|
||||
export async function sqlAgentAgentExecute(
|
||||
this: IExecuteFunctions,
|
||||
nodeVersion: number,
|
||||
): Promise<INodeExecutionData[][]> {
|
||||
this.logger.verbose('Executing SQL Agent');
|
||||
|
||||
@@ -152,5 +151,5 @@ export async function sqlAgentAgentExecute(
|
||||
}
|
||||
}
|
||||
|
||||
return await this.prepareOutputData(returnData);
|
||||
return [returnData];
|
||||
}
|
||||
|
||||
@@ -39,10 +39,7 @@ function getOutputParserSchema(outputParser: BaseOutputParser): ZodObject<any, a
|
||||
return schema;
|
||||
}
|
||||
|
||||
export async function toolsAgentExecute(
|
||||
this: IExecuteFunctions,
|
||||
nodeVersion: number,
|
||||
): Promise<INodeExecutionData[][]> {
|
||||
export async function toolsAgentExecute(this: IExecuteFunctions): Promise<INodeExecutionData[][]> {
|
||||
this.logger.verbose('Executing Tools Agent');
|
||||
const model = await this.getInputConnectionData(NodeConnectionType.AiLanguageModel, 0);
|
||||
|
||||
@@ -185,5 +182,5 @@ export async function toolsAgentExecute(
|
||||
}
|
||||
}
|
||||
|
||||
return await this.prepareOutputData(returnData);
|
||||
return [returnData];
|
||||
}
|
||||
|
||||
@@ -392,6 +392,6 @@ export class OpenAiAssistant implements INodeType {
|
||||
}
|
||||
}
|
||||
|
||||
return await this.prepareOutputData(returnData);
|
||||
return [returnData];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -189,6 +189,6 @@ export class ChainRetrievalQa implements INodeType {
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
return await this.prepareOutputData(returnData);
|
||||
return [returnData];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -258,6 +258,6 @@ export class ChainSummarizationV1 implements INodeType {
|
||||
returnData.push({ json: { response } });
|
||||
}
|
||||
|
||||
return await this.prepareOutputData(returnData);
|
||||
return [returnData];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -425,6 +425,6 @@ export class ChainSummarizationV2 implements INodeType {
|
||||
}
|
||||
}
|
||||
|
||||
return await this.prepareOutputData(returnData);
|
||||
return [returnData];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -98,7 +98,7 @@ export class MemoryChatRetriever implements INodeType {
|
||||
const messages = await memory?.chatHistory.getMessages();
|
||||
|
||||
if (simplifyOutput && messages) {
|
||||
return await this.prepareOutputData(simplifyMessages(messages));
|
||||
return [simplifyMessages(messages)];
|
||||
}
|
||||
|
||||
const serializedMessages =
|
||||
@@ -107,6 +107,6 @@ export class MemoryChatRetriever implements INodeType {
|
||||
return { json: serializedMessage as unknown as IDataObject };
|
||||
}) ?? [];
|
||||
|
||||
return await this.prepareOutputData(serializedMessages);
|
||||
return [serializedMessages];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import type { IExecuteFunctions, IWorkflowDataProxyData } from 'n8n-workflow';
|
||||
import type { IExecuteFunctions, INode, IWorkflowDataProxyData } from 'n8n-workflow';
|
||||
import { mock } from 'jest-mock-extended';
|
||||
import { normalizeItems } from 'n8n-core';
|
||||
import type { z } from 'zod';
|
||||
@@ -12,7 +12,7 @@ describe('OutputParserStructured', () => {
|
||||
});
|
||||
const workflowDataProxy = mock<IWorkflowDataProxyData>({ $input: mock() });
|
||||
thisArg.getWorkflowDataProxy.mockReturnValue(workflowDataProxy);
|
||||
thisArg.getNode.mockReturnValue({ typeVersion: 1.1 });
|
||||
thisArg.getNode.mockReturnValue(mock<INode>({ typeVersion: 1.1 }));
|
||||
thisArg.addInputData.mockReturnValue({ index: 0 });
|
||||
thisArg.addOutputData.mockReturnValue();
|
||||
|
||||
|
||||
@@ -108,6 +108,6 @@ export class VectorStoreInMemoryInsert implements INodeType {
|
||||
clearStore,
|
||||
);
|
||||
|
||||
return await this.prepareOutputData(serializedDocuments);
|
||||
return [serializedDocuments];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -134,6 +134,6 @@ export class VectorStorePineconeInsert implements INodeType {
|
||||
pineconeIndex,
|
||||
});
|
||||
|
||||
return await this.prepareOutputData(serializedDocuments);
|
||||
return [serializedDocuments];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -46,7 +46,7 @@ export const VectorStoreQdrant = createVectorStoreNode({
|
||||
methods: { listSearch: { qdrantCollectionsSearch } },
|
||||
insertFields,
|
||||
sharedFields,
|
||||
async getVectorStoreClient(context, filter, embeddings, itemIndex) {
|
||||
async getVectorStoreClient(context, _, embeddings, itemIndex) {
|
||||
const collection = context.getNodeParameter('qdrantCollection', itemIndex, '', {
|
||||
extractValue: true,
|
||||
}) as string;
|
||||
|
||||
@@ -122,6 +122,6 @@ export class VectorStoreSupabaseInsert implements INodeType {
|
||||
queryName,
|
||||
});
|
||||
|
||||
return await this.prepareOutputData(serializedDocuments);
|
||||
return [serializedDocuments];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -139,6 +139,6 @@ export class VectorStoreZepInsert implements INodeType {
|
||||
|
||||
await ZepVectorStore.fromDocuments(processedDocuments, embeddings, zepConfig);
|
||||
|
||||
return await this.prepareOutputData(serializedDocuments);
|
||||
return [serializedDocuments];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -240,7 +240,7 @@ export const createVectorStoreNode = (args: VectorStoreNodeConstructorArgs) =>
|
||||
void logAiEvent(this, 'n8n.ai.vector.store.searched', { query: prompt });
|
||||
}
|
||||
|
||||
return await this.prepareOutputData(resultData);
|
||||
return [resultData];
|
||||
}
|
||||
|
||||
if (mode === 'insert') {
|
||||
@@ -270,7 +270,7 @@ export const createVectorStoreNode = (args: VectorStoreNodeConstructorArgs) =>
|
||||
}
|
||||
}
|
||||
|
||||
return await this.prepareOutputData(resultData);
|
||||
return [resultData];
|
||||
}
|
||||
|
||||
throw new NodeOperationError(
|
||||
|
||||
Reference in New Issue
Block a user