feat(core): Add endpoint to create free AI credits (#12362)

This commit is contained in:
Ricardo Espinoza
2024-12-27 09:46:57 -05:00
committed by GitHub
parent c00b95e08f
commit ac4e042231
19 changed files with 258 additions and 34 deletions
+10
View File
@@ -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);
}
}