@dataclouder/ngx-agent-cards 0.1.78 → 0.1.81
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.
|
@@ -3330,16 +3330,39 @@ const BACKGROUND_SERVICE_TOKEN = new InjectionToken('BACKGROUND_SERVICE_TOKEN');
|
|
|
3330
3330
|
|
|
3331
3331
|
class VideoPlayerService {
|
|
3332
3332
|
constructor() {
|
|
3333
|
+
this.conversationFlowStateService = inject(ConversationFlowStateService);
|
|
3333
3334
|
this.isRewinding = false;
|
|
3334
3335
|
this.videoQueue = [];
|
|
3335
3336
|
this.defaultVideoUrl = null;
|
|
3336
3337
|
this.playAndRewindedSource = new Subject();
|
|
3337
3338
|
this.playAndRewinded$ = this.playAndRewindedSource.asObservable();
|
|
3339
|
+
this.agentCard = signal(undefined, ...(ngDevMode ? [{ debugName: "agentCard" }] : []));
|
|
3340
|
+
console.log(' CONSTRUCTOR FOR VIDEO PLAYER...');
|
|
3338
3341
|
this.playAndRewindedSubscription = this.playAndRewinded$.subscribe(() => {
|
|
3339
3342
|
this.playNextInQueue();
|
|
3340
3343
|
});
|
|
3344
|
+
this.moodSubscription = this.conversationFlowStateService.moodUpdated$.subscribe((mood) => {
|
|
3345
|
+
console.log('CHANGING MOOD.. ', mood);
|
|
3346
|
+
const card = this.agentCard();
|
|
3347
|
+
if (mood && card?.assets?.motions) {
|
|
3348
|
+
const motionUrl = card.assets.motions.find((m) => m.metadata?.moodState === mood)?.url;
|
|
3349
|
+
if (motionUrl) {
|
|
3350
|
+
this.addVideosToQueue([motionUrl]);
|
|
3351
|
+
this.playAndRewind();
|
|
3352
|
+
}
|
|
3353
|
+
}
|
|
3354
|
+
});
|
|
3355
|
+
}
|
|
3356
|
+
setAgentCard(card) {
|
|
3357
|
+
this.agentCard.set(card);
|
|
3358
|
+
if (card.assets?.motion?.url) {
|
|
3359
|
+
this.setVideoSource(card.assets.motion.url);
|
|
3360
|
+
}
|
|
3341
3361
|
}
|
|
3342
3362
|
initializePlayer(videoPlayer) {
|
|
3363
|
+
if (this.player) {
|
|
3364
|
+
this.player.destroy();
|
|
3365
|
+
}
|
|
3343
3366
|
this.player = new Plyr.default(videoPlayer.nativeElement, {
|
|
3344
3367
|
controls: [],
|
|
3345
3368
|
});
|
|
@@ -3362,9 +3385,17 @@ class VideoPlayerService {
|
|
|
3362
3385
|
}
|
|
3363
3386
|
}
|
|
3364
3387
|
startConversation(defaultVideo) {
|
|
3388
|
+
debugger;
|
|
3365
3389
|
if (defaultVideo) {
|
|
3366
3390
|
this.defaultVideoUrl = defaultVideo;
|
|
3367
|
-
|
|
3391
|
+
}
|
|
3392
|
+
else {
|
|
3393
|
+
this.defaultVideoUrl = this.agentCard()?.assets?.motion?.url || null;
|
|
3394
|
+
}
|
|
3395
|
+
const introMotion = this.agentCard()?.assets?.motions?.find((m) => m.metadata?.event === 'intro');
|
|
3396
|
+
if (introMotion?.url) {
|
|
3397
|
+
this.addVideosToQueue([introMotion.url]);
|
|
3398
|
+
this.playAndRewind();
|
|
3368
3399
|
}
|
|
3369
3400
|
}
|
|
3370
3401
|
playVideo() {
|
|
@@ -3404,6 +3435,7 @@ class VideoPlayerService {
|
|
|
3404
3435
|
}
|
|
3405
3436
|
}
|
|
3406
3437
|
addVideosToQueue(videoUrls) {
|
|
3438
|
+
console.log('ADING VIDEOS TO QUEUE, ', videoUrls);
|
|
3407
3439
|
this.videoQueue.push(...videoUrls);
|
|
3408
3440
|
}
|
|
3409
3441
|
destroyPlayer() {
|
|
@@ -3424,11 +3456,15 @@ class VideoPlayerService {
|
|
|
3424
3456
|
this.isRewinding = false;
|
|
3425
3457
|
this.videoQueue = [];
|
|
3426
3458
|
this.defaultVideoUrl = null;
|
|
3459
|
+
this.agentCard.set(undefined);
|
|
3427
3460
|
}
|
|
3428
3461
|
ngOnDestroy() {
|
|
3429
3462
|
if (this.playAndRewindedSubscription) {
|
|
3430
3463
|
this.playAndRewindedSubscription.unsubscribe();
|
|
3431
3464
|
}
|
|
3465
|
+
if (this.moodSubscription) {
|
|
3466
|
+
this.moodSubscription.unsubscribe();
|
|
3467
|
+
}
|
|
3432
3468
|
}
|
|
3433
3469
|
playNextInQueue() {
|
|
3434
3470
|
if (this.videoQueue.length > 0) {
|
|
@@ -7191,16 +7227,6 @@ class DcAgentCardDetailsComponent {
|
|
|
7191
7227
|
this.onStartConversation = output();
|
|
7192
7228
|
this.agentCard = signal(undefined, ...(ngDevMode ? [{ debugName: "agentCard" }] : []));
|
|
7193
7229
|
this.showInfoLayer = signal(false, ...(ngDevMode ? [{ debugName: "showInfoLayer" }] : []));
|
|
7194
|
-
this.moodSubscription = this.conversationFlowStateService.moodUpdated$.subscribe((mood) => {
|
|
7195
|
-
const card = this.agentCard();
|
|
7196
|
-
if (mood && card?.assets?.motions) {
|
|
7197
|
-
const motionUrl = card.assets.motions.find((m) => m.metadata?.moodState === mood)?.url;
|
|
7198
|
-
if (motionUrl) {
|
|
7199
|
-
this.videoPlayerService.addVideosToQueue([motionUrl]);
|
|
7200
|
-
this.videoPlayerService.playAndRewind();
|
|
7201
|
-
}
|
|
7202
|
-
}
|
|
7203
|
-
});
|
|
7204
7230
|
effect(() => {
|
|
7205
7231
|
const isConversationActive = this.chatMonitorService.isConversationActive();
|
|
7206
7232
|
if (isConversationActive) {
|
|
@@ -7211,7 +7237,6 @@ class DcAgentCardDetailsComponent {
|
|
|
7211
7237
|
ngOnDestroy() {
|
|
7212
7238
|
this.videoPlayerService.cleanUp();
|
|
7213
7239
|
this.chatMonitorService.setBackground(undefined);
|
|
7214
|
-
this.moodSubscription?.unsubscribe();
|
|
7215
7240
|
}
|
|
7216
7241
|
ngAfterViewInit() {
|
|
7217
7242
|
if (this.videoPlayer) {
|
|
@@ -7236,9 +7261,7 @@ class DcAgentCardDetailsComponent {
|
|
|
7236
7261
|
card.conversationSettings = {};
|
|
7237
7262
|
}
|
|
7238
7263
|
this.agentCard.set(card);
|
|
7239
|
-
|
|
7240
|
-
this.videoPlayerService.setVideoSource(card.assets.motion.url);
|
|
7241
|
-
}
|
|
7264
|
+
this.videoPlayerService.setAgentCard(card);
|
|
7242
7265
|
if (card.assets.banner?.url) {
|
|
7243
7266
|
this.chatMonitorService.setBackground(card.assets.banner.url);
|
|
7244
7267
|
}
|
|
@@ -7274,13 +7297,7 @@ class DcAgentCardDetailsComponent {
|
|
|
7274
7297
|
return [locale.replace('_', '-'), ...newVoiceParts].join('-');
|
|
7275
7298
|
}
|
|
7276
7299
|
startConversation() {
|
|
7277
|
-
|
|
7278
|
-
this.videoPlayerService.startConversation(defaultVideoUrl);
|
|
7279
|
-
const introMotion = this.agentCard()?.assets?.motions?.find((m) => m.metadata?.event === 'intro');
|
|
7280
|
-
if (introMotion?.url) {
|
|
7281
|
-
this.videoPlayerService.addVideosToQueue([introMotion.url]);
|
|
7282
|
-
this.videoPlayerService.playAndRewind();
|
|
7283
|
-
}
|
|
7300
|
+
this.videoPlayerService.startConversation();
|
|
7284
7301
|
const targetLang = this.userService.getTargetLanguage();
|
|
7285
7302
|
const translation = this.agentCard()?.characterCard?.data?.langTranslation?.[targetLang];
|
|
7286
7303
|
if (this.agentCard()?.lang === targetLang) {
|
|
@@ -7670,5 +7687,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.6", ngImpor
|
|
|
7670
7687
|
* Generated bundle index. Do not edit.
|
|
7671
7688
|
*/
|
|
7672
7689
|
|
|
7673
|
-
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, 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 };
|
|
7690
|
+
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, ConversationFlowStateService, ConversationMessagesDTO, ConversationPromptBuilderService, ConversationRuleService, ConversationRulesComponent, 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 };
|
|
7674
7691
|
//# sourceMappingURL=dataclouder-ngx-agent-cards.mjs.map
|