@dataclouder/ngx-agent-cards 0.1.49 → 0.1.50

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,7 +1,7 @@
1
1
  import * as i0 from '@angular/core';
2
2
  import { InjectionToken, Injectable, inject, signal, computed, RendererFactory2, ApplicationRef, Injector, EnvironmentInjector, createComponent, ChangeDetectionStrategy, Component, output, Input, input, effect, ViewChild, DestroyRef, ElementRef, Pipe, ChangeDetectorRef, EventEmitter, Output } from '@angular/core';
3
3
  import * as i1 from '@dataclouder/ngx-core';
4
- import { MoodStateOptions, formatCamelCaseString, LANGUAGES, EntityCommunicationService, AudioSpeed as AudioSpeed$1, TOAST_ALERTS_TOKEN, LoadingBarService, EModelQuality, getLangDesc, AudioSpeedReverse, getSupportedLanguageOptions, FormUtilsService, EntityBaseFormComponent, DcManageableFormComponent, DcLearnableFormComponent, EntityBaseListComponent, DCFilterBarComponent, QuickTableComponent, EmptyStateComponent } from '@dataclouder/ngx-core';
4
+ import { MoodStateOptions, formatCamelCaseString, LANGUAGES, EntityCommunicationService, TOAST_ALERTS_TOKEN, AudioSpeed as AudioSpeed$1, LoadingBarService, EModelQuality, getLangDesc, AudioSpeedReverse, getSupportedLanguageOptions, FormUtilsService, EntityBaseFormComponent, DcManageableFormComponent, DcLearnableFormComponent, EntityBaseListComponent, DCFilterBarComponent, QuickTableComponent, EmptyStateComponent } from '@dataclouder/ngx-core';
5
5
  import { UserService } from '@dataclouder/ngx-users';
6
6
  import * as i2$1 from '@angular/common';
7
7
  import { DOCUMENT, CommonModule, DecimalPipe } from '@angular/common';
@@ -1228,6 +1228,8 @@ class DefaultAgentCardsService extends EntityCommunicationService {
1228
1228
  constructor() {
1229
1229
  super('agent-cards');
1230
1230
  this.conversationCostService = inject(ConversationCostService);
1231
+ this.userService = inject(UserService);
1232
+ this.toastService = inject(TOAST_ALERTS_TOKEN);
1231
1233
  this.randomSeed = Math.floor(Math.random() * 100000);
1232
1234
  }
1233
1235
  partialUpdateAgentCard(agentCard) {
@@ -1272,7 +1274,9 @@ class DefaultAgentCardsService extends EntityCommunicationService {
1272
1274
  await this.httpService.delete(`${Endpoints$1.AgentCard}/${id}`, 'primary');
1273
1275
  }
1274
1276
  async getConversationUserChatSettings() {
1275
- throw new Error('Method getConversationUserChatSettings cannot be implemented in DefaultAgentCardsService without User or an alternative settings source.');
1277
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
1278
+ const settings = this.userService.user()?.settings?.conversation;
1279
+ return settings;
1276
1280
  }
1277
1281
  async getListModels(provider) {
1278
1282
  // Note: Original service in agent-cards.service.ts used 'node' as host. Using 'primary'.
@@ -1295,8 +1299,16 @@ class DefaultAgentCardsService extends EntityCommunicationService {
1295
1299
  // Note: Original service in agent-cards.service.ts used 'python' as host. Using 'primary'.
1296
1300
  return this.httpService.post(`${Endpoints$1.AgentChat}`, conversationDto, 'primary');
1297
1301
  }
1298
- async saveConversationUserChatSettings(settings) {
1299
- throw new Error('Method saveConversationUserChatSettings cannot be implemented in DefaultAgentCardsService without User Service/ToastService or an alternative.');
1302
+ async saveConversationUserChatSettings(newSettings) {
1303
+ // TODO: deberia tener un metodo updateUserSettings() pero mientras tengo que pasar todo el objeto settings en vez de solo conversation
1304
+ const settings = { ...this.userService.user()?.settings };
1305
+ const conversation = newSettings;
1306
+ // conversation.speed = AudioSpeedRating[conversation.speed ?? 3];
1307
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
1308
+ settings.conversation = conversation;
1309
+ await this.userService.updatePartialUserServer({ id: this.userService.user()?.id, settings });
1310
+ this.toastService.success({ title: 'Listo', subtitle: 'Se actualizaron las configuraciones' });
1311
+ return newSettings; // Or return the updated settings object from userService if available
1300
1312
  }
1301
1313
  generateImageForCard(idCard) {
1302
1314
  return this.httpService.get(`${Endpoints$1.GenerateImage}/${idCard}`, 'primary');