mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-18 10:31:15 +00:00
feat(Structured Output Parser Node): Refactor Output Parsers and Improve Error Handling (#11148)
This commit is contained in:
@@ -0,0 +1,26 @@
|
||||
import type { IExecuteFunctions } from 'n8n-workflow';
|
||||
import { NodeConnectionType } from 'n8n-workflow';
|
||||
|
||||
import { N8nItemListOutputParser } from './N8nItemListOutputParser';
|
||||
import { N8nOutputFixingParser } from './N8nOutputFixingParser';
|
||||
import { N8nStructuredOutputParser } from './N8nStructuredOutputParser';
|
||||
|
||||
export type N8nOutputParser =
|
||||
| N8nOutputFixingParser
|
||||
| N8nStructuredOutputParser
|
||||
| N8nItemListOutputParser;
|
||||
|
||||
export { N8nOutputFixingParser, N8nItemListOutputParser, N8nStructuredOutputParser };
|
||||
|
||||
export async function getOptionalOutputParsers(ctx: IExecuteFunctions): Promise<N8nOutputParser[]> {
|
||||
let outputParsers: N8nOutputParser[] = [];
|
||||
|
||||
if (ctx.getNodeParameter('hasOutputParser', 0, true) === true) {
|
||||
outputParsers = (await ctx.getInputConnectionData(
|
||||
NodeConnectionType.AiOutputParser,
|
||||
0,
|
||||
)) as N8nOutputParser[];
|
||||
}
|
||||
|
||||
return outputParsers;
|
||||
}
|
||||
Reference in New Issue
Block a user