diff --git a/apps/api/src/app/endpoints/ai/ai.controller.ts b/apps/api/src/app/endpoints/ai/ai.controller.ts index c4c4b375d..981b26aa2 100644 --- a/apps/api/src/app/endpoints/ai/ai.controller.ts +++ b/apps/api/src/app/endpoints/ai/ai.controller.ts @@ -1,16 +1,14 @@ import { HasPermission } from '@ghostfolio/api/decorators/has-permission.decorator'; import { HasPermissionGuard } from '@ghostfolio/api/guards/has-permission.guard'; -import { ImpersonationService } from '@ghostfolio/api/services/impersonation/impersonation.service'; import { DEFAULT_CURRENCY, - DEFAULT_LANGUAGE_CODE, - HEADER_KEY_IMPERSONATION + DEFAULT_LANGUAGE_CODE } from '@ghostfolio/common/config'; import { AiPromptResponse } from '@ghostfolio/common/interfaces'; import { permissions } from '@ghostfolio/common/permissions'; import type { RequestWithUser } from '@ghostfolio/common/types'; -import { Controller, Get, Headers, Inject, UseGuards } from '@nestjs/common'; +import { Controller, Get, Inject, UseGuards } from '@nestjs/common'; import { REQUEST } from '@nestjs/core'; import { AuthGuard } from '@nestjs/passport'; @@ -20,21 +18,15 @@ import { AiService } from './ai.service'; export class AiController { public constructor( private readonly aiService: AiService, - private readonly impersonationService: ImpersonationService, @Inject(REQUEST) private readonly request: RequestWithUser ) {} @Get('prompt') @HasPermission(permissions.readAiPrompt) @UseGuards(AuthGuard('jwt'), HasPermissionGuard) - public async getPrompt( - @Headers(HEADER_KEY_IMPERSONATION.toLowerCase()) impersonationId - ): Promise { - const impersonationUserId = - await this.impersonationService.validateImpersonationId(impersonationId); - + public async getPrompt(): Promise { const prompt = await this.aiService.getPrompt({ - impersonationId: impersonationUserId, + impersonationId: undefined, languageCode: this.request.user.Settings.settings.language ?? DEFAULT_LANGUAGE_CODE, userCurrency: