@dataclouder/ngx-agent-cards 0.1.49 → 0.1.51

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,8 @@ 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
+ const settings = this.userService.user()?.settings?.conversation;
1278
+ return settings;
1276
1279
  }
1277
1280
  async getListModels(provider) {
1278
1281
  // Note: Original service in agent-cards.service.ts used 'node' as host. Using 'primary'.
@@ -1295,8 +1298,13 @@ class DefaultAgentCardsService extends EntityCommunicationService {
1295
1298
  // Note: Original service in agent-cards.service.ts used 'python' as host. Using 'primary'.
1296
1299
  return this.httpService.post(`${Endpoints$1.AgentChat}`, conversationDto, 'primary');
1297
1300
  }
1298
- async saveConversationUserChatSettings(settings) {
1299
- throw new Error('Method saveConversationUserChatSettings cannot be implemented in DefaultAgentCardsService without User Service/ToastService or an alternative.');
1301
+ async saveConversationUserChatSettings(newSettings) {
1302
+ const settings = { ...this.userService.user()?.settings };
1303
+ const conversation = newSettings;
1304
+ settings.conversation = conversation;
1305
+ await this.userService.updatePartialUserServer({ id: this.userService.user()?.id, settings });
1306
+ this.toastService.success({ title: 'Listo', subtitle: 'Se actualizaron las configuraciones' });
1307
+ return newSettings; // Or return the updated settings object from userService if available
1300
1308
  }
1301
1309
  generateImageForCard(idCard) {
1302
1310
  return this.httpService.get(`${Endpoints$1.GenerateImage}/${idCard}`, 'primary');