@dataclouder/ngx-agent-cards 0.0.87 → 0.0.89

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 (35) hide show
  1. package/README.md +17 -7
  2. package/fesm2022/dataclouder-ngx-agent-cards.mjs +1134 -1352
  3. package/fesm2022/dataclouder-ngx-agent-cards.mjs.map +1 -1
  4. package/lib/components/chat-container/chat-container.component.d.ts +9 -38
  5. package/lib/components/chat-container/chat-footer/chat-footer.component.d.ts +18 -10
  6. package/lib/components/chat-container/chat-header/chat-header.component.d.ts +7 -8
  7. package/lib/components/chat-container/chat-messages-list/chat-message/chat-message.component.d.ts +11 -27
  8. package/lib/components/chat-container/chat-messages-list/chat-message/chat-message.utils.d.ts +3 -2
  9. package/lib/components/chat-container/chat-messages-list/chat-messages-list.component.d.ts +3 -3
  10. package/lib/components/chat-container/chat-messages-list/message-orchestrator/message-orchestrator.component.d.ts +26 -0
  11. package/lib/components/chat-settings/dc-conversation-userchat-settings.component.d.ts +7 -8
  12. package/lib/components/dc-agent-card-details/dc-agent-card-details.component.d.ts +4 -6
  13. package/lib/components/dc-agent-card-lists/agent-card-default-ui/agent-card-default-ui.component.d.ts +5 -5
  14. package/lib/components/dc-agent-card-lists/dc-agent-card-lists.component.d.ts +9 -10
  15. package/lib/components/dc-agent-form/account-platform/account-platform-form.component.d.ts +3 -4
  16. package/lib/components/dc-agent-form/dc-agent-card-form.component.d.ts +16 -18
  17. package/lib/components/icons/icons.component.d.ts +7 -7
  18. package/lib/components/prompt-preview-dialog/prompt-preview-dialog.component.d.ts +3 -2
  19. package/lib/components/provider-selector/provider-selector.component.d.ts +3 -3
  20. package/lib/components/text-highlighter/text-highlighter.d.ts +62 -0
  21. package/lib/components/translate-dialog/translate-dialog.component.d.ts +3 -5
  22. package/lib/models/agent.models.d.ts +5 -7
  23. package/lib/models/conversation-ai.class.d.ts +2 -2
  24. package/lib/models/user-data-exchange.d.ts +2 -0
  25. package/lib/pipes/safe-json.pipe.d.ts +15 -0
  26. package/lib/services/conversation.service.d.ts +8 -14
  27. package/lib/services/dc-conversation-builder.service.d.ts +0 -2
  28. package/lib/services/evaluation.service.d.ts +2 -2
  29. package/lib/services/message-processing.service.d.ts +2 -2
  30. package/package.json +1 -1
  31. package/public-api.d.ts +4 -0
  32. package/lib/components/audio-text-sync/audio-text-sync.component.d.ts +0 -42
  33. package/lib/components/chat-container/chat-messages-list/chat-message/message-content/message-content.component.d.ts +0 -24
  34. package/lib/components/chat-container/chat-messages-list/chat-message/multi-message-content/multi-message-content.d.ts +0 -22
  35. package/lib/services/audio-text-sync.service.d.ts +0 -57
@@ -114,16 +114,14 @@ export declare class MessageAudio {
114
114
  audioUrl?: string;
115
115
  audioPromise?: any;
116
116
  isLoading?: boolean;
117
- transcription?: any;
117
+ transcription?: TranscriptionsWhisper;
118
118
  transcriptionTimestamps?: WordTimestamps[];
119
119
  text?: string;
120
120
  content?: string;
121
121
  voice?: string;
122
- }
123
- export declare class ChatMultiMessage extends MessageAudio {
124
- tag: string | string[] | Set<string> | {
125
- [klass: string]: any;
126
- };
122
+ shouldPlayAudio?: boolean;
123
+ messageId?: string | number;
124
+ tag?: string;
127
125
  }
128
126
  export declare enum ChatRole {
129
127
  System = "system",
@@ -138,7 +136,7 @@ export declare class ChatMessage extends MessageAudio {
138
136
  audioHtml?: HTMLAudioElement;
139
137
  promisePlay?: any;
140
138
  stats?: any;
141
- multiMessages?: ChatMultiMessage[];
139
+ multiMessages?: MessageAudio[];
142
140
  }
143
141
  export declare class ChatUserSettings {
144
142
  realTime: boolean;
@@ -1,6 +1,6 @@
1
1
  import { InjectionToken, Type } from '@angular/core';
2
2
  import { Provider } from '@angular/core';
3
- import { ChatUserSettings, IAgentCard, ModelName, IConversationSettingsDTO, IAgentResponseDTO } from './agent.models';
3
+ import { ChatUserSettings, IAgentCard, ModelName, IConversationSettingsDTO, IAgentResponseDTO, TTSRequest, AudioGenerated } from './agent.models';
4
4
  import { FiltersConfig, IFilterQueryResponse } from '@dataclouder/ngx-core';
5
5
  export declare const CONVERSATION_AI_TOKEN: InjectionToken<AgentCardsAbstractService>;
6
6
  export declare abstract class AgentCardsAbstractService {
@@ -16,7 +16,7 @@ export declare abstract class AgentCardsAbstractService {
16
16
  abstract findAgentCardByTitle(title: string): Promise<IAgentCard>;
17
17
  abstract saveConversationCard(conversation: IAgentCard): Promise<IAgentCard>;
18
18
  abstract deleteConversationCard(id: string): Promise<IAgentCard>;
19
- abstract getTextAudioFile(tts: any): Promise<any>;
19
+ abstract getTextAudioFile(tts: TTSRequest): Promise<AudioGenerated>;
20
20
  abstract getConversationUserChatSettings(): Promise<ChatUserSettings>;
21
21
  abstract getListModels(provider: string): Promise<ModelName[]>;
22
22
  abstract translateConversation(currentLang: string, targetLang: string, id: string): Promise<ChatUserSettings>;
@@ -1,4 +1,5 @@
1
1
  import { InjectionToken, Provider, Type } from '@angular/core';
2
+ import { ChatUserSettings } from './agent.models';
2
3
  export interface UserDataExchange {
3
4
  name: string;
4
5
  gender: string;
@@ -13,4 +14,5 @@ export declare abstract class UserDataExchangeAbstractService {
13
14
  abstract getParseDict(): {
14
15
  [key: string]: string;
15
16
  };
17
+ abstract getUserChatSettings(): ChatUserSettings;
16
18
  }
@@ -0,0 +1,15 @@
1
+ import { PipeTransform } from '@angular/core';
2
+ import * as i0 from "@angular/core";
3
+ /**
4
+ * SafeJsonPipe - A pipe that safely stringifies objects with circular references
5
+ * This pipe handles circular references and DOM objects that can't be serialized
6
+ */
7
+ export declare class SafeJsonPipe implements PipeTransform {
8
+ transform(value: any): string;
9
+ /**
10
+ * Safely stringify an object, handling circular references
11
+ */
12
+ private stringifySafely;
13
+ static ɵfac: i0.ɵɵFactoryDeclaration<SafeJsonPipe, never>;
14
+ static ɵpipe: i0.ɵɵPipeDeclaration<SafeJsonPipe, "safeJson", true>;
15
+ }
@@ -1,31 +1,25 @@
1
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';
2
+ import { AudioGenerated, ChatMessage, IAgentCard, MessageAudio } from '../models/agent.models';
5
3
  import * as i0 from "@angular/core";
6
4
  export declare class ConversationService {
7
5
  private agentCardService;
8
6
  private messageProcessingService;
7
+ private conversationBuilder;
8
+ private userDataExchange;
9
9
  private messagesSignal;
10
10
  private isThinkingSignal;
11
11
  private conversationSettingsSignal;
12
- private agentCardSignal;
13
12
  private isDestroyedSignal;
14
- constructor(agentCardService: AgentCardsAbstractService, messageProcessingService: MessageProcessingService);
15
- getMessages(): Signal<ChatMessage[]>;
13
+ getMessagesSignal(): Signal<ChatMessage[]>;
14
+ addMessage(message: ChatMessage): void;
16
15
  isThinking(): Signal<boolean>;
17
- getConversationSettings(): Signal<IConversationSettings | null>;
18
- getAgentCard(): Signal<IAgentCard | null>;
19
16
  setDestroyed(value: boolean): void;
20
- initConversation(agentCard: IAgentCard, conversationBuilder: any, parseDict?: {
21
- [key: string]: string;
22
- }): Promise<void>;
17
+ setupConversationWithAgentCard(agentCard: IAgentCard): void;
18
+ initConversation(agentCard: IAgentCard): Promise<void>;
23
19
  sendUserMessage(message: ChatMessage): Promise<void>;
24
- addMessage(message: ChatMessage): void;
25
- processAssistantMessage(message: IAgentResponseDTO | ChatMessage, mutate?: boolean): ChatMessage;
26
20
  sendCurrentConversation(): Promise<void>;
27
- private getAudioPlaybackSetting;
28
21
  resetConversation(agentCard?: IAgentCard): Promise<void>;
22
+ getTTSFile(message: MessageAudio): Promise<AudioGenerated>;
29
23
  static ɵfac: i0.ɵɵFactoryDeclaration<ConversationService, never>;
30
24
  static ɵprov: i0.ɵɵInjectableDeclaration<ConversationService>;
31
25
  }
@@ -1,9 +1,7 @@
1
1
  import { ChatMessage, IConversationSettings, IAgentCard } from '../models/agent.models';
2
- import { UserDataExchangeAbstractService } from '../models/user-data-exchange';
3
2
  import * as i0 from "@angular/core";
4
3
  export declare class DCConversationPromptBuilderService {
5
4
  private userDataExchange;
6
- constructor(userDataExchange: UserDataExchangeAbstractService);
7
5
  buildConversationSettings(agentCard: IAgentCard, parseDict?: {
8
6
  [key: string]: string;
9
7
  }): IConversationSettings;
@@ -1,12 +1,12 @@
1
1
  import { Signal } from '@angular/core';
2
2
  import { ChatMessage, IMiniAgentCard } from '../models/agent.models';
3
- import { AgentCardsAbstractService } from '../models/conversation-ai.class';
4
3
  import * as i0 from "@angular/core";
5
4
  export declare class EvaluationService {
6
5
  private agentCardService;
7
6
  private scoreSignal;
8
7
  private evaluationResultSignal;
9
- constructor(agentCardService: AgentCardsAbstractService);
8
+ /** Inserted by Angular inject() migration for backwards compatibility */
9
+ constructor(...args: unknown[]);
10
10
  getScore(): Signal<number>;
11
11
  getEvaluationResult(): Signal<any>;
12
12
  evaluateConversation(messages: ChatMessage[], evaluator: IMiniAgentCard): Promise<void>;
@@ -1,8 +1,8 @@
1
- import { ChatMessage, IAgentResponseDTO, IConversationSettings } from '../models/agent.models';
1
+ import { ChatMessage, IConversationSettings } from '../models/agent.models';
2
2
  import * as i0 from "@angular/core";
3
3
  export declare class MessageProcessingService {
4
4
  constructor();
5
- processMessage(message: IAgentResponseDTO | ChatMessage, conversationSettings: IConversationSettings, mutate?: boolean): ChatMessage;
5
+ processMessage(message: ChatMessage, conversationSettings: IConversationSettings): ChatMessage;
6
6
  private processMultiMessages;
7
7
  subsItalicsByTag(text: string, voiceId?: string, tagName?: string): string;
8
8
  getVoice(voice_value: string, targetLang?: string): string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dataclouder/ngx-agent-cards",
3
- "version": "0.0.87",
3
+ "version": "0.0.89",
4
4
  "peerDependencies": {
5
5
  "@angular/common": ">=18.0.0",
6
6
  "@angular/core": ">=18.0.0",
package/public-api.d.ts CHANGED
@@ -14,3 +14,7 @@ export * from './lib/components/provider-selector/provider-selector.component';
14
14
  export * from './lib/models/agent.utils';
15
15
  export * from './lib/components/chat-container/chat-container.component';
16
16
  export * from './lib/components/chat-container/chat.models';
17
+ export * from './lib/components/text-highlighter/text-highlighter';
18
+ export * from './lib/components/chat-container/chat-messages-list/chat-message/chat-message.utils';
19
+ export * from './lib/components/chat-container/chat-messages-list/message-orchestrator/message-orchestrator.component';
20
+ export * from './lib/components/extraction.regex';
@@ -1,42 +0,0 @@
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
- }
@@ -1,24 +0,0 @@
1
- import { EventEmitter, OnInit } from '@angular/core';
2
- import { MessageAudio } from '../../../../../models/agent.models';
3
- import * as i0 from "@angular/core";
4
- export declare class MessageContentComponent implements OnInit {
5
- message: MessageAudio;
6
- isLoading: boolean;
7
- playAudio: EventEmitter<MessageAudio>;
8
- constructor();
9
- get hasTranscription(): boolean;
10
- get messageText(): string;
11
- get messageTag(): string | string[] | Set<string> | {
12
- [klass: string]: any;
13
- } | null;
14
- onPlayMessage(): void;
15
- /**
16
- * Track function for ngFor to improve performance
17
- * @param index The current item's index
18
- * @param item The current item
19
- */
20
- trackByIndex(index: number, item: any): number;
21
- ngOnInit(): void;
22
- static ɵfac: i0.ɵɵFactoryDeclaration<MessageContentComponent, never>;
23
- static ɵcmp: i0.ɵɵComponentDeclaration<MessageContentComponent, "dc-message-content", never, { "message": { "alias": "message"; "required": false; }; "isLoading": { "alias": "isLoading"; "required": false; }; }, { "playAudio": "playAudio"; }, never, never, true, never>;
24
- }
@@ -1,22 +0,0 @@
1
- import { EventEmitter, OnInit } from '@angular/core';
2
- import { ChatMultiMessage } from '../../../../../models/agent.models';
3
- import * as i0 from "@angular/core";
4
- export declare class MultiMessageContentComponent implements OnInit {
5
- messages: ChatMultiMessage[];
6
- isLoading: boolean;
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
- */
18
- onPlayMessage(message: ChatMultiMessage): void;
19
- ngOnInit(): void;
20
- static ɵfac: i0.ɵɵFactoryDeclaration<MultiMessageContentComponent, never>;
21
- static ɵcmp: i0.ɵɵComponentDeclaration<MultiMessageContentComponent, "dc-multi-message-content", never, { "messages": { "alias": "messages"; "required": false; }; "isLoading": { "alias": "isLoading"; "required": false; }; }, { "playAudio": "playAudio"; }, never, never, true, never>;
22
- }
@@ -1,57 +0,0 @@
1
- import { Signal } from '@angular/core';
2
- import { Observable } from 'rxjs';
3
- import { WordTimestamps } from '../models/agent.models';
4
- import * as i0 from "@angular/core";
5
- export interface HighlightedWord {
6
- word: string;
7
- index: number;
8
- isHighlighted: boolean;
9
- }
10
- export declare class AudioTextSyncService {
11
- private highlightedWordsSignalMap;
12
- private highlightedWords$Map;
13
- private cleanup$Map;
14
- private activeAudioMap;
15
- private destroyRef;
16
- constructor();
17
- /**
18
- * Synchronizes audio playback with text transcription
19
- * @param audioElement The audio element to sync with
20
- * @param transcriptionTimestamps Array of word timestamps
21
- * @param messageId Unique identifier for the message
22
- */
23
- syncAudioWithText(audioElement: HTMLAudioElement, transcriptionTimestamps: WordTimestamps[], messageId: string): void;
24
- /**
25
- * Stops the sync for a specific message and cleans up resources
26
- * @param messageId The ID of the message to stop syncing
27
- */
28
- stopSync(messageId: string): void;
29
- /**
30
- * Stops all syncs and cleans up all resources
31
- */
32
- stopAllSyncs(): void;
33
- /**
34
- * Returns the highlighted words signal for a specific message
35
- * @param messageId The ID of the message
36
- */
37
- getHighlightedWordsSignal(messageId: string): Signal<HighlightedWord[]>;
38
- /**
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
46
- * @param index The index of the word to check
47
- */
48
- isWordHighlighted(messageId: string, index: number): boolean;
49
- /**
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
52
- * @param index The index of the word to observe
53
- */
54
- isWordHighlighted$(messageId: string, index: number): Observable<boolean>;
55
- static ɵfac: i0.ɵɵFactoryDeclaration<AudioTextSyncService, never>;
56
- static ɵprov: i0.ɵɵInjectableDeclaration<AudioTextSyncService>;
57
- }