mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-18 18:41:14 +00:00
fix(editor): Adjust Ask AI tracking events & pass NDV session id (no-changelog) (#7027)
Github issue / Community forum post (link here to close automatically): --------- Signed-off-by: Oleg Ivaniv <me@olegivaniv.com>
This commit is contained in:
@@ -2,12 +2,6 @@ import type { IRestApiContext, Schema } from '@/Interface';
|
||||
import { makeRestApiRequest } from '@/utils/apiUtils';
|
||||
import type { IDataObject } from 'n8n-workflow';
|
||||
|
||||
type Usage = {
|
||||
prompt_tokens: number;
|
||||
completion_tokens: number;
|
||||
total_tokens: number;
|
||||
};
|
||||
|
||||
export async function generateCodeForPrompt(
|
||||
ctx: IRestApiContext,
|
||||
{
|
||||
@@ -20,11 +14,13 @@ export async function generateCodeForPrompt(
|
||||
context: {
|
||||
schema: Array<{ nodeName: string; schema: Schema }>;
|
||||
inputSchema: { nodeName: string; schema: Schema };
|
||||
sessionId: string;
|
||||
ndvSessionId: string;
|
||||
};
|
||||
model: string;
|
||||
n8nVersion: string;
|
||||
},
|
||||
): Promise<{ code: string; usage: Usage }> {
|
||||
): Promise<{ code: string }> {
|
||||
return makeRestApiRequest(ctx, 'POST', '/ask-ai', {
|
||||
question,
|
||||
context,
|
||||
|
||||
Reference in New Issue
Block a user