@dataclouder/ngx-agent-cards 0.1.75 → 0.1.78

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.
@@ -7,11 +7,11 @@ import { AiWhisperService, TtsService, NgxAiServicesService, GeneratedAssetsServ
7
7
  import * as i2$1 from '@angular/common';
8
8
  import { DOCUMENT, CommonModule, DecimalPipe, KeyValuePipe, DatePipe, SlicePipe, JsonPipe } from '@angular/common';
9
9
  import { nanoid } from 'nanoid';
10
+ import { Subject, fromEvent, filter } from 'rxjs';
10
11
  import { DynamicDialogRef, DynamicDialogConfig, DialogService, DynamicDialogModule } from 'primeng/dynamicdialog';
11
12
  import * as i2 from 'primeng/button';
12
13
  import { ButtonModule } from 'primeng/button';
13
14
  import * as Plyr from 'plyr';
14
- import { Subject, fromEvent, filter } from 'rxjs';
15
15
  import * as i2$2 from 'primeng/progressbar';
16
16
  import { ProgressBarModule } from 'primeng/progressbar';
17
17
  import * as i1$1 from '@angular/forms';
@@ -1741,6 +1741,9 @@ class ConversationFlowStateService {
1741
1741
  * Components and services can subscribe to this signal to get real-time updates.
1742
1742
  */
1743
1743
  this.flowState = signal(this.initialState, ...(ngDevMode ? [{ debugName: "flowState" }] : []));
1744
+ this.currentMood = computed(() => this.flowState().moodState.value, ...(ngDevMode ? [{ debugName: "currentMood" }] : []));
1745
+ this.moodUpdated = new Subject();
1746
+ this.moodUpdated$ = this.moodUpdated.asObservable();
1744
1747
  }
1745
1748
  /**
1746
1749
  * @description
@@ -1757,6 +1760,9 @@ class ConversationFlowStateService {
1757
1760
  */
1758
1761
  updateState(newState) {
1759
1762
  this.flowState.update((current) => ({ ...current, ...newState }));
1763
+ if (newState.moodState?.value) {
1764
+ this.moodUpdated.next(newState.moodState.value);
1765
+ }
1760
1766
  }
1761
1767
  /**
1762
1768
  * @description
@@ -1801,6 +1807,9 @@ class ConversationFlowStateService {
1801
1807
  ...current,
1802
1808
  moodState: { ...current.moodState, ...moodState },
1803
1809
  }));
1810
+ if (moodState.value) {
1811
+ this.moodUpdated.next(moodState.value);
1812
+ }
1804
1813
  }
1805
1814
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.1.6", ngImport: i0, type: ConversationFlowStateService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
1806
1815
  static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.1.6", ngImport: i0, type: ConversationFlowStateService, providedIn: 'root' }); }
@@ -2158,6 +2167,9 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.6", ngImpor
2158
2167
  }] });
2159
2168
 
2160
2169
  class ChatMonitorService {
2170
+ // Actualmente la única comunicación es con el background para cambiar el fondo.
2171
+ // El problema de comunicar así es si tiene que ser singleton, y en control markets tengo varias instancias de dc-chat.
2172
+ // Voy a utilizar el evento por ahora, y ver si combiene luego crear un servicio.
2161
2173
  // Se requiere comunicar el chat-engine con la app afuera, va a ver 2 formas de hacerlo.
2162
2174
  // Mediante eventos del chat, o estar subscrito al chat-monitor.
2163
2175
  // La complejidad del chat monitor es menor porque puedo injectarlo en cualquier lugar.
@@ -2914,36 +2926,16 @@ class DynamicFlowTaskService {
2914
2926
  this.messagesStateService = inject(MessagesStateService);
2915
2927
  this.userService = inject(UserService);
2916
2928
  }
2917
- async evaluateAssistantTaskTrigger(message) {
2918
- const canTriggerAssistant = this.userService.user()?.settings?.conversation?.assistantMessageTask;
2919
- if (!canTriggerAssistant) {
2920
- return;
2921
- }
2922
- const conversationFlow = this.dynamicFlowService.conversationFlowConfig();
2923
- if (!conversationFlow)
2924
- return;
2925
- const dynamicFlowTask = conversationFlow.triggerTasks.onAssistantMessage;
2926
- console.log('Trigger:', dynamicFlowTask);
2927
- if (dynamicFlowTask && message.messageId) {
2928
- const messageId = message.messageId;
2929
- // const contextMessages = this.contextEngineService.getContextMessages(this.messagesStateService.getMessagesSignal()(), ContextType.LastAssistantMessage);
2930
- // i cant override task in trigger.
2931
- const task = dynamicFlowTask.task + ' Here is the text: ' + (message.text || message.content);
2932
- const result = await this.evaluationService.evaluateWithTask({ model: dynamicFlowTask.model, task });
2933
- console.log('Assistant trigger evaluation result:', result);
2934
- message.evaluation = result;
2935
- this.messagesStateService.updateMessage(messageId, message);
2936
- }
2929
+ async triggerAfterAssistantMessage(message) {
2930
+ this.evaluateAssistantMessage(message);
2931
+ this.evaluateFlow();
2932
+ }
2933
+ async triggerAfterUserMessage(message) {
2934
+ this.evaluateUserMessage(message);
2937
2935
  }
2938
- async evaluateUserTaskTrigger(message) {
2936
+ async evaluateFlow() {
2939
2937
  const conversationFlow = this.dynamicFlowService.conversationFlowConfig();
2940
- if (!conversationFlow)
2941
- return;
2942
2938
  const goal = conversationFlow.goal;
2943
- // 1) Run Goal Evaluation
2944
- // TODO probably i need a different method for the goal.
2945
- // this.evaluationService.evaluateGoal(goal);
2946
- // Update Dynamic Flow State
2947
2939
  try {
2948
2940
  const messages = this.messagesStateService.getMessagesSignal()();
2949
2941
  const flowPrompt = this.dynamicFlowService.generateSystemPromptForFlow(messages);
@@ -2958,6 +2950,9 @@ class DynamicFlowTaskService {
2958
2950
  catch (err) {
2959
2951
  console.error('Error updating dynamic flow:', err);
2960
2952
  }
2953
+ }
2954
+ async evaluateUserMessage(message) {
2955
+ const conversationFlow = this.dynamicFlowService.conversationFlowConfig();
2961
2956
  // 2) Run User Trigger Evaluation only if user allows it
2962
2957
  const chatUserSettings = this.userService.user()?.settings?.conversation;
2963
2958
  if (chatUserSettings?.userMessageTask) {
@@ -2974,6 +2969,27 @@ class DynamicFlowTaskService {
2974
2969
  }
2975
2970
  }
2976
2971
  }
2972
+ async evaluateAssistantMessage(message) {
2973
+ const canTriggerAssistant = this.userService.user()?.settings?.conversation?.assistantMessageTask;
2974
+ if (!canTriggerAssistant) {
2975
+ return;
2976
+ }
2977
+ const conversationFlow = this.dynamicFlowService.conversationFlowConfig();
2978
+ if (!conversationFlow)
2979
+ return;
2980
+ const dynamicFlowTask = conversationFlow.triggerTasks.onAssistantMessage;
2981
+ console.log('Trigger:', dynamicFlowTask);
2982
+ if (dynamicFlowTask && message.messageId) {
2983
+ const messageId = message.messageId;
2984
+ // const contextMessages = this.contextEngineService.getContextMessages(this.messagesStateService.getMessagesSignal()(), ContextType.LastAssistantMessage);
2985
+ // i cant override task in trigger.
2986
+ const task = dynamicFlowTask.task + ' Here is the text: ' + (message.text || message.content);
2987
+ const result = await this.evaluationService.evaluateWithTask({ model: dynamicFlowTask.model, task });
2988
+ console.log('Assistant trigger evaluation result:', result);
2989
+ message.evaluation = result;
2990
+ this.messagesStateService.updateMessage(messageId, message);
2991
+ }
2992
+ }
2977
2993
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.1.6", ngImport: i0, type: DynamicFlowTaskService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
2978
2994
  static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.1.6", ngImport: i0, type: DynamicFlowTaskService }); }
2979
2995
  }
@@ -3062,12 +3078,23 @@ class ConversationService {
3062
3078
  if (!mergedFlow.triggerTasks) {
3063
3079
  mergedFlow.triggerTasks = {};
3064
3080
  }
3065
- mergedFlow.triggerTasks.onUserMessage = agentFlow?.triggerTasks?.onUserMessage?.task
3066
- ? agentFlow.triggerTasks.onUserMessage
3067
- : defaultFlow.triggerTasks?.onUserMessage;
3068
- mergedFlow.triggerTasks.onAssistantMessage = agentFlow?.triggerTasks?.onAssistantMessage?.task
3069
- ? agentFlow.triggerTasks.onAssistantMessage
3070
- : defaultFlow.triggerTasks?.onAssistantMessage;
3081
+ if (agentFlow?.triggerTasks?.onUserMessage?.disableFeature) {
3082
+ // just setting to null disables de feature, this is is card demands.
3083
+ mergedFlow.triggerTasks.onUserMessage = null;
3084
+ }
3085
+ else {
3086
+ mergedFlow.triggerTasks.onUserMessage = agentFlow?.triggerTasks?.onUserMessage?.task
3087
+ ? agentFlow.triggerTasks.onUserMessage
3088
+ : defaultFlow.triggerTasks?.onUserMessage;
3089
+ }
3090
+ if (agentFlow?.triggerTasks?.onAssistantMessage?.disableFeature) {
3091
+ mergedFlow.triggerTasks.onAssistantMessage = null;
3092
+ }
3093
+ else {
3094
+ mergedFlow.triggerTasks.onAssistantMessage = agentFlow?.triggerTasks?.onAssistantMessage?.task
3095
+ ? agentFlow.triggerTasks.onAssistantMessage
3096
+ : defaultFlow.triggerTasks?.onAssistantMessage;
3097
+ }
3071
3098
  return mergedFlow;
3072
3099
  }
3073
3100
  async initConversationWithSettings(conversationSettings, conversationFlow) {
@@ -3109,7 +3136,7 @@ class ConversationService {
3109
3136
  if (messageIndex !== -1) {
3110
3137
  conversationSettings.messages[messageIndex] = processedMessage;
3111
3138
  }
3112
- this.dynamicFlowTaskService.evaluateAssistantTaskTrigger(firstAssistantMsg);
3139
+ this.dynamicFlowTaskService.triggerAfterAssistantMessage(firstAssistantMsg);
3113
3140
  }
3114
3141
  else if (conversationSettings?.autoStart) {
3115
3142
  // Auto-start conversation if configured and no assistant message is present.
@@ -3160,7 +3187,7 @@ class ConversationService {
3160
3187
  this.isThinkingSignal.set(true);
3161
3188
  let assistantMessageId = null;
3162
3189
  // Trigger are asyn Run triggers in background
3163
- this.dynamicFlowTaskService.evaluateUserTaskTrigger({ messageId: userMessageId, role: ChatRole.User });
3190
+ this.dynamicFlowTaskService.triggerAfterUserMessage({ messageId: userMessageId, role: ChatRole.User });
3164
3191
  try {
3165
3192
  assistantMessageId = await this.requestAssistantConversationResponse();
3166
3193
  }
@@ -3212,11 +3239,7 @@ class ConversationService {
3212
3239
  this.messagesStateService.addMessage(newMessage);
3213
3240
  this.isThinkingSignal.set(false);
3214
3241
  // Run Dynamic Flow Evaluations
3215
- this.dynamicFlowTaskService.evaluateAssistantTaskTrigger(newMessage); // Not waiting should be parallel.
3216
- // this.dynamicCriteriaService.evaluateUsingTools();
3217
- if (this.dynamicFlowService.conversationFlowConfig()?.moodState.enabled) {
3218
- this.dynamicFlowService.syncMoodToLatestMessage(newMessage.messageId);
3219
- }
3242
+ this.dynamicFlowTaskService.triggerAfterAssistantMessage(newMessage); // Not waiting should be parallel.
3220
3243
  return newMessage.messageId;
3221
3244
  }
3222
3245
  // Reset conversation
@@ -4666,9 +4689,8 @@ class DCChatComponent {
4666
4689
  this.chatEvent.emit({ type: ChatEventType.AudioStarted, payload: message });
4667
4690
  }
4668
4691
  });
4669
- // Effect to watch for mood changes
4670
- effect(() => {
4671
- const mood = this.chatMonitorService.currentMood();
4692
+ // Subscribe to mood updates
4693
+ this.moodSubscription = this.conversationFlowStateService.moodUpdated$.subscribe((mood) => {
4672
4694
  if (mood) {
4673
4695
  this.chatEvent.emit({ type: ChatEventType.MoodDetected, payload: mood });
4674
4696
  }
@@ -4693,6 +4715,7 @@ class DCChatComponent {
4693
4715
  // Mark conversation as destroyed to prevent async operations
4694
4716
  this.conversationService.setDestroyed(true);
4695
4717
  this.chatMonitorService.cleanMonitorVars();
4718
+ this.moodSubscription?.unsubscribe();
4696
4719
  // Ensure the microphone is stopped when the chat component is destroyed
4697
4720
  this.chatFooterComponent?.stopMic();
4698
4721
  this.evaluationService.analylizePerformance();
@@ -4739,11 +4762,11 @@ class DCChatComponent {
4739
4762
  this.goalCompleted.emit();
4740
4763
  }
4741
4764
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.1.6", ngImport: i0, type: DCChatComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
4742
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "20.1.6", type: DCChatComponent, isStandalone: true, selector: "dc-chat", inputs: { chatUserSettings: { classPropertyName: "chatUserSettings", publicName: "chatUserSettings", isSignal: false, isRequired: false, transformFunction: null }, conversationSettings: { classPropertyName: "conversationSettings", publicName: "conversationSettings", isSignal: false, isRequired: false, transformFunction: null }, conversationFlow: { classPropertyName: "conversationFlow", publicName: "conversationFlow", isSignal: false, isRequired: false, transformFunction: null }, agentCard: { classPropertyName: "agentCard", publicName: "agentCard", isSignal: false, isRequired: false, transformFunction: null }, parseDict: { classPropertyName: "parseDict", publicName: "parseDict", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { chatEvent: "chatEvent", goalCompleted: "goalCompleted" }, providers: [ConversationService, AIGenerationService, EvaluationService, DynamicFlowTaskService, ConversationInfoService, ChatMonitorService], viewQueries: [{ propertyName: "chatFooterComponent", first: true, predicate: ChatFooterComponent, descendants: true }], ngImport: i0, template: "<div class=\"chat-container\">\n <dc-chat-header\n [agentCard]=\"agentCard\"\n (showInfoEvent)=\"showInfo()\"\n (settingsClickEvent)=\"changeUserChatSettings()\"\n (restartConversationEvent)=\"restartConversation($event)\"\n (completeEvent)=\"complete()\">\n </dc-chat-header>\n\n <dc-chat-messages-list [chatUserSettings]=\"chatUserSettings\"> </dc-chat-messages-list>\n\n <dc-chat-footer [micSettings]=\"micSettings\"> </dc-chat-footer>\n</div>\n", styles: ["::ng-deep .p-drawer-content{padding:0!important}::ng-deep .p-dialog-content{display:contents}.chat-container{display:flex;flex-direction:column;height:100%;max-height:100vh;overflow:hidden;background-color:transparent}dc-chat-messages-list{flex:1;overflow-y:auto;padding:.5rem}.score-container{padding:.5rem 1rem;background-color:var(--surface-card, #ffffff);border-top:1px solid var(--surface-border, #dee2e6)}.info-content{max-height:70vh;overflow-y:auto;padding:1rem}.info-content h3{margin-top:1rem;margin-bottom:.5rem;font-size:1.2rem}.info-content pre{background-color:var(--surface-hover, #f1f1f1);padding:1rem;border-radius:4px;overflow-x:auto;font-size:.9rem}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "component", type: ChatHeaderComponent, selector: "dc-chat-header", inputs: ["alternativeConversation", "agentCard"], outputs: ["restartConversationEvent", "showInfoEvent", "settingsClickEvent"] }, { kind: "component", type: ChatFooterComponent, selector: "dc-chat-footer", inputs: ["isAIThinking", "micSettings"], outputs: ["sendMessage", "textInputChanged"] }, { kind: "component", type: ChatMessagesListComponent, selector: "dc-chat-messages-list", inputs: ["chatUserSettings"] }, { kind: "ngmodule", type: ProgressBarModule }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
4765
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "20.1.6", type: DCChatComponent, isStandalone: true, selector: "dc-chat", inputs: { chatUserSettings: { classPropertyName: "chatUserSettings", publicName: "chatUserSettings", isSignal: false, isRequired: false, transformFunction: null }, conversationSettings: { classPropertyName: "conversationSettings", publicName: "conversationSettings", isSignal: false, isRequired: false, transformFunction: null }, conversationFlow: { classPropertyName: "conversationFlow", publicName: "conversationFlow", isSignal: false, isRequired: false, transformFunction: null }, agentCard: { classPropertyName: "agentCard", publicName: "agentCard", isSignal: false, isRequired: false, transformFunction: null }, parseDict: { classPropertyName: "parseDict", publicName: "parseDict", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { chatEvent: "chatEvent", goalCompleted: "goalCompleted" }, providers: [ConversationService, AIGenerationService, EvaluationService, DynamicFlowTaskService, ConversationInfoService], viewQueries: [{ propertyName: "chatFooterComponent", first: true, predicate: ChatFooterComponent, descendants: true }], ngImport: i0, template: "<div class=\"chat-container\">\n <dc-chat-header\n [agentCard]=\"agentCard\"\n (showInfoEvent)=\"showInfo()\"\n (settingsClickEvent)=\"changeUserChatSettings()\"\n (restartConversationEvent)=\"restartConversation($event)\"\n (completeEvent)=\"complete()\">\n </dc-chat-header>\n\n <dc-chat-messages-list [chatUserSettings]=\"chatUserSettings\"> </dc-chat-messages-list>\n\n <dc-chat-footer [micSettings]=\"micSettings\"> </dc-chat-footer>\n</div>\n", styles: ["::ng-deep .p-drawer-content{padding:0!important}::ng-deep .p-dialog-content{display:contents}.chat-container{display:flex;flex-direction:column;height:100%;max-height:100vh;overflow:hidden;background-color:transparent}dc-chat-messages-list{flex:1;overflow-y:auto;padding:.5rem}.score-container{padding:.5rem 1rem;background-color:var(--surface-card, #ffffff);border-top:1px solid var(--surface-border, #dee2e6)}.info-content{max-height:70vh;overflow-y:auto;padding:1rem}.info-content h3{margin-top:1rem;margin-bottom:.5rem;font-size:1.2rem}.info-content pre{background-color:var(--surface-hover, #f1f1f1);padding:1rem;border-radius:4px;overflow-x:auto;font-size:.9rem}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "component", type: ChatHeaderComponent, selector: "dc-chat-header", inputs: ["alternativeConversation", "agentCard"], outputs: ["restartConversationEvent", "showInfoEvent", "settingsClickEvent"] }, { kind: "component", type: ChatFooterComponent, selector: "dc-chat-footer", inputs: ["isAIThinking", "micSettings"], outputs: ["sendMessage", "textInputChanged"] }, { kind: "component", type: ChatMessagesListComponent, selector: "dc-chat-messages-list", inputs: ["chatUserSettings"] }, { kind: "ngmodule", type: ProgressBarModule }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
4743
4766
  }
4744
4767
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.6", ngImport: i0, type: DCChatComponent, decorators: [{
4745
4768
  type: Component,
4746
- args: [{ selector: 'dc-chat', standalone: true, imports: [CommonModule, ChatHeaderComponent, ChatFooterComponent, ChatMessagesListComponent, ProgressBarModule], changeDetection: ChangeDetectionStrategy.OnPush, providers: [ConversationService, AIGenerationService, EvaluationService, DynamicFlowTaskService, ConversationInfoService, ChatMonitorService], template: "<div class=\"chat-container\">\n <dc-chat-header\n [agentCard]=\"agentCard\"\n (showInfoEvent)=\"showInfo()\"\n (settingsClickEvent)=\"changeUserChatSettings()\"\n (restartConversationEvent)=\"restartConversation($event)\"\n (completeEvent)=\"complete()\">\n </dc-chat-header>\n\n <dc-chat-messages-list [chatUserSettings]=\"chatUserSettings\"> </dc-chat-messages-list>\n\n <dc-chat-footer [micSettings]=\"micSettings\"> </dc-chat-footer>\n</div>\n", styles: ["::ng-deep .p-drawer-content{padding:0!important}::ng-deep .p-dialog-content{display:contents}.chat-container{display:flex;flex-direction:column;height:100%;max-height:100vh;overflow:hidden;background-color:transparent}dc-chat-messages-list{flex:1;overflow-y:auto;padding:.5rem}.score-container{padding:.5rem 1rem;background-color:var(--surface-card, #ffffff);border-top:1px solid var(--surface-border, #dee2e6)}.info-content{max-height:70vh;overflow-y:auto;padding:1rem}.info-content h3{margin-top:1rem;margin-bottom:.5rem;font-size:1.2rem}.info-content pre{background-color:var(--surface-hover, #f1f1f1);padding:1rem;border-radius:4px;overflow-x:auto;font-size:.9rem}\n"] }]
4769
+ args: [{ selector: 'dc-chat', standalone: true, imports: [CommonModule, ChatHeaderComponent, ChatFooterComponent, ChatMessagesListComponent, ProgressBarModule], changeDetection: ChangeDetectionStrategy.OnPush, providers: [ConversationService, AIGenerationService, EvaluationService, DynamicFlowTaskService, ConversationInfoService], template: "<div class=\"chat-container\">\n <dc-chat-header\n [agentCard]=\"agentCard\"\n (showInfoEvent)=\"showInfo()\"\n (settingsClickEvent)=\"changeUserChatSettings()\"\n (restartConversationEvent)=\"restartConversation($event)\"\n (completeEvent)=\"complete()\">\n </dc-chat-header>\n\n <dc-chat-messages-list [chatUserSettings]=\"chatUserSettings\"> </dc-chat-messages-list>\n\n <dc-chat-footer [micSettings]=\"micSettings\"> </dc-chat-footer>\n</div>\n", styles: ["::ng-deep .p-drawer-content{padding:0!important}::ng-deep .p-dialog-content{display:contents}.chat-container{display:flex;flex-direction:column;height:100%;max-height:100vh;overflow:hidden;background-color:transparent}dc-chat-messages-list{flex:1;overflow-y:auto;padding:.5rem}.score-container{padding:.5rem 1rem;background-color:var(--surface-card, #ffffff);border-top:1px solid var(--surface-border, #dee2e6)}.info-content{max-height:70vh;overflow-y:auto;padding:1rem}.info-content h3{margin-top:1rem;margin-bottom:.5rem;font-size:1.2rem}.info-content pre{background-color:var(--surface-hover, #f1f1f1);padding:1rem;border-radius:4px;overflow-x:auto;font-size:.9rem}\n"] }]
4747
4770
  }], ctorParameters: () => [], propDecorators: { chatFooterComponent: [{
4748
4771
  type: ViewChild,
4749
4772
  args: [ChatFooterComponent]
@@ -5927,6 +5950,7 @@ class CharacterFormGroupService {
5927
5950
  modelQuality: this.fb.control(task?.modelQuality || EModelQuality.FAST),
5928
5951
  model: this.createModelFormGroup(task?.model),
5929
5952
  enabled: this.fb.control(task?.enabled ?? false),
5953
+ disableFeature: this.fb.control(false),
5930
5954
  });
5931
5955
  }
5932
5956
  createDynamicCriteriaFormGroup(criteria) {
@@ -6019,11 +6043,11 @@ class AgentTaskFormComponent {
6019
6043
  this.shortForm = false; // is short means AITask else SimpleAgentTask AiTaks is shorter
6020
6044
  }
6021
6045
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.1.6", ngImport: i0, type: AgentTaskFormComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
6022
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.1.6", type: AgentTaskFormComponent, isStandalone: true, selector: "agent-task-form", inputs: { formGroup: "formGroup", shortForm: "shortForm" }, ngImport: i0, template: "<div [formGroup]=\"formGroup\" class=\"space-y-6 p-4\">\n @if(formGroup.controls?.task) {\n <div class=\"form-field\">\n <div> <p-checkbox id=\"enabled\" [formControl]=\"formGroup.controls.enabled\" binary=\"true\" class=\"w-full\" /> Activada </div>\n\n <label for=\"task\" class=\"block text-sm font-medium text-gray-700\">Descripci\u00F3n de la evaluaci\u00F3n para el objetivo</label>\n\n <textarea pTextarea [autoResize]=\"true\" class=\"w-full\" [formControl]=\"formGroup.controls?.task\"></textarea>\n </div>\n } @if(!shortForm && formGroup.controls?.expectedResponseType) {\n <div class=\"form-field\">\n <label for=\"expectedResponseType\" class=\"block text-sm font-medium text-gray-700\">Expected Response Type</label>\n <input pInputText id=\"expectedResponseType\" type=\"text\" [formControl]=\"formGroup.controls?.expectedResponseType\" class=\"w-full\" />\n </div>\n } @if (formGroup.controls?.model) {\n\n <dc-model-selector [modelForm]=\"formGroup.controls.model\" [shortForm]=\"shortForm\"></dc-model-selector>\n } @if (!shortForm && formGroup.controls?.systemPrompt) {\n <div class=\"form-field\">\n <label for=\"systemPrompt\" class=\"block text-sm font-medium text-gray-700 mb-1\">System Prompt</label>\n <input pInputText id=\"systemPrompt\" [formControl]=\"formGroup.controls?.systemPrompt\" class=\"w-full\" />\n </div>\n }\n</div>\n", styles: [":host{display:block}.form-field{margin:0}\n"], dependencies: [{ kind: "ngmodule", type: TextareaModule }, { kind: "directive", type: i3.Textarea, selector: "[pTextarea], [pInputTextarea]", inputs: ["autoResize", "pSize", "variant", "fluid", "invalid"], outputs: ["onResize"] }, { kind: "ngmodule", type: InputTextModule }, { kind: "directive", type: i3$3.InputText, selector: "[pInputText]", inputs: ["pSize", "variant", "fluid", "invalid"] }, { kind: "ngmodule", type: ReactiveFormsModule }, { kind: "directive", type: i1$1.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { kind: "directive", type: i1$1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1$1.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i1$1.FormControlDirective, selector: "[formControl]", inputs: ["formControl", "disabled", "ngModel"], outputs: ["ngModelChange"], exportAs: ["ngForm"] }, { kind: "directive", type: i1$1.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "ngmodule", type: SelectModule }, { kind: "component", type: ModelSelectorComponent, selector: "dc-model-selector", inputs: ["modelForm", "shortForm"] }, { kind: "ngmodule", type: CheckboxModule }, { kind: "component", type: i4.Checkbox, selector: "p-checkbox, p-checkBox, p-check-box", inputs: ["value", "binary", "ariaLabelledBy", "ariaLabel", "tabindex", "inputId", "inputStyle", "styleClass", "inputClass", "indeterminate", "formControl", "checkboxIcon", "readonly", "autofocus", "trueValue", "falseValue", "variant", "size"], outputs: ["onChange", "onFocus", "onBlur"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
6046
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.1.6", type: AgentTaskFormComponent, isStandalone: true, selector: "agent-task-form", inputs: { formGroup: "formGroup", shortForm: "shortForm" }, ngImport: i0, template: "<div [formGroup]=\"formGroup\" class=\"space-y-6 p-4\">\n @if(formGroup.controls?.task) {\n <div class=\"form-field\">\n <div class=\"flex space-x-4\">\n <div> <p-checkbox id=\"enabled\" [formControl]=\"formGroup.controls.enabled\" binary=\"true\" /> Activada </div>\n\n <div> <p-checkbox id=\"enabled\" [formControl]=\"formGroup.controls.disableFeature\" binary=\"true\" /> Disable Feature </div>\n </div>\n\n <label for=\"task\" class=\"block text-sm font-medium text-gray-700\">Descripci\u00F3n de la evaluaci\u00F3n para el objetivo</label>\n\n <textarea pTextarea [autoResize]=\"true\" class=\"w-full\" [formControl]=\"formGroup.controls?.task\"></textarea>\n </div>\n } @if(!shortForm && formGroup.controls?.expectedResponseType) {\n <div class=\"form-field\">\n <label for=\"expectedResponseType\" class=\"block text-sm font-medium text-gray-700\">Expected Response Type</label>\n <input pInputText id=\"expectedResponseType\" type=\"text\" [formControl]=\"formGroup.controls?.expectedResponseType\" class=\"w-full\" />\n </div>\n } @if (formGroup.controls?.model) {\n\n <dc-model-selector [modelForm]=\"formGroup.controls.model\" [shortForm]=\"shortForm\"></dc-model-selector>\n } @if (!shortForm && formGroup.controls?.systemPrompt) {\n <div class=\"form-field\">\n <label for=\"systemPrompt\" class=\"block text-sm font-medium text-gray-700 mb-1\">System Prompt</label>\n <input pInputText id=\"systemPrompt\" [formControl]=\"formGroup.controls?.systemPrompt\" class=\"w-full\" />\n </div>\n }\n</div>\n", styles: [":host{display:block}.form-field{margin:0}\n"], dependencies: [{ kind: "ngmodule", type: TextareaModule }, { kind: "directive", type: i3.Textarea, selector: "[pTextarea], [pInputTextarea]", inputs: ["autoResize", "pSize", "variant", "fluid", "invalid"], outputs: ["onResize"] }, { kind: "ngmodule", type: InputTextModule }, { kind: "directive", type: i3$3.InputText, selector: "[pInputText]", inputs: ["pSize", "variant", "fluid", "invalid"] }, { kind: "ngmodule", type: ReactiveFormsModule }, { kind: "directive", type: i1$1.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { kind: "directive", type: i1$1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1$1.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i1$1.FormControlDirective, selector: "[formControl]", inputs: ["formControl", "disabled", "ngModel"], outputs: ["ngModelChange"], exportAs: ["ngForm"] }, { kind: "directive", type: i1$1.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "ngmodule", type: SelectModule }, { kind: "component", type: ModelSelectorComponent, selector: "dc-model-selector", inputs: ["modelForm", "shortForm"] }, { kind: "ngmodule", type: CheckboxModule }, { kind: "component", type: i4.Checkbox, selector: "p-checkbox, p-checkBox, p-check-box", inputs: ["value", "binary", "ariaLabelledBy", "ariaLabel", "tabindex", "inputId", "inputStyle", "styleClass", "inputClass", "indeterminate", "formControl", "checkboxIcon", "readonly", "autofocus", "trueValue", "falseValue", "variant", "size"], outputs: ["onChange", "onFocus", "onBlur"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
6023
6047
  }
6024
6048
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.6", ngImport: i0, type: AgentTaskFormComponent, decorators: [{
6025
6049
  type: Component,
6026
- args: [{ selector: 'agent-task-form', imports: [TextareaModule, InputTextModule, ReactiveFormsModule, SelectModule, ModelSelectorComponent, ModelSelectorComponent, CheckboxModule], changeDetection: ChangeDetectionStrategy.OnPush, template: "<div [formGroup]=\"formGroup\" class=\"space-y-6 p-4\">\n @if(formGroup.controls?.task) {\n <div class=\"form-field\">\n <div> <p-checkbox id=\"enabled\" [formControl]=\"formGroup.controls.enabled\" binary=\"true\" class=\"w-full\" /> Activada </div>\n\n <label for=\"task\" class=\"block text-sm font-medium text-gray-700\">Descripci\u00F3n de la evaluaci\u00F3n para el objetivo</label>\n\n <textarea pTextarea [autoResize]=\"true\" class=\"w-full\" [formControl]=\"formGroup.controls?.task\"></textarea>\n </div>\n } @if(!shortForm && formGroup.controls?.expectedResponseType) {\n <div class=\"form-field\">\n <label for=\"expectedResponseType\" class=\"block text-sm font-medium text-gray-700\">Expected Response Type</label>\n <input pInputText id=\"expectedResponseType\" type=\"text\" [formControl]=\"formGroup.controls?.expectedResponseType\" class=\"w-full\" />\n </div>\n } @if (formGroup.controls?.model) {\n\n <dc-model-selector [modelForm]=\"formGroup.controls.model\" [shortForm]=\"shortForm\"></dc-model-selector>\n } @if (!shortForm && formGroup.controls?.systemPrompt) {\n <div class=\"form-field\">\n <label for=\"systemPrompt\" class=\"block text-sm font-medium text-gray-700 mb-1\">System Prompt</label>\n <input pInputText id=\"systemPrompt\" [formControl]=\"formGroup.controls?.systemPrompt\" class=\"w-full\" />\n </div>\n }\n</div>\n", styles: [":host{display:block}.form-field{margin:0}\n"] }]
6050
+ args: [{ selector: 'agent-task-form', imports: [TextareaModule, InputTextModule, ReactiveFormsModule, SelectModule, ModelSelectorComponent, ModelSelectorComponent, CheckboxModule], changeDetection: ChangeDetectionStrategy.OnPush, template: "<div [formGroup]=\"formGroup\" class=\"space-y-6 p-4\">\n @if(formGroup.controls?.task) {\n <div class=\"form-field\">\n <div class=\"flex space-x-4\">\n <div> <p-checkbox id=\"enabled\" [formControl]=\"formGroup.controls.enabled\" binary=\"true\" /> Activada </div>\n\n <div> <p-checkbox id=\"enabled\" [formControl]=\"formGroup.controls.disableFeature\" binary=\"true\" /> Disable Feature </div>\n </div>\n\n <label for=\"task\" class=\"block text-sm font-medium text-gray-700\">Descripci\u00F3n de la evaluaci\u00F3n para el objetivo</label>\n\n <textarea pTextarea [autoResize]=\"true\" class=\"w-full\" [formControl]=\"formGroup.controls?.task\"></textarea>\n </div>\n } @if(!shortForm && formGroup.controls?.expectedResponseType) {\n <div class=\"form-field\">\n <label for=\"expectedResponseType\" class=\"block text-sm font-medium text-gray-700\">Expected Response Type</label>\n <input pInputText id=\"expectedResponseType\" type=\"text\" [formControl]=\"formGroup.controls?.expectedResponseType\" class=\"w-full\" />\n </div>\n } @if (formGroup.controls?.model) {\n\n <dc-model-selector [modelForm]=\"formGroup.controls.model\" [shortForm]=\"shortForm\"></dc-model-selector>\n } @if (!shortForm && formGroup.controls?.systemPrompt) {\n <div class=\"form-field\">\n <label for=\"systemPrompt\" class=\"block text-sm font-medium text-gray-700 mb-1\">System Prompt</label>\n <input pInputText id=\"systemPrompt\" [formControl]=\"formGroup.controls?.systemPrompt\" class=\"w-full\" />\n </div>\n }\n</div>\n", styles: [":host{display:block}.form-field{margin:0}\n"] }]
6027
6051
  }], propDecorators: { formGroup: [{
6028
6052
  type: Input
6029
6053
  }], shortForm: [{
@@ -7160,21 +7184,19 @@ class DcAgentCardDetailsComponent {
7160
7184
  this.route = inject(ActivatedRoute);
7161
7185
  this.toastService = inject(TOAST_ALERTS_TOKEN);
7162
7186
  this.chatMonitorService = inject(ChatMonitorService);
7187
+ this.conversationFlowStateService = inject(ConversationFlowStateService);
7163
7188
  this.userService = inject(UserService);
7164
7189
  this.videoPlayerService = inject(VideoPlayerService);
7165
7190
  this.agentCardId = '';
7166
7191
  this.onStartConversation = output();
7167
7192
  this.agentCard = signal(undefined, ...(ngDevMode ? [{ debugName: "agentCard" }] : []));
7168
7193
  this.showInfoLayer = signal(false, ...(ngDevMode ? [{ debugName: "showInfoLayer" }] : []));
7169
- effect(() => {
7170
- const mood = this.chatMonitorService.currentMood();
7194
+ this.moodSubscription = this.conversationFlowStateService.moodUpdated$.subscribe((mood) => {
7171
7195
  const card = this.agentCard();
7172
7196
  if (mood && card?.assets?.motions) {
7173
- const motions = mood
7174
- .map((currentMood) => card.assets.motions.find((m) => m.metadata?.moodState === currentMood)?.url)
7175
- .filter((url) => !!url);
7176
- if (motions.length > 0) {
7177
- this.videoPlayerService.addVideosToQueue(motions);
7197
+ const motionUrl = card.assets.motions.find((m) => m.metadata?.moodState === mood)?.url;
7198
+ if (motionUrl) {
7199
+ this.videoPlayerService.addVideosToQueue([motionUrl]);
7178
7200
  this.videoPlayerService.playAndRewind();
7179
7201
  }
7180
7202
  }
@@ -7189,6 +7211,7 @@ class DcAgentCardDetailsComponent {
7189
7211
  ngOnDestroy() {
7190
7212
  this.videoPlayerService.cleanUp();
7191
7213
  this.chatMonitorService.setBackground(undefined);
7214
+ this.moodSubscription?.unsubscribe();
7192
7215
  }
7193
7216
  ngAfterViewInit() {
7194
7217
  if (this.videoPlayer) {