@dataclouder/ngx-agent-cards 0.1.72 → 0.1.74

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.
package/index.d.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  import { ImgStorageData, BasicStorage, AudioStorage, IAssetable, StorageImageSettings, FileStorageData } from '@dataclouder/ngx-cloud-storage';
2
2
  import { AudioEffectType, TTSRequest } from '@dataclouder/ngx-ai-services';
3
3
  import * as _dataclouder_ngx_core from '@dataclouder/ngx-core';
4
- import { ChatUserSettings, EModelQuality, IAuditable, IAIModel, IManageable, ILearnable, EntityCommunicationService, FiltersConfig, IFilterQueryResponse, HttpCoreService, EntityBaseFormComponent, EntityBaseListComponent, ICustomFilter, PColumn, OnActionEvent, formatCamelCaseString } from '@dataclouder/ngx-core';
4
+ import { ChatUserSettings, EModelQuality, IAuditable, IAIModel, IManageable, ILearnable, EntityCommunicationService, FiltersConfig, IFilterQueryResponse, HttpCoreService, EntityBaseFormComponent, EntityBaseListV2Component, ICustomFilter, PColumn, OnActionEvent, formatCamelCaseString } from '@dataclouder/ngx-core';
5
5
  import * as _angular_forms from '@angular/forms';
6
6
  import { FormGroup, FormControl, FormArray } from '@angular/forms';
7
7
  import * as _angular_core from '@angular/core';
@@ -364,6 +364,34 @@ interface IConversationFlow {
364
364
  dynamicConditions: IDynamicCondition[];
365
365
  moodState: IMoodState;
366
366
  }
367
+ interface IChallengeState {
368
+ id: string;
369
+ completed: boolean;
370
+ progress?: number;
371
+ observation?: string;
372
+ }
373
+ interface IGoalState {
374
+ progress: number;
375
+ completed: boolean;
376
+ observation?: string;
377
+ }
378
+ interface IMoodStateRuntime {
379
+ currentMood: string;
380
+ intensity: number;
381
+ observation?: string;
382
+ }
383
+ interface IConversationFlowState {
384
+ goal: {
385
+ value: any;
386
+ };
387
+ challenges: {
388
+ name: string;
389
+ value: any;
390
+ }[];
391
+ moodState: {
392
+ value: any;
393
+ };
394
+ }
367
395
  declare enum EAgentType {
368
396
  None,
369
397
  Social = "social",
@@ -480,6 +508,9 @@ declare class ChatMessage extends MessageContent {
480
508
  imgUrl?: string;
481
509
  generatedImg?: string;
482
510
  section?: SectionType;
511
+ createdAt?: Date;
512
+ updatedAt?: Date;
513
+ attachments?: any[];
483
514
  }
484
515
  declare class ConversationMessagesDTO {
485
516
  messages?: ChatMessage[];
@@ -680,10 +711,65 @@ declare class PopupService {
680
711
  static ɵprov: _angular_core.ɵɵInjectableDeclaration<PopupService>;
681
712
  }
682
713
 
714
+ /**
715
+ * @description
716
+ * Orchestrates the dynamic aspects of a conversation based on a predefined configuration.
717
+ *
718
+ * This service is responsible for:
719
+ * - Initializing the conversation's dynamic flow with a static `IConversationFlow` configuration.
720
+ * - Holding the static configuration for reference throughout the conversation.
721
+ * - Providing access to the real-time `IConversationFlowState` managed by `ConversationFlowStateService`.
722
+ * - Evaluating dynamic conditions (e.g., goal progress) and triggering actions.
723
+ * - Applying changes to the conversation, such as updating system prompts or modifying tasks.
724
+ */
683
725
  declare class DynamicFlowService {
684
726
  private messagesStateService;
685
- conversationFlowState: _angular_core.WritableSignal<IConversationFlow>;
686
- setConversationFlow(conversationFlow: IConversationFlow): void;
727
+ private conversationFlowStateService;
728
+ /**
729
+ * @description
730
+ * A signal holding the static configuration (`IConversationFlow`) for the current chat.
731
+ * This configuration defines the rules, goals, challenges, and conditions for the dynamic flow.
732
+ */
733
+ conversationFlowConfig: _angular_core.WritableSignal<IConversationFlow>;
734
+ /**
735
+ * @description
736
+ * A direct reference to the reactive state signal from `ConversationFlowStateService`.
737
+ * This provides real-time access to the conversation's dynamic state (goal progress, challenges, mood).
738
+ */
739
+ flowState: _angular_core.WritableSignal<IConversationFlowState>;
740
+ /**
741
+ * @description
742
+ * Initializes the dynamic flow for a new conversation.
743
+ * It sets the static configuration and resets the runtime state to match.
744
+ * @param conversationFlow The static `IConversationFlow` configuration object.
745
+ */
746
+ initConversationFlow(conversationFlow: IConversationFlow): void;
747
+ /**
748
+ * @description
749
+ * Constructs a context object containing both the static configuration and the current runtime state.
750
+ * This combined context can be sent to an AI model for analysis.
751
+ * @returns An object with the flow definition and its current state.
752
+ */
753
+ getFlowContextForAI(): {
754
+ definition: IConversationFlow;
755
+ currentState: IConversationFlowState;
756
+ };
757
+ /**
758
+ * @description
759
+ * Updates the runtime state of the conversation based on analysis from an AI model.
760
+ * @param aiResponse A partial `IConversationFlowState` object from the AI.
761
+ */
762
+ updateStateFromAI(aiResponse: Partial<IConversationFlowState>): void;
763
+ syncMoodToLatestMessage(messageId?: string): void;
764
+ private getMoodEmoji;
765
+ /**
766
+ * @description
767
+ * Generates a prompt for the AI to evaluate the conversation flow and return a new state.
768
+ * This prompt includes the current state, enabled configuration instructions, and the context of the last messages.
769
+ * @param messages The full list of chat messages (used to extract context).
770
+ * @returns A string containing the prompt.
771
+ */
772
+ generateSystemPromptForFlow(messages: ChatMessage[]): string;
687
773
  changePrompt(): void;
688
774
  applyConditionChange(condition: IDynamicCondition): void;
689
775
  changeDynamicFlowTask(action: DoAction): void;
@@ -864,10 +950,9 @@ declare class EvaluationService {
864
950
  private dialogService;
865
951
  private loadingBarService;
866
952
  private userService;
867
- scoreSignal: _angular_core.WritableSignal<number>;
953
+ private conversationFlowStateService;
868
954
  private evaluationResultSignal;
869
955
  isGoalCompleted: _angular_core.WritableSignal<boolean>;
870
- evaluateGoal(goalTask: IDynamicFlowTask): Promise<any>;
871
956
  evaluateConversation(task: SimpleAgentTask, contextType?: ContextType, metaType?: string): Promise<IEvaluationResponse>;
872
957
  /**
873
958
  * Diference with evaluateConversation is task is already processed here.
@@ -878,6 +963,13 @@ declare class EvaluationService {
878
963
  * @returns The JSON result of the evaluation.
879
964
  */
880
965
  evaluateWithTask(agentTask: IDynamicFlowTask): Promise<any>;
966
+ /**
967
+ * Evaluates the dynamic flow state using a generated prompt.
968
+ * @param prompt The system/instruction prompt generated by DynamicFlowService.
969
+ * @param model The AI model to use for the evaluation.
970
+ * @returns The updated conversation flow state as a JSON object.
971
+ */
972
+ evaluateFlowState(prompt: string, model: IAIModel): Promise<any>;
881
973
  updateScore(additionalScore: number): void;
882
974
  setScore(newScore: number): void;
883
975
  private _handleScoreUpdate;
@@ -898,6 +990,7 @@ declare class DCChatComponent implements OnInit, OnDestroy {
898
990
  messageStateService: MessagesStateService;
899
991
  private chatMonitorService;
900
992
  private conversationInfoService;
993
+ private conversationFlowStateService;
901
994
  private chatFooterComponent;
902
995
  chatUserSettings: ChatUserSettings | null;
903
996
  conversationSettings: IConversationSettings;
@@ -1021,7 +1114,7 @@ declare class DCAgentCardFormComponent extends EntityBaseFormComponent<IAgentCar
1021
1114
  static ɵcmp: _angular_core.ɵɵComponentDeclaration<DCAgentCardFormComponent, "dc-agent-form", never, { "storageSettings": { "alias": "storageSettings"; "required": false; "isSignal": true; }; }, { "onSave": "onSave"; "onGoDetails": "onGoDetails"; }, never, never, true, never>;
1022
1115
  }
1023
1116
 
1024
- declare class AgentCardListComponent extends EntityBaseListComponent<IAgentCard> implements OnInit {
1117
+ declare class AgentCardListComponent extends EntityBaseListV2Component<IAgentCard> implements OnInit {
1025
1118
  extraFilters: ICustomFilter[];
1026
1119
  readonly showOptions: _angular_core.InputSignal<boolean>;
1027
1120
  readonly gridLayout: _angular_core.InputSignal<boolean>;
@@ -1036,7 +1129,6 @@ declare class AgentCardListComponent extends EntityBaseListComponent<IAgentCard>
1036
1129
  ngOnInit(): Promise<void>;
1037
1130
  handleTableAction(actionEvent: OnActionEvent): void;
1038
1131
  handleAction(actionEvent: OnActionEvent): void;
1039
- applyFilterBarEvent(filterEvent: OnActionEvent): void;
1040
1132
  static ɵfac: _angular_core.ɵɵFactoryDeclaration<AgentCardListComponent, never>;
1041
1133
  static ɵcmp: _angular_core.ɵɵComponentDeclaration<AgentCardListComponent, "dc-agent-card-lists", never, { "extraFilters": { "alias": "extraFilters"; "required": false; }; "showOptions": { "alias": "showOptions"; "required": false; "isSignal": true; }; "gridLayout": { "alias": "gridLayout"; "required": false; "isSignal": true; }; "customGetButtons": { "alias": "customGetButtons"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
1042
1134
  }
@@ -1398,4 +1490,4 @@ declare class ChatEngineTestComponent {
1398
1490
  declare const AGENT_CARDS_STATE_SERVICE: InjectionToken<MasterStateService<IAgentCard>>;
1399
1491
 
1400
1492
  export { ACCDataGenerationComponent, AGENT_CARDS_STATE_SERVICE, AIGenerationService, AgentCardListComponent, AgentCardUI, AgentCardsGenerationService, AudioService, AudioSpeed, BACKGROUND_SERVICE_TOKEN, CONVERSATION_AI_TOKEN, CardsCreatorComponent, ChatEngineTestComponent, ChatEventType, ChatMessage, ChatMessageOrchestratorComponent, ChatMonitorService, ChatRole, ConditionOperator, ConditionType, ContextEngineService, ContextType, ConversationDTO, ConversationEvents, ConversationMessagesDTO, ConversationPromptBuilderService, ConversationRuleService, ConversationRulesComponent, ConversationType$1 as ConversationType, ConversationTypeOptions, DCAgentCardFormComponent, DCChatComponent, DCConversationUserChatSettingsComponent, DcAgentCardDetailsComponent, DefaultAgentCardsService, DoActionTypeOptions, DynamicFlowService, DynamicFlowTaskTypeOptions, EAccountsPlatform, EAgentType, EDoActionType, EDynamicFlowTaskType, EntityThen, EntityWhatOptions, EntityWhenOptions, EvalResultStringDefinition, GlobalToolsService, MessageContent, MessageContentDisplayer, MessagesStateService, ModelSelectorComponent, PopupService, PromptPreviewComponent, SectionType, SystemPromptType, TextEngineOptions, TextEngines, VIDEO_PLAYER_SERVICE_TOKEN, VideoPlayerService, VoiceTTSOption, VoiceTTSOptions, WordTimestamps, buildObjectTTSRequest, characterCardStringDataDefinition, convertToHTML, createAIModelFormGroup, defaultconvUserSettings, extractAudioAndTranscription, extractJsonFromResponse, getMoodStateLabelsAsString, getMoodStatePrompt, markdownToHtml, matchTranscription, provideAgentCardService, removeEmojis, removeEmojisAndSpecialCharacters, removeSpecialCharacters };
1401
- export type { Appearance, AudioGenerated, AudioState, BackgroundTask, CardTranslation, ChangePromptAction, CharacterCardData, ChatEvent, ConversationFlowFormGroup, ConversationSettingsFormGroup, DoAction, DoActionFormGroup, DynamicConditionFormGroup, DynamicCriteriaFormGroup, IAccounts, IAgentAssets, IAgentCard, IAgentCardMeta, IAgentMetadata, IAgentResponseDTO, IBackgroundService, ICharacterCardDC, IConversationFlow, IConversationSettings, IConversationSettingsDTO, IDynamicCondition, IDynamicCriteria, IDynamicFlowTask, IGenerateConversationCardsDto, IMoodState, IRule, ISimpleAgent, ITTS, IVideoPlayerService, IWordMetadata, ModelFormGroup, ModelName, MultiLanguage, Persona, SimpleAgentTask, SimpleAgentTaskFormGroup, SimpleEvalResult, TextHTMLTag, TranscriptionsWhisper, TriggerTasksFormGroup, VoiceCloning, VoiceTTS, WordData };
1493
+ export type { Appearance, AudioGenerated, AudioState, BackgroundTask, CardTranslation, ChangePromptAction, CharacterCardData, ChatEvent, ConversationFlowFormGroup, ConversationSettingsFormGroup, DoAction, DoActionFormGroup, DynamicConditionFormGroup, DynamicCriteriaFormGroup, IAccounts, IAgentAssets, IAgentCard, IAgentCardMeta, IAgentMetadata, IAgentResponseDTO, IBackgroundService, IChallengeState, ICharacterCardDC, IConversationFlow, IConversationFlowState, IConversationSettings, IConversationSettingsDTO, IDynamicCondition, IDynamicCriteria, IDynamicFlowTask, IGenerateConversationCardsDto, IGoalState, IMoodState, IMoodStateRuntime, IRule, ISimpleAgent, ITTS, IVideoPlayerService, IWordMetadata, ModelFormGroup, ModelName, MultiLanguage, Persona, SimpleAgentTask, SimpleAgentTaskFormGroup, SimpleEvalResult, TextHTMLTag, TranscriptionsWhisper, TriggerTasksFormGroup, VoiceCloning, VoiceTTS, WordData };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dataclouder/ngx-agent-cards",
3
- "version": "0.1.72",
3
+ "version": "0.1.74",
4
4
  "peerDependencies": {
5
5
  "@angular/common": ">=18.0.0",
6
6
  "@angular/core": ">=18.0.0",