Files
Automata/packages/editor-ui/src/api/ai.ts
कारतोफ्फेलस्क्रिप्ट™ 86018aa6e0 refactor(core): Remove Ask AI HTTP request feature (no-changelog) (#9931)
2024-07-04 12:09:45 +02:00

31 lines
680 B
TypeScript

import type { IRestApiContext, Schema } from '@/Interface';
import { makeRestApiRequest } from '@/utils/apiUtils';
import type { IDataObject } from 'n8n-workflow';
export async function generateCodeForPrompt(
ctx: IRestApiContext,
{
question,
context,
model,
n8nVersion,
}: {
question: string;
context: {
schema: Array<{ nodeName: string; schema: Schema }>;
inputSchema: { nodeName: string; schema: Schema };
pushRef: string;
ndvPushRef: string;
};
model: string;
n8nVersion: string;
},
): Promise<{ code: string }> {
return await makeRestApiRequest(ctx, 'POST', '/ask-ai', {
question,
context,
model,
n8nVersion,
} as IDataObject);
}