mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-17 01:56:46 +00:00
feat: AI Workflow Builder agent (no-changelog) (#17423)
Co-authored-by: cubic-dev-ai[bot] <191113872+cubic-dev-ai[bot]@users.noreply.github.com>
This commit is contained in:
@@ -1,8 +1,43 @@
|
||||
import type { IRunExecutionData, IWorkflowBase, NodeExecutionSchema } from 'n8n-workflow';
|
||||
import { z } from 'zod';
|
||||
import { Z } from 'zod-class';
|
||||
|
||||
export class AiBuilderChatRequestDto extends Z.class({
|
||||
payload: z.object({
|
||||
question: z.string(),
|
||||
role: z.literal('user'),
|
||||
type: z.literal('message'),
|
||||
text: z.string(),
|
||||
workflowContext: z.object({
|
||||
currentWorkflow: z
|
||||
.custom<Partial<IWorkflowBase>>((val: Partial<IWorkflowBase>) => {
|
||||
if (!val.nodes && !val.connections) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return val;
|
||||
})
|
||||
.optional(),
|
||||
|
||||
executionData: z
|
||||
.custom<IRunExecutionData['resultData']>((val: IRunExecutionData['resultData']) => {
|
||||
if (!val.runData && !val.error) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return val;
|
||||
})
|
||||
.optional(),
|
||||
|
||||
executionSchema: z
|
||||
.custom<NodeExecutionSchema[]>((val: NodeExecutionSchema[]) => {
|
||||
// Check if the array is empty or if all items have nodeName and schema properties
|
||||
if (!Array.isArray(val) || val.every((item) => !item.nodeName || !item.schema)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return val;
|
||||
})
|
||||
.optional(),
|
||||
}),
|
||||
}),
|
||||
}) {}
|
||||
|
||||
@@ -0,0 +1,6 @@
|
||||
import { z } from 'zod';
|
||||
import { Z } from 'zod-class';
|
||||
|
||||
export class AiSessionRetrievalRequestDto extends Z.class({
|
||||
workflowId: z.string().optional(),
|
||||
}) {}
|
||||
@@ -3,6 +3,7 @@ export { AiChatRequestDto } from './ai/ai-chat-request.dto';
|
||||
export { AiBuilderChatRequestDto } from './ai/ai-build-request.dto';
|
||||
export { AiApplySuggestionRequestDto } from './ai/ai-apply-suggestion-request.dto';
|
||||
export { AiFreeCreditsRequestDto } from './ai/ai-free-credits-request.dto';
|
||||
export { AiSessionRetrievalRequestDto } from './ai/ai-session-retrieval-request.dto';
|
||||
|
||||
export { BinaryDataQueryDto } from './binary-data/binary-data-query.dto';
|
||||
export { BinaryDataSignedQueryDto } from './binary-data/binary-data-signed-query.dto';
|
||||
|
||||
Reference in New Issue
Block a user