@dataclouder/ngx-agent-cards 0.1.43 → 0.1.45

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.
@@ -455,27 +455,6 @@ function extractJsonFromResponse(content) {
455
455
  }
456
456
  }
457
457
 
458
- /**
459
- * @deprecated use userService directly instead
460
- */
461
- const USER_DATA_EXCHANGE = new InjectionToken('user.data.exchange');
462
- /**
463
- * @deprecated use userService directly instead
464
- */
465
- function provideUserDataExchange(serviceImplementation) {
466
- return [
467
- {
468
- provide: USER_DATA_EXCHANGE,
469
- useExisting: serviceImplementation,
470
- },
471
- ];
472
- }
473
- /**
474
- * @deprecated use userService directly instead
475
- */
476
- class UserDataExchangeAbstractService {
477
- }
478
-
479
458
  const getMoodStateLabelsAsString = () => {
480
459
  return MoodStateOptions.map((option) => option.value).join('\n');
481
460
  };
@@ -993,7 +972,6 @@ function getDefaultPromptByType(conversationType) {
993
972
 
994
973
  class ConversationPromptBuilderService {
995
974
  constructor() {
996
- this.userDataExchange = inject(USER_DATA_EXCHANGE);
997
975
  this.userService = inject(UserService);
998
976
  }
999
977
  // For chat conversation i need inital settings.
@@ -2353,11 +2331,11 @@ class DynamicFlowTaskService {
2353
2331
  this.dynamicFlowService = inject(DynamicFlowService);
2354
2332
  this.evaluationService = inject(EvaluationService);
2355
2333
  this.messagesStateService = inject(MessagesStateService);
2356
- this.userDataExchange = inject(USER_DATA_EXCHANGE);
2334
+ this.userService = inject(UserService);
2357
2335
  }
2358
2336
  async evaluateAssistantTaskTrigger(message) {
2359
- const userChatSettings = this.userDataExchange.getUserChatSettings();
2360
- if (!userChatSettings.assistantMessageTask) {
2337
+ const userChatSettings = this.userService.user().settings.conversation?.assistantMessageTask;
2338
+ if (!userChatSettings) {
2361
2339
  return;
2362
2340
  }
2363
2341
  const conversationFlow = this.dynamicFlowService.conversationFlowState();
@@ -2385,8 +2363,8 @@ class DynamicFlowTaskService {
2385
2363
  // TODO probably i need a different method for the goal.
2386
2364
  this.evaluationService.evaluateGoal(goal);
2387
2365
  // 2) Run User Trigger Evaluation only if user allows it
2388
- const chatUserSettings = this.userDataExchange.getUserChatSettings();
2389
- if (chatUserSettings.userMessageTask) {
2366
+ const chatUserSettings = this.userService.user().settings.conversation;
2367
+ if (chatUserSettings?.userMessageTask) {
2390
2368
  const userTriggerTask = conversationFlow.triggerTasks.onUserMessage;
2391
2369
  // TODO: Siento MUY Forzado el utilizar evaluateConversation, ese es del goal, pero lo quize hacer general!
2392
2370
  if (userTriggerTask && message.messageId) {
@@ -2418,7 +2396,7 @@ class ConversationService {
2418
2396
  this.toastAlerts = inject(TOAST_ALERTS_TOKEN);
2419
2397
  this.messageProcessingService = inject(MessageProcessingService);
2420
2398
  this.conversationBuilder = inject(ConversationPromptBuilderService);
2421
- this.userDataExchange = inject(USER_DATA_EXCHANGE);
2399
+ this.userService = inject(UserService);
2422
2400
  this.messagesStateService = inject(MessagesStateService);
2423
2401
  this.dynamicFlowService = inject(DynamicFlowService);
2424
2402
  this.dynamicCriteriaService = inject(DynamicCriteriaService);
@@ -2464,7 +2442,7 @@ class ConversationService {
2464
2442
  this.isDestroyedSignal.set(value);
2465
2443
  }
2466
2444
  overrideSettingsByUserSettings(conversationSettings) {
2467
- const userSettings = this.userDataExchange.getUserChatSettings();
2445
+ const userSettings = this.userService.user().settings.conversation;
2468
2446
  if (userSettings?.model?.provider) {
2469
2447
  conversationSettings.model = userSettings.model;
2470
2448
  }
@@ -2519,7 +2497,7 @@ class ConversationService {
2519
2497
  await this.initConversation();
2520
2498
  }
2521
2499
  async initConversation() {
2522
- this.avatarImages.userImg = this.userDataExchange.getUserDataExchange().imgUrl;
2500
+ this.avatarImages.userImg = this.userService.user().urlPicture;
2523
2501
  const conversationSettings = this.conversationSettingsState();
2524
2502
  for (const i in conversationSettings.messages) {
2525
2503
  if (!conversationSettings.messages[i].messageId) {
@@ -2655,7 +2633,7 @@ class ConversationService {
2655
2633
  this.messagesStateService.clearMessages();
2656
2634
  }
2657
2635
  async getTTSFile(message) {
2658
- const userChatSettings = await this.userDataExchange.getUserChatSettings();
2636
+ const userChatSettings = await this.userService.user().settings.conversation;
2659
2637
  const ttsRequest = buildObjectTTSRequest(message, userChatSettings);
2660
2638
  return this.ttsService.getTextAudioFile(ttsRequest);
2661
2639
  }
@@ -3299,8 +3277,8 @@ class MessageOrchestrationService {
3299
3277
  constructor() {
3300
3278
  // Services
3301
3279
  this.conversationService = inject(ConversationService);
3302
- this.userDataExchange = inject(USER_DATA_EXCHANGE);
3303
3280
  this.chatMonitorService = inject(ChatMonitorService);
3281
+ this.userService = inject(UserService);
3304
3282
  // State Signals
3305
3283
  this.messages = signal([], ...(ngDevMode ? [{ debugName: "messages" }] : []));
3306
3284
  this.messageRole = signal(ChatRole.User, ...(ngDevMode ? [{ debugName: "messageRole" }] : []));
@@ -3319,7 +3297,7 @@ class MessageOrchestrationService {
3319
3297
  this.messages.set([...messages]);
3320
3298
  this.messageRole.set(role);
3321
3299
  if (role === ChatRole.Assistant) {
3322
- const chatSettings = this.userDataExchange.getUserChatSettings();
3300
+ const chatSettings = this.userService.user().settings.conversation;
3323
3301
  if (chatSettings.synthVoice) {
3324
3302
  this.initializeAudioQueue();
3325
3303
  this.processNextInQueue();
@@ -3872,12 +3850,12 @@ class DCChatComponent {
3872
3850
  this.conversationInfoService = inject(ConversationInfoService);
3873
3851
  this.conversationService = inject(ConversationService);
3874
3852
  this.evaluationService = inject(EvaluationService);
3875
- this.userDataExchange = inject(USER_DATA_EXCHANGE);
3876
3853
  this.messageStateService = inject(MessagesStateService);
3877
3854
  this.dialogService = inject(DialogService);
3878
3855
  this.chatMonitorService = inject(ChatMonitorService);
3856
+ this.userService = inject(UserService);
3879
3857
  // 📥 Inputs
3880
- this.chatUserSettings = this.userDataExchange.getUserChatSettings(); // Default to user data exchange
3858
+ this.chatUserSettings = this.userService.user().settings.conversation; // Default to user data exchange
3881
3859
  this.conversationFlow = null;
3882
3860
  // 📤 Input Signals
3883
3861
  this.parseDict = input({}, ...(ngDevMode ? [{ debugName: "parseDict" }] : []));
@@ -5367,14 +5345,15 @@ class AgentCardUI {
5367
5345
  this.showOptions = input(true, ...(ngDevMode ? [{ debugName: "showOptions" }] : []));
5368
5346
  this.onAction = output();
5369
5347
  this.agentCardsMasterStateService = inject(AGENT_CARDS_STATE_SERVICE);
5348
+ effect(() => {
5349
+ this.getTaken();
5350
+ });
5370
5351
  }
5371
5352
  ngOnInit() {
5372
5353
  const description = this.card()?.characterCard?.data?.description;
5373
5354
  if (description) {
5374
5355
  // this.card()?.characterCard?.data?.description = description?.replace(/{{char}}/g, name);
5375
5356
  }
5376
- this.userService.isAdmin();
5377
- this.getTaken();
5378
5357
  }
5379
5358
  eventCard(eventType) {
5380
5359
  this.onAction.emit({ action: eventType, item: this.card() });
@@ -5393,7 +5372,7 @@ class AgentCardUI {
5393
5372
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.6", ngImport: i0, type: AgentCardUI, decorators: [{
5394
5373
  type: Component,
5395
5374
  args: [{ selector: 'dc-agent-card-ui', imports: [PopoverModule, TruncatePipe, ButtonModule, SpeedDialModule, CardModule, TagModule], changeDetection: ChangeDetectionStrategy.OnPush, template: "<p-card class=\"card-image\">\n @if(showOptions()) {\n <div style=\"position: absolute; top: 5px; right: 5px; z-index: 1000\">\n <p-speeddial\n [model]=\"speedDialModel\"\n [radius]=\"70\"\n type=\"quarter-circle\"\n direction=\"down-left\"\n [tooltipOptions]=\"{ tooltipPosition: 'top' }\"\n [buttonProps]=\"{ severity: 'primary', rounded: true, outlined: true, raised: true }\" />\n </div>\n }\n\n <img [src]=\"card()?.assets?.image?.url || 'assets/defaults/images/default_conversation_card.webp'\" alt=\"\" />\n\n <div (click)=\"eventCard(eventType.Select)\" class=\"content\">\n <p class=\"text-xl font-bold text-shadow-lg/30\">{{ card()?.name || card()?.title }}</p>\n\n <p style=\"margin-top: 40px\">\n <span class=\"title text-shadow-lg/30\" [innerHTML]=\"card().description || card().characterCard?.data?.creator_notes | truncate : 200\"></span>\n </p>\n\n <div style=\"position: absolute; bottom: 10px; left: 10px\">\n @if(isTaken()){\n <p-tag icon=\"pi pi-check-circle\" severity=\"success\" value=\"Tomada\" [rounded]=\"true\" />\n } @if(userService.isAdmin()){\n\n <p-tag icon=\"pi pi-eye\" severity=\"secondary\" [value]=\"card()?.manageable?.status || 'Sin estado'\" [rounded]=\"true\" />\n }\n </div>\n\n <p-button\n (click)=\"eventCard(eventType.Select); $event.stopPropagation()\"\n [style]=\"{ position: 'absolute', bottom: '10px', right: '10px' }\"\n icon=\"pi pi-comment\"\n [rounded]=\"true\"\n severity=\"info\"\n [outlined]=\"true\"\n [raised]=\"true\" />\n </div>\n</p-card>\n", styles: [":host{display:block}:host ::ng-deep .p-card{height:100%}:host ::ng-deep .p-card-body{height:100%;padding:0!important}.card-image{width:280px;height:380px;position:relative;align-items:center;display:block;padding:-10px}.card-image img{position:absolute;z-index:3;width:100%;height:100%;opacity:.75;object-fit:cover;transition:opacity .5s}.content{position:absolute;inset:0;z-index:4;padding:1rem;color:#fff;background:linear-gradient(to bottom,#0003,#0000001a);height:100%;display:flex;flex-direction:column;justify-content:space-between}.content:hover{background:linear-gradient(to bottom,color-mix(in srgb,var(--p-primary-color) 20%,transparent),color-mix(in srgb,black 10%,transparent));cursor:pointer}\n"] }]
5396
- }] });
5375
+ }], ctorParameters: () => [] });
5397
5376
 
5398
5377
  // This component contains a really avanced strategy to dinamically render Conversation Cards Details so every app can implement it with their own Style and Behavior
5399
5378
  // The trick is use NGFOR with ngComponentOutlet and pass input, problem is, is not possible to get Outpus events, Option one is use injector with ngComponentOutlet and pass context function to handle , but somehow it inject html and due to sanity im not able to see popups
@@ -5501,11 +5480,11 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.6", ngImpor
5501
5480
 
5502
5481
  class ParseCardPipe {
5503
5482
  constructor() {
5504
- this.userDataExchange = inject(USER_DATA_EXCHANGE);
5505
5483
  this.builderConversation = inject(ConversationPromptBuilderService);
5484
+ this.userService = inject(UserService);
5506
5485
  }
5507
5486
  transform(text, card = null) {
5508
- let parseDict = this.userDataExchange.getParseDict();
5487
+ let parseDict = this.userService.getFieldsForParseConversation();
5509
5488
  if (card) {
5510
5489
  const cardMacros = { char: card?.characterCard?.data?.name };
5511
5490
  parseDict = { ...parseDict, ...cardMacros };
@@ -5696,5 +5675,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.6", ngImpor
5696
5675
  * Generated bundle index. Do not edit.
5697
5676
  */
5698
5677
 
5699
- export { AGENT_CARDS_STATE_SERVICE, AIGenerationService, AgentCardListComponent, AgentCardUI, AgentCardsGenerationService, AudioService, AudioSpeed, CONVERSATION_AI_TOKEN, CardsCreatorComponent, ChatEventType, ChatMessage, ChatMessageOrchestratorComponent, ChatMonitorService, ChatRole, ConditionOperator, ConditionType, ContextEngineService, ContextType, ConversationDTO, ConversationEvents, ConversationMessagesDTO, ConversationPromptBuilderService, ConversationType, ConversationTypeOptions, DCAgentCardFormComponent, DCChatComponent, DCConversationUserChatSettingsComponent, DcAgentCardDetailsComponent, DefaultAgentCardsService, DoActionTypeOptions, DynamicFlowService, DynamicFlowTaskTypeOptions, EAccountsPlatform, EAgentType, EDoActionType, EDynamicFlowTaskType, EntityThen, EntityWhatOptions, EntityWhenOptions, EvalResultStringDefinition, GlobalToolsService, MOOD_STATE_PROMPT, MessageContent, MessageContentDisplayer, MessagesStateService, ModelSelectorComponent, PopupService, SystemPromptType, TextEngineOptions, TextEngines, USER_DATA_EXCHANGE, UserDataExchangeAbstractService, VoiceTTSOption, VoiceTTSOptions, WordTimestamps, buildObjectTTSRequest, characterCardStringDataDefinition, convertToHTML, createAIModelFormGroup, defaultconvUserSettings, extractAudioAndTranscription, extractJsonFromResponse, getMoodStateLabelsAsString, markdownToHtml, matchTranscription, provideAgentCardService, provideUserDataExchange, removeEmojis, removeEmojisAndSpecialCharacters, removeSpecialCharacters };
5678
+ export { AGENT_CARDS_STATE_SERVICE, AIGenerationService, AgentCardListComponent, AgentCardUI, AgentCardsGenerationService, AudioService, AudioSpeed, CONVERSATION_AI_TOKEN, CardsCreatorComponent, ChatEventType, ChatMessage, ChatMessageOrchestratorComponent, ChatMonitorService, ChatRole, ConditionOperator, ConditionType, ContextEngineService, ContextType, ConversationDTO, ConversationEvents, ConversationMessagesDTO, ConversationPromptBuilderService, ConversationType, ConversationTypeOptions, DCAgentCardFormComponent, DCChatComponent, DCConversationUserChatSettingsComponent, DcAgentCardDetailsComponent, DefaultAgentCardsService, DoActionTypeOptions, DynamicFlowService, DynamicFlowTaskTypeOptions, EAccountsPlatform, EAgentType, EDoActionType, EDynamicFlowTaskType, EntityThen, EntityWhatOptions, EntityWhenOptions, EvalResultStringDefinition, GlobalToolsService, MOOD_STATE_PROMPT, MessageContent, MessageContentDisplayer, MessagesStateService, ModelSelectorComponent, PopupService, SystemPromptType, TextEngineOptions, TextEngines, VoiceTTSOption, VoiceTTSOptions, WordTimestamps, buildObjectTTSRequest, characterCardStringDataDefinition, convertToHTML, createAIModelFormGroup, defaultconvUserSettings, extractAudioAndTranscription, extractJsonFromResponse, getMoodStateLabelsAsString, markdownToHtml, matchTranscription, provideAgentCardService, removeEmojis, removeEmojisAndSpecialCharacters, removeSpecialCharacters };
5700
5679
  //# sourceMappingURL=dataclouder-ngx-agent-cards.mjs.map