@dataclouder/ngx-agent-cards 0.0.85 → 0.0.86

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.
Files changed (21) hide show
  1. package/fesm2022/dataclouder-ngx-agent-cards.mjs +968 -366
  2. package/fesm2022/dataclouder-ngx-agent-cards.mjs.map +1 -1
  3. package/lib/components/audio-text-sync/audio-text-sync.component.d.ts +42 -0
  4. package/lib/components/chat/dc-chat.component.d.ts +2 -2
  5. package/lib/components/chat-container/chat-container.component.d.ts +66 -0
  6. package/lib/components/{chat → chat-container}/chat-header/chat-header.component.d.ts +2 -1
  7. package/lib/components/{chat-message → chat-container/chat-messages-list/chat-message}/chat-message.component.d.ts +10 -5
  8. package/lib/components/{chat-message → chat-container/chat-messages-list/chat-message}/chat-message.utils.d.ts +1 -1
  9. package/lib/components/{chat-message → chat-container/chat-messages-list/chat-message}/message-content/message-content.component.d.ts +5 -9
  10. package/lib/components/{chat-message → chat-container/chat-messages-list/chat-message}/multi-message-content/multi-message-content.d.ts +11 -1
  11. package/lib/components/chat-container/chat-messages-list/chat-messages-list.component.d.ts +13 -0
  12. package/lib/components/dc-agent-form/dc-agent-card-form.component.d.ts +1 -1
  13. package/lib/components/icons/icon-map.d.ts +0 -3
  14. package/lib/models/agent.models.d.ts +10 -13
  15. package/lib/services/audio-text-sync.service.d.ts +25 -15
  16. package/lib/services/conversation.service.d.ts +31 -0
  17. package/lib/services/evaluation.service.d.ts +17 -0
  18. package/lib/services/message-processing.service.d.ts +11 -0
  19. package/package.json +1 -1
  20. package/public-api.d.ts +2 -1
  21. /package/lib/components/{chat → chat-container}/chat-footer/chat-footer.component.d.ts +0 -0
@@ -0,0 +1,42 @@
1
+ import { ChangeDetectorRef, EventEmitter, OnInit } from '@angular/core';
2
+ import { HighlightedWord } from '../../services/audio-text-sync.service';
3
+ import { MessageAudio } from '../../models/agent.models';
4
+ import { AudioTextSyncService } from '../../services/audio-text-sync.service';
5
+ import * as i0 from "@angular/core";
6
+ export declare class AudioTextSyncComponent implements OnInit {
7
+ private cdr;
8
+ private audioTextSyncService;
9
+ message: MessageAudio;
10
+ isLoading: boolean;
11
+ playAudio: EventEmitter<MessageAudio>;
12
+ highlightedWords: import("@angular/core").WritableSignal<HighlightedWord[]>;
13
+ private messageId;
14
+ private injector;
15
+ constructor(cdr: ChangeDetectorRef, audioTextSyncService: AudioTextSyncService);
16
+ /**
17
+ * Check if the message has transcription timestamps
18
+ */
19
+ get hasTranscription(): boolean;
20
+ /**
21
+ * Get the message text content
22
+ */
23
+ get messageText(): string;
24
+ /**
25
+ * Track function for ngFor to improve performance
26
+ * @param index The current item's index
27
+ * @param item The current item
28
+ */
29
+ trackByIndex(index: number, item: any): number;
30
+ ngOnInit(): void;
31
+ /**
32
+ * Generate a unique ID for this message instance
33
+ * Uses message content/text and a timestamp to ensure uniqueness
34
+ */
35
+ private generateMessageId;
36
+ /**
37
+ * Emit event to play the audio message
38
+ */
39
+ onPlayMessage(): void;
40
+ static ɵfac: i0.ɵɵFactoryDeclaration<AudioTextSyncComponent, never>;
41
+ static ɵcmp: i0.ɵɵComponentDeclaration<AudioTextSyncComponent, "dc-audio-text-sync", never, { "message": { "alias": "message"; "required": false; }; "isLoading": { "alias": "isLoading"; "required": false; }; }, { "playAudio": "playAudio"; }, never, never, true, never>;
42
+ }
@@ -24,13 +24,14 @@ export declare class DCChatComponent implements OnInit {
24
24
  messages: ChatMessage[];
25
25
  imageUser: string;
26
26
  thinkingImg: string;
27
+ aiIcon: string;
27
28
  isDestroyed: boolean;
28
29
  score: number;
29
30
  isAdmin: boolean;
31
+ isInfoVisible: boolean;
30
32
  isChatSettingsVisible: boolean;
31
33
  isAIThinking: boolean;
32
34
  isUserTalking: boolean;
33
- aiIcon: string;
34
35
  user: any;
35
36
  isGettingTranscription: boolean;
36
37
  private defaultVoice;
@@ -49,7 +50,6 @@ export declare class DCChatComponent implements OnInit {
49
50
  playMessage(message: ChatMessage): void;
50
51
  subsItalicsByTag(text: any, voiceId?: string, tagName?: string): any;
51
52
  private processMultiMessages;
52
- isInfoVisible: boolean;
53
53
  showInfo(): void;
54
54
  restartConversation(conversation?: IAgentCard): Promise<void>;
55
55
  private evaluateConversation;
@@ -0,0 +1,66 @@
1
+ import { EventEmitter, OnInit, OnDestroy } from '@angular/core';
2
+ import { DialogService } from 'primeng/dynamicdialog';
3
+ import { ToastAlertsAbstractService } from '@dataclouder/ngx-core';
4
+ import { MicSettings } from '@dataclouder/ngx-mic';
5
+ import { ChatUserSettings, IAgentCard, IMiniAgentCard, ChatMessage } from '../../models/agent.models';
6
+ import { AgentCardsAbstractService } from '../../models/conversation-ai.class';
7
+ import { DCConversationPromptBuilderService } from '../../services/dc-conversation-builder.service';
8
+ import { ConversationService } from '../../services/conversation.service';
9
+ import { EvaluationService } from '../../services/evaluation.service';
10
+ import * as i0 from "@angular/core";
11
+ export declare class ChatContainerComponent implements OnInit, OnDestroy {
12
+ private agentCardService;
13
+ private toastService;
14
+ private conversationBuilder;
15
+ private dialogService;
16
+ private conversationService;
17
+ private evaluationService;
18
+ chatUserSettings: ChatUserSettings;
19
+ agentCard: IAgentCard;
20
+ evaluatorAgentCard: IMiniAgentCard;
21
+ parseDict: {
22
+ [key: string]: string;
23
+ };
24
+ sendMessage: EventEmitter<string>;
25
+ micSettings: MicSettings;
26
+ imageUser: string;
27
+ thinkingImg: string;
28
+ aiIcon: string;
29
+ isInfoVisible: boolean;
30
+ isChatSettingsVisible: boolean;
31
+ isUserTalking: boolean;
32
+ isGettingTranscription: boolean;
33
+ isAdmin: boolean;
34
+ messages: import("@angular/core").Signal<ChatMessage[]>;
35
+ isThinking: import("@angular/core").Signal<boolean>;
36
+ score: import("@angular/core").Signal<number>;
37
+ constructor(agentCardService: AgentCardsAbstractService, toastService: ToastAlertsAbstractService, conversationBuilder: DCConversationPromptBuilderService, dialogService: DialogService, conversationService: ConversationService, evaluationService: EvaluationService);
38
+ ngOnInit(): Promise<void>;
39
+ ngOnDestroy(): void;
40
+ /**
41
+ * Handle user message from chat footer
42
+ */
43
+ onUserMessage(message: ChatMessage): Promise<void>;
44
+ /**
45
+ * Handle microphone input finished
46
+ */
47
+ onMicFinished(eventBlob: any): Promise<void>;
48
+ /**
49
+ * Open chat settings dialog
50
+ */
51
+ changeUserChatSettings(): void;
52
+ /**
53
+ * Show debug info
54
+ */
55
+ showInfo(): void;
56
+ /**
57
+ * Restart conversation
58
+ */
59
+ restartConversation(conversation?: IAgentCard | null): Promise<void>;
60
+ /**
61
+ * Evaluate conversation using evaluator agent
62
+ */
63
+ private evaluateConversation;
64
+ static ɵfac: i0.ɵɵFactoryDeclaration<ChatContainerComponent, never>;
65
+ static ɵcmp: i0.ɵɵComponentDeclaration<ChatContainerComponent, "dc-chat", never, { "chatUserSettings": { "alias": "chatUserSettings"; "required": false; }; "agentCard": { "alias": "agentCard"; "required": false; }; "evaluatorAgentCard": { "alias": "evaluatorAgentCard"; "required": false; }; "parseDict": { "alias": "parseDict"; "required": false; }; }, { "sendMessage": "sendMessage"; }, never, never, true, never>;
66
+ }
@@ -6,6 +6,7 @@ export declare class ChatHeaderComponent {
6
6
  private agentCardService;
7
7
  isAdmin: boolean;
8
8
  alternativeConversation: IAgentCard[];
9
+ agentCard: IAgentCard;
9
10
  restartConversationEvent: EventEmitter<IAgentCard>;
10
11
  showInfoEvent: EventEmitter<void>;
11
12
  settingsClickEvent: EventEmitter<void>;
@@ -15,5 +16,5 @@ export declare class ChatHeaderComponent {
15
16
  settingsClick(): void;
16
17
  changeConversationCard(): Promise<void>;
17
18
  static ɵfac: i0.ɵɵFactoryDeclaration<ChatHeaderComponent, never>;
18
- static ɵcmp: i0.ɵɵComponentDeclaration<ChatHeaderComponent, "dc-chat-header", never, { "isAdmin": { "alias": "isAdmin"; "required": false; }; "alternativeConversation": { "alias": "alternativeConversation"; "required": false; }; }, { "restartConversationEvent": "restartConversationEvent"; "showInfoEvent": "showInfoEvent"; "settingsClickEvent": "settingsClickEvent"; }, never, never, true, never>;
19
+ static ɵcmp: i0.ɵɵComponentDeclaration<ChatHeaderComponent, "dc-chat-header", never, { "isAdmin": { "alias": "isAdmin"; "required": false; }; "alternativeConversation": { "alias": "alternativeConversation"; "required": false; }; "agentCard": { "alias": "agentCard"; "required": false; }; }, { "restartConversationEvent": "restartConversationEvent"; "showInfoEvent": "showInfoEvent"; "settingsClickEvent": "settingsClickEvent"; }, never, never, true, never>;
19
20
  }
@@ -1,8 +1,8 @@
1
1
  import { OnInit, WritableSignal } from '@angular/core';
2
- import { ChatMessage, ChatMultiMessage, ChatUserSettings } from '../../models/agent.models';
3
- import { AgentCardsAbstractService } from '../../models/conversation-ai.class';
4
- import { AudioService } from '../../services/audio.service';
5
- import { AudioTextSyncService } from '../../services/audio-text-sync.service';
2
+ import { ChatMessage, ChatMultiMessage, ChatUserSettings, MessageAudio } from '../../../../models/agent.models';
3
+ import { AgentCardsAbstractService } from '../../../../models/conversation-ai.class';
4
+ import { AudioService } from '../../../../services/audio.service';
5
+ import { AudioTextSyncService } from '../../../../services/audio-text-sync.service';
6
6
  import * as i0 from "@angular/core";
7
7
  export declare class ChatMessageComponent implements OnInit {
8
8
  private audioService;
@@ -16,7 +16,12 @@ export declare class ChatMessageComponent implements OnInit {
16
16
  constructor(audioService: AudioService, agentCardService: AgentCardsAbstractService, audioTextSyncService: AudioTextSyncService);
17
17
  ngOnInit(): Promise<void>;
18
18
  generateAndPlayAudio(message: ChatMessage, overwriteText?: string | null): Promise<void>;
19
- playMessage(message: ChatMessage | ChatMultiMessage): HTMLAudioElement | null;
19
+ playMessage(message: MessageAudio): HTMLAudioElement | null;
20
+ /**
21
+ * Generate a unique ID for a message
22
+ * Uses message content/text and a timestamp to ensure uniqueness
23
+ */
24
+ private generateMessageId;
20
25
  generateAndPlayAllAudios(multiMessages: ChatMultiMessage[]): void;
21
26
  private preloadNextMessageAudio;
22
27
  private buildObjectTTSRequest;
@@ -1,3 +1,3 @@
1
- import { AudioGenerated, ChatMessage, ChatMultiMessage } from '../../models/agent.models';
1
+ import { AudioGenerated, ChatMessage, ChatMultiMessage } from '../../../../models/agent.models';
2
2
  export declare function matchTranscription(originalText: string, transcription: any[]): any[];
3
3
  export declare function extractAudioAndTranscription(message: ChatMessage | ChatMultiMessage, audio: AudioGenerated): void;
@@ -1,15 +1,11 @@
1
- import { ChangeDetectorRef, EventEmitter, OnInit } from '@angular/core';
2
- import { ChatMessage, ChatMultiMessage } from '../../../models/agent.models';
3
- import { AudioTextSyncService } from '../../../services/audio-text-sync.service';
1
+ import { EventEmitter, OnInit } from '@angular/core';
2
+ import { MessageAudio } from '../../../../../models/agent.models';
4
3
  import * as i0 from "@angular/core";
5
4
  export declare class MessageContentComponent implements OnInit {
6
- private cdr;
7
- private audioTextSyncService;
8
- message: ChatMessage | ChatMultiMessage;
5
+ message: MessageAudio;
9
6
  isLoading: boolean;
10
- playAudio: EventEmitter<ChatMultiMessage | ChatMessage>;
11
- highlightedWords: import("@angular/core").Signal<import("../../../services/audio-text-sync.service").HighlightedWord[]>;
12
- constructor(cdr: ChangeDetectorRef, audioTextSyncService: AudioTextSyncService);
7
+ playAudio: EventEmitter<MessageAudio>;
8
+ constructor();
13
9
  get hasTranscription(): boolean;
14
10
  get messageText(): string;
15
11
  get messageTag(): string | string[] | Set<string> | {
@@ -1,10 +1,20 @@
1
1
  import { EventEmitter, OnInit } from '@angular/core';
2
- import { ChatMultiMessage } from '../../../models/agent.models';
2
+ import { ChatMultiMessage } from '../../../../../models/agent.models';
3
3
  import * as i0 from "@angular/core";
4
4
  export declare class MultiMessageContentComponent implements OnInit {
5
5
  messages: ChatMultiMessage[];
6
6
  isLoading: boolean;
7
7
  playAudio: EventEmitter<ChatMultiMessage>;
8
+ constructor();
9
+ /**
10
+ * Checks if a message has transcription timestamps
11
+ * @param message The message to check
12
+ */
13
+ hasTranscription(message: ChatMultiMessage): boolean;
14
+ /**
15
+ * Emits the playAudio event with the selected message
16
+ * @param message The message to play
17
+ */
8
18
  onPlayMessage(message: ChatMultiMessage): void;
9
19
  ngOnInit(): void;
10
20
  static ɵfac: i0.ɵɵFactoryDeclaration<MultiMessageContentComponent, never>;
@@ -0,0 +1,13 @@
1
+ import { ChatMessage, ChatUserSettings } from '../../../models/agent.models';
2
+ import * as i0 from "@angular/core";
3
+ export declare class ChatMessagesListComponent {
4
+ chatUserSettings: ChatUserSettings;
5
+ thinkingImg: string;
6
+ aiIcon: string;
7
+ private conversationService;
8
+ messages: import("@angular/core").Signal<ChatMessage[]>;
9
+ isThinking: import("@angular/core").Signal<boolean>;
10
+ trackByMessage(index: number, message: ChatMessage): string;
11
+ static ɵfac: i0.ɵɵFactoryDeclaration<ChatMessagesListComponent, never>;
12
+ static ɵcmp: i0.ɵɵComponentDeclaration<ChatMessagesListComponent, "dc-chat-messages-list", never, { "chatUserSettings": { "alias": "chatUserSettings"; "required": false; }; "thinkingImg": { "alias": "thinkingImg"; "required": false; }; }, {}, never, never, true, never>;
13
+ }
@@ -121,5 +121,5 @@ export declare class DCAgentCardFormComponent implements OnInit {
121
121
  private extractJsonFromResponse;
122
122
  removeSticker(sticker: any): Promise<void>;
123
123
  static ɵfac: i0.ɵɵFactoryDeclaration<DCAgentCardFormComponent, [null, null, null, null, null, null, null, null, { optional: true; }]>;
124
- static ɵcmp: i0.ɵɵComponentDeclaration<DCAgentCardFormComponent, "dc-conversation-form", never, { "storageSettings": { "alias": "storageSettings"; "required": false; }; "bannerImgSettings": { "alias": "bannerImgSettings"; "required": false; }; "imageStorageSettings": { "alias": "imageStorageSettings"; "required": false; }; }, { "onImageLoaded": "onImageLoaded"; "onSave": "onSave"; "onGoDetails": "onGoDetails"; "onTranslate": "onTranslate"; }, never, never, true, never>;
124
+ static ɵcmp: i0.ɵɵComponentDeclaration<DCAgentCardFormComponent, "dc-agent-form", never, { "storageSettings": { "alias": "storageSettings"; "required": false; }; "bannerImgSettings": { "alias": "bannerImgSettings"; "required": false; }; "imageStorageSettings": { "alias": "imageStorageSettings"; "required": false; }; }, { "onImageLoaded": "onImageLoaded"; "onSave": "onSave"; "onGoDetails": "onGoDetails"; "onTranslate": "onTranslate"; }, never, never, true, never>;
125
125
  }
@@ -1,9 +1,6 @@
1
1
  export declare const ICONS: {
2
- readonly gear: "<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\" width=\"24\" height=\"24\" fill=\"currentColor\">\n <path d=\"M12 1.75a1.25 1.25 0 0 1 1.25 1.25v.917a8.456 8.456 0 0 1 2.334.98l.645-.647a1.25 1.25 0 1 1 1.768 1.768l-.646.645c.389.69.729 1.437.98 2.334h.917a1.25 1.25 0 0 1 0 2.5h-.917a8.456 8.456 0 0 1-.98 2.334l.646.645a1.25 1.25 0 1 1-1.768 1.768l-.645-.646a8.456 8.456 0 0 1-2.334.98v.917a1.25 1.25 0 0 1-2.5 0v-.917a8.456 8.456 0 0 1-2.334-.98l-.645.646a1.25 1.25 0 1 1-1.768-1.768l.646-.645a8.456 8.456 0 0 1-.98-2.334H1.75a1.25 1.25 0 0 1 0-2.5h.917a8.456 8.456 0 0 1 .98-2.334l-.646-.645a1.25 1.25 0 1 1 1.768-1.768l.645.647c.69-.389 1.437-.729 2.334-.98V3a1.25 1.25 0 0 1 1.25-1.25h.083ZM12 7.5a4.5 4.5 0 1 0 0 9 4.5 4.5 0 0 0 0-9Z\"/>\n </svg>\n ";
3
2
  readonly chat: "<svg viewBox=\"0 0 24 24\" fill=\"currentColor\">\n <path d=\"M20 2H4c-1.1 0-2 .9-2 2v18l4-4h14c...\" />\n </svg>";
4
3
  readonly play: "<svg\n xmlns=\"http://www.w3.org/2000/svg\"\n width=\"16\"\n height=\"16\"\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"#263042\"\n stroke-width=\"2\"\n stroke-linecap=\"round\"\n stroke-linejoin=\"round\">\n <circle cx=\"12\" cy=\"12\" r=\"10\"></circle>\n <polygon points=\"10 8 16 12 10 16 10 8\"></polygon>\n </svg>";
5
4
  readonly loading: "<svg\n xmlns=\"http://www.w3.org/2000/svg\"\n width=\"16\"\n height=\"16\"\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"#263042\"\n stroke-width=\"2\"\n stroke-linecap=\"round\"\n stroke-linejoin=\"round\">\n <line x1=\"12\" y1=\"2\" x2=\"12\" y2=\"6\"></line>\n <line x1=\"12\" y1=\"18\" x2=\"12\" y2=\"22\"></line>\n <line x1=\"4.93\" y1=\"4.93\" x2=\"7.76\" y2=\"7.76\"></line>\n <line x1=\"16.24\" y1=\"16.24\" x2=\"19.07\" y2=\"19.07\"></line>\n <line x1=\"2\" y1=\"12\" x2=\"6\" y2=\"12\"></line>\n <line x1=\"18\" y1=\"12\" x2=\"22\" y2=\"12\"></line>\n <line x1=\"4.93\" y1=\"19.07\" x2=\"7.76\" y2=\"16.24\"></line>\n <line x1=\"16.24\" y1=\"7.76\" x2=\"19.07\" y2=\"4.93\"></line>\n </svg>";
6
- readonly user: "<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\">\n <!-- Head circle -->\n <circle cx=\"12\" cy=\"8\" r=\"4\" fill=\"currentColor\"/>\n \n <!-- Body shape -->\n <path d=\"M20 19v1a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2v-1c0-3.87 3.13-7 7-7h2c3.87 0 7 3.13 7 7z\" fill=\"currentColor\"/>\n</svg>";
7
- readonly ai: "<svg \n xmlns=\"http://www.w3.org/2000/svg\" \n viewBox=\"0 0 100 100\" \n width=\"100\" \n height=\"100\" \n fill=\"none\" \n stroke=\"black\" \n stroke-width=\"2\"\n>\n <!-- Brain outline -->\n <path \n d=\"M50 10\n C60 10, 70 20, 70 30\n S60 50, 50 50\n S30 40, 30 30\n S40 10, 50 10Z\"\n fill=\"#B3E5FC\"\n />\n \n <!-- Circuit lines -->\n <line x1=\"50\" y1=\"50\" x2=\"50\" y2=\"70\" stroke=\"#0288D1\" stroke-width=\"2\" />\n <line x1=\"50\" y1=\"70\" x2=\"40\" y2=\"80\" stroke=\"#0288D1\" stroke-width=\"2\" />\n <line x1=\"50\" y1=\"70\" x2=\"60\" y2=\"80\" stroke=\"#0288D1\" stroke-width=\"2\" />\n \n <!-- Nodes -->\n <circle cx=\"50\" cy=\"70\" r=\"2\" fill=\"#0288D1\" />\n <circle cx=\"40\" cy=\"80\" r=\"3\" fill=\"#0288D1\" />\n <circle cx=\"60\" cy=\"80\" r=\"3\" fill=\"#0288D1\" />\n</svg>\n";
8
5
  };
9
6
  export type IconName = keyof typeof ICONS;
@@ -50,6 +50,7 @@ export interface IConversationSettings {
50
50
  last_prompt?: string;
51
51
  voice?: string;
52
52
  secondaryVoice?: string;
53
+ repeatRecording?: boolean;
53
54
  }
54
55
  export type IConversationSettingsDTO = Pick<IConversationSettings, 'messages' | 'textEngine' | 'conversationType'> & {
55
56
  model?: IAIModel;
@@ -109,15 +110,17 @@ export declare class WordTimestamps {
109
110
  end: number;
110
111
  highlighted: boolean;
111
112
  }
112
- export declare class ChatMultiMessage {
113
- voice: string;
114
- content: string;
115
- text: string;
116
- audioUrl: string;
117
- audioPromise: any;
113
+ export declare class MessageAudio {
114
+ audioUrl?: string;
115
+ audioPromise?: any;
118
116
  isLoading?: boolean;
119
117
  transcription?: any;
120
118
  transcriptionTimestamps?: WordTimestamps[];
119
+ text?: string;
120
+ content?: string;
121
+ voice?: string;
122
+ }
123
+ export declare class ChatMultiMessage extends MessageAudio {
121
124
  tag: string | string[] | Set<string> | {
122
125
  [klass: string]: any;
123
126
  };
@@ -128,20 +131,14 @@ export declare enum ChatRole {
128
131
  Assistant = "assistant",
129
132
  AssistantHelper = "assistantHelper"
130
133
  }
131
- export declare class ChatMessage {
132
- content: string;
134
+ export declare class ChatMessage extends MessageAudio {
133
135
  role: ChatRole;
134
136
  ssml?: string;
135
- text?: string;
136
137
  translation?: string;
137
- audioUrl?: string;
138
138
  audioHtml?: HTMLAudioElement;
139
139
  promisePlay?: any;
140
140
  stats?: any;
141
141
  multiMessages?: ChatMultiMessage[];
142
- transcription?: TranscriptionsWhisper;
143
- transcriptionTimestamps?: WordTimestamps[];
144
- voice?: string;
145
142
  }
146
143
  export declare class ChatUserSettings {
147
144
  realTime: boolean;
@@ -8,40 +8,50 @@ export interface HighlightedWord {
8
8
  isHighlighted: boolean;
9
9
  }
10
10
  export declare class AudioTextSyncService {
11
- private highlightedWordsSignal;
12
- private highlightedWords$;
13
- private cleanup$;
14
- private activeAudio;
11
+ private highlightedWordsSignalMap;
12
+ private highlightedWords$Map;
13
+ private cleanup$Map;
14
+ private activeAudioMap;
15
15
  private destroyRef;
16
16
  constructor();
17
17
  /**
18
18
  * Synchronizes audio playback with text transcription
19
19
  * @param audioElement The audio element to sync with
20
20
  * @param transcriptionTimestamps Array of word timestamps
21
+ * @param messageId Unique identifier for the message
21
22
  */
22
- syncAudioWithText(audioElement: HTMLAudioElement, transcriptionTimestamps: WordTimestamps[]): void;
23
+ syncAudioWithText(audioElement: HTMLAudioElement, transcriptionTimestamps: WordTimestamps[], messageId: string): void;
23
24
  /**
24
- * Stops the current sync and cleans up resources
25
+ * Stops the sync for a specific message and cleans up resources
26
+ * @param messageId The ID of the message to stop syncing
25
27
  */
26
- stopSync(): void;
28
+ stopSync(messageId: string): void;
27
29
  /**
28
- * Returns the current highlighted words as a signal
30
+ * Stops all syncs and cleans up all resources
29
31
  */
30
- getHighlightedWordsSignal(): Signal<HighlightedWord[]>;
32
+ stopAllSyncs(): void;
31
33
  /**
32
- * Returns the current highlighted words as an observable
34
+ * Returns the highlighted words signal for a specific message
35
+ * @param messageId The ID of the message
33
36
  */
34
- getHighlightedWords$(): Observable<HighlightedWord[]>;
37
+ getHighlightedWordsSignal(messageId: string): Signal<HighlightedWord[]>;
35
38
  /**
36
- * Checks if a word at a specific index is currently highlighted
39
+ * Returns the highlighted words observable for a specific message
40
+ * @param messageId The ID of the message
41
+ */
42
+ getHighlightedWords$(messageId: string): Observable<HighlightedWord[]>;
43
+ /**
44
+ * Checks if a word at a specific index is currently highlighted for a specific message
45
+ * @param messageId The ID of the message
37
46
  * @param index The index of the word to check
38
47
  */
39
- isWordHighlighted(index: number): boolean;
48
+ isWordHighlighted(messageId: string, index: number): boolean;
40
49
  /**
41
- * Returns an observable that emits true when a word at a specific index is highlighted
50
+ * Returns an observable that emits true when a word at a specific index is highlighted for a specific message
51
+ * @param messageId The ID of the message
42
52
  * @param index The index of the word to observe
43
53
  */
44
- isWordHighlighted$(index: number): Observable<boolean>;
54
+ isWordHighlighted$(messageId: string, index: number): Observable<boolean>;
45
55
  static ɵfac: i0.ɵɵFactoryDeclaration<AudioTextSyncService, never>;
46
56
  static ɵprov: i0.ɵɵInjectableDeclaration<AudioTextSyncService>;
47
57
  }
@@ -0,0 +1,31 @@
1
+ import { Signal } from '@angular/core';
2
+ import { ChatMessage, IAgentCard, IAgentResponseDTO, IConversationSettings } from '../models/agent.models';
3
+ import { AgentCardsAbstractService } from '../models/conversation-ai.class';
4
+ import { MessageProcessingService } from './message-processing.service';
5
+ import * as i0 from "@angular/core";
6
+ export declare class ConversationService {
7
+ private agentCardService;
8
+ private messageProcessingService;
9
+ private messagesSignal;
10
+ private isThinkingSignal;
11
+ private conversationSettingsSignal;
12
+ private agentCardSignal;
13
+ private isDestroyedSignal;
14
+ constructor(agentCardService: AgentCardsAbstractService, messageProcessingService: MessageProcessingService);
15
+ getMessages(): Signal<ChatMessage[]>;
16
+ isThinking(): Signal<boolean>;
17
+ getConversationSettings(): Signal<IConversationSettings | null>;
18
+ getAgentCard(): Signal<IAgentCard | null>;
19
+ setDestroyed(value: boolean): void;
20
+ initConversation(agentCard: IAgentCard, conversationBuilder: any, parseDict?: {
21
+ [key: string]: string;
22
+ }): Promise<void>;
23
+ sendUserMessage(message: ChatMessage): Promise<void>;
24
+ addMessage(message: ChatMessage): void;
25
+ processAssistantMessage(message: IAgentResponseDTO | ChatMessage, mutate?: boolean): ChatMessage;
26
+ sendCurrentConversation(): Promise<void>;
27
+ private getAudioPlaybackSetting;
28
+ resetConversation(agentCard?: IAgentCard): Promise<void>;
29
+ static ɵfac: i0.ɵɵFactoryDeclaration<ConversationService, never>;
30
+ static ɵprov: i0.ɵɵInjectableDeclaration<ConversationService>;
31
+ }
@@ -0,0 +1,17 @@
1
+ import { Signal } from '@angular/core';
2
+ import { ChatMessage, IMiniAgentCard } from '../models/agent.models';
3
+ import { AgentCardsAbstractService } from '../models/conversation-ai.class';
4
+ import * as i0 from "@angular/core";
5
+ export declare class EvaluationService {
6
+ private agentCardService;
7
+ private scoreSignal;
8
+ private evaluationResultSignal;
9
+ constructor(agentCardService: AgentCardsAbstractService);
10
+ getScore(): Signal<number>;
11
+ getEvaluationResult(): Signal<any>;
12
+ evaluateConversation(messages: ChatMessage[], evaluator: IMiniAgentCard): Promise<void>;
13
+ private updateScore;
14
+ resetScore(): void;
15
+ static ɵfac: i0.ɵɵFactoryDeclaration<EvaluationService, never>;
16
+ static ɵprov: i0.ɵɵInjectableDeclaration<EvaluationService>;
17
+ }
@@ -0,0 +1,11 @@
1
+ import { ChatMessage, IAgentResponseDTO, IConversationSettings } from '../models/agent.models';
2
+ import * as i0 from "@angular/core";
3
+ export declare class MessageProcessingService {
4
+ constructor();
5
+ processMessage(message: IAgentResponseDTO | ChatMessage, conversationSettings: IConversationSettings, mutate?: boolean): ChatMessage;
6
+ private processMultiMessages;
7
+ subsItalicsByTag(text: string, voiceId?: string, tagName?: string): string;
8
+ getVoice(voice_value: string, targetLang?: string): string;
9
+ static ɵfac: i0.ɵɵFactoryDeclaration<MessageProcessingService, never>;
10
+ static ɵprov: i0.ɵɵInjectableDeclaration<MessageProcessingService>;
11
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dataclouder/ngx-agent-cards",
3
- "version": "0.0.85",
3
+ "version": "0.0.86",
4
4
  "peerDependencies": {
5
5
  "@angular/common": ">=18.0.0",
6
6
  "@angular/core": ">=18.0.0",
package/public-api.d.ts CHANGED
@@ -3,7 +3,7 @@ export * from './lib/models/conversation-ai.class';
3
3
  export * from './lib/models/conversation-enums';
4
4
  export * from './lib/services/audio.service';
5
5
  export * from './lib/services/dc-conversation-builder.service';
6
- export * from './lib/components/chat-message/chat-message.component';
6
+ export * from './lib/components/chat-container/chat-container.component';
7
7
  export * from './lib/components/chat/dc-chat.component';
8
8
  export * from './lib/components/dc-agent-form/dc-agent-card-form.component';
9
9
  export * from './lib/components/dc-agent-card-lists/dc-agent-card-lists.component';
@@ -13,3 +13,4 @@ export * from './lib/models/user-data-exchange';
13
13
  export * from './lib/components/dc-agent-card-lists/dc-agent-card-lists.component';
14
14
  export * from './lib/components/provider-selector/provider-selector.component';
15
15
  export * from './lib/models/agent.utils';
16
+ export * from './lib/components/chat-container/chat-container.component';