Compare commits

...

2 Commits

Author SHA1 Message Date
Thomas Kaul ce85a14b11
Release 2.133.1 (#4186) 3 weeks ago
Thomas Kaul 86683a5bf3
Bugfix/fix AI prompt endpoint (#4185) 3 weeks ago
  1. 2
      CHANGELOG.md
  2. 16
      apps/api/src/app/endpoints/ai/ai.controller.ts
  3. 4
      package-lock.json
  4. 2
      package.json

2
CHANGELOG.md

@ -5,7 +5,7 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
## 2.133.0 - 2025-01-08 ## 2.133.1 - 2025-01-09
### Added ### Added

16
apps/api/src/app/endpoints/ai/ai.controller.ts

@ -1,16 +1,14 @@
import { HasPermission } from '@ghostfolio/api/decorators/has-permission.decorator'; import { HasPermission } from '@ghostfolio/api/decorators/has-permission.decorator';
import { HasPermissionGuard } from '@ghostfolio/api/guards/has-permission.guard'; import { HasPermissionGuard } from '@ghostfolio/api/guards/has-permission.guard';
import { ImpersonationService } from '@ghostfolio/api/services/impersonation/impersonation.service';
import { import {
DEFAULT_CURRENCY, DEFAULT_CURRENCY,
DEFAULT_LANGUAGE_CODE, DEFAULT_LANGUAGE_CODE
HEADER_KEY_IMPERSONATION
} from '@ghostfolio/common/config'; } from '@ghostfolio/common/config';
import { AiPromptResponse } from '@ghostfolio/common/interfaces'; import { AiPromptResponse } from '@ghostfolio/common/interfaces';
import { permissions } from '@ghostfolio/common/permissions'; import { permissions } from '@ghostfolio/common/permissions';
import type { RequestWithUser } from '@ghostfolio/common/types'; 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 { REQUEST } from '@nestjs/core';
import { AuthGuard } from '@nestjs/passport'; import { AuthGuard } from '@nestjs/passport';
@ -20,21 +18,15 @@ import { AiService } from './ai.service';
export class AiController { export class AiController {
public constructor( public constructor(
private readonly aiService: AiService, private readonly aiService: AiService,
private readonly impersonationService: ImpersonationService,
@Inject(REQUEST) private readonly request: RequestWithUser @Inject(REQUEST) private readonly request: RequestWithUser
) {} ) {}
@Get('prompt') @Get('prompt')
@HasPermission(permissions.readAiPrompt) @HasPermission(permissions.readAiPrompt)
@UseGuards(AuthGuard('jwt'), HasPermissionGuard) @UseGuards(AuthGuard('jwt'), HasPermissionGuard)
public async getPrompt( public async getPrompt(): Promise<AiPromptResponse> {
@Headers(HEADER_KEY_IMPERSONATION.toLowerCase()) impersonationId
): Promise<AiPromptResponse> {
const impersonationUserId =
await this.impersonationService.validateImpersonationId(impersonationId);
const prompt = await this.aiService.getPrompt({ const prompt = await this.aiService.getPrompt({
impersonationId: impersonationUserId, impersonationId: undefined,
languageCode: languageCode:
this.request.user.Settings.settings.language ?? DEFAULT_LANGUAGE_CODE, this.request.user.Settings.settings.language ?? DEFAULT_LANGUAGE_CODE,
userCurrency: userCurrency:

4
package-lock.json

@ -1,12 +1,12 @@
{ {
"name": "ghostfolio", "name": "ghostfolio",
"version": "2.133.0", "version": "2.133.1",
"lockfileVersion": 3, "lockfileVersion": 3,
"requires": true, "requires": true,
"packages": { "packages": {
"": { "": {
"name": "ghostfolio", "name": "ghostfolio",
"version": "2.133.0", "version": "2.133.1",
"hasInstallScript": true, "hasInstallScript": true,
"license": "AGPL-3.0", "license": "AGPL-3.0",
"dependencies": { "dependencies": {

2
package.json

@ -1,6 +1,6 @@
{ {
"name": "ghostfolio", "name": "ghostfolio",
"version": "2.133.0", "version": "2.133.1",
"homepage": "https://ghostfol.io", "homepage": "https://ghostfol.io",
"license": "AGPL-3.0", "license": "AGPL-3.0",
"repository": "https://github.com/ghostfolio/ghostfolio", "repository": "https://github.com/ghostfolio/ghostfolio",

Loading…
Cancel
Save