mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2026-09-28 12:41:45 +02:00
feat(core): Add endpoint to create free AI credits (#12362)
This commit is contained in:
@@ -22,6 +22,7 @@ export class AiService {
|
||||
|
||||
async init() {
|
||||
const aiAssistantEnabled = this.licenseService.isAiAssistantEnabled();
|
||||
|
||||
if (!aiAssistantEnabled) {
|
||||
return;
|
||||
}
|
||||
@@ -66,4 +67,13 @@ export class AiService {
|
||||
|
||||
return await this.client.askAi(payload, { id: user.id });
|
||||
}
|
||||
|
||||
async createFreeAiCredits(user: IUser) {
|
||||
if (!this.client) {
|
||||
await this.init();
|
||||
}
|
||||
assert(this.client, 'Assistant client not setup');
|
||||
|
||||
return await this.client.generateAiCreditsCredentials(user);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user