@dataclouder/ngx-agent-cards 0.1.16 → 0.1.18
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/fesm2022/dataclouder-ngx-agent-cards.mjs +677 -333
- package/fesm2022/dataclouder-ngx-agent-cards.mjs.map +1 -1
- package/lib/components/chat-container/chat-container.component.d.ts +4 -1
- package/lib/components/chat-container/chat-footer/chat-footer.component.d.ts +1 -3
- package/lib/components/chat-container/chat-header/chat-header.component.d.ts +0 -1
- package/lib/components/chat-container/chat-messages-list/chat-messages-list.component.d.ts +1 -0
- package/lib/components/chat-container/chat-settings/dc-conversation-userchat-settings.component.d.ts +3 -1
- package/lib/components/dc-agent-card-details/dc-agent-card-details.component.d.ts +1 -0
- package/lib/components/dc-agent-form/dc-agent-card-form.component.d.ts +2 -0
- package/lib/components/dc-agent-form/dc-character-card-form/dc-character-card-form.component.d.ts +1 -0
- package/lib/components/dc-agent-form/dc-conversation-flow-form/dc-conversation-flow-form.component.d.ts +16 -10
- package/lib/components/dc-agent-form/dc-do-action-form/dc-do-action-form.component.d.ts +24 -0
- package/lib/components/dc-agent-form/dc-dynamic-conditions-form/dc-dynamic-conditions-form.component.d.ts +25 -0
- package/lib/components/dc-agent-form/form-group.service.d.ts +11 -4
- package/lib/components/dc-agent-form/form-group.utils.d.ts +29 -1
- package/lib/components/prompt-preview-dialog/prompt-conversation-types-dialog.d.ts +18 -0
- package/lib/components/prompt-preview-dialog/prompt-preview-dialog.component.d.ts +1 -2
- package/lib/components/provider-selector/provider-selector.component.d.ts +2 -3
- package/lib/models/agent.models.d.ts +9 -3
- package/lib/services/content-extractor.tool.d.ts +2 -0
- package/lib/services/conversation.service.d.ts +6 -8
- package/lib/services/dynamic-flow.service.d.ts +14 -0
- package/lib/services/evaluation.service.d.ts +1 -1
- package/lib/services/messages-state.service.d.ts +12 -0
- package/package.json +1 -1
- package/public-api.d.ts +5 -1
|
@@ -1,21 +1,21 @@
|
|
|
1
1
|
import * as i0 from '@angular/core';
|
|
2
2
|
import { InjectionToken, Injectable, inject, RendererFactory2, ApplicationRef, Injector, EnvironmentInjector, signal, createComponent, Pipe, input, output, Input, Component, effect, ViewChild, computed, DestroyRef, ChangeDetectionStrategy, ElementRef, ChangeDetectorRef, EventEmitter, Output, ViewChildren } from '@angular/core';
|
|
3
|
+
import { formatCamelCaseString, HttpCoreService, AudioSpeed as AudioSpeed$1, TOAST_ALERTS_TOKEN, EModelQuality, AudioSpeedReverse, ModelQualityOptions, PaginationBase, DCFilterBarComponent, QuickTableComponent } from '@dataclouder/ngx-core';
|
|
3
4
|
import * as i1$1 from '@angular/common';
|
|
4
5
|
import { DOCUMENT, CommonModule, DatePipe, DecimalPipe, NgComponentOutlet } from '@angular/common';
|
|
5
|
-
import {
|
|
6
|
+
import { nanoid } from 'nanoid';
|
|
6
7
|
import { DynamicDialogRef, DialogService, DynamicDialogConfig, DynamicDialogModule } from 'primeng/dynamicdialog';
|
|
7
8
|
import * as i1$3 from 'primeng/dialog';
|
|
8
9
|
import { DialogModule } from 'primeng/dialog';
|
|
9
|
-
import * as i2 from 'primeng/progressbar';
|
|
10
|
+
import * as i2$1 from 'primeng/progressbar';
|
|
10
11
|
import { ProgressBarModule } from 'primeng/progressbar';
|
|
12
|
+
import * as i2 from 'primeng/button';
|
|
13
|
+
import { ButtonModule } from 'primeng/button';
|
|
11
14
|
import * as i1 from '@angular/forms';
|
|
12
|
-
import { FormControl, ReactiveFormsModule, FormBuilder, FormsModule, FormArray } from '@angular/forms';
|
|
13
|
-
import { MicVadComponent } from '@dataclouder/ngx-mic';
|
|
14
|
-
import * as
|
|
15
|
+
import { FormControl, ReactiveFormsModule, FormBuilder, FormsModule, FormArray, FormGroup } from '@angular/forms';
|
|
16
|
+
import { DCMicComponent, MicVadComponent } from '@dataclouder/ngx-mic';
|
|
17
|
+
import * as i4 from 'primeng/textarea';
|
|
15
18
|
import { TextareaModule } from 'primeng/textarea';
|
|
16
|
-
import * as i2$1 from 'primeng/button';
|
|
17
|
-
import { ButtonModule } from 'primeng/button';
|
|
18
|
-
import { nanoid } from 'nanoid';
|
|
19
19
|
import { takeUntilDestroyed } from '@angular/core/rxjs-interop';
|
|
20
20
|
import { Subject, fromEvent, filter } from 'rxjs';
|
|
21
21
|
import { takeUntil, map } from 'rxjs/operators';
|
|
@@ -25,7 +25,7 @@ import { SkeletonModule } from 'primeng/skeleton';
|
|
|
25
25
|
import * as i2$3 from 'primeng/checkbox';
|
|
26
26
|
import { CheckboxModule } from 'primeng/checkbox';
|
|
27
27
|
import { SliderModule } from 'primeng/slider';
|
|
28
|
-
import * as i3
|
|
28
|
+
import * as i3 from 'primeng/radiobutton';
|
|
29
29
|
import { RadioButtonModule } from 'primeng/radiobutton';
|
|
30
30
|
import { RatingModule } from 'primeng/rating';
|
|
31
31
|
import { TableModule } from 'primeng/table';
|
|
@@ -39,11 +39,13 @@ import { SelectModule } from 'primeng/select';
|
|
|
39
39
|
import { ActivatedRoute, Router } from '@angular/router';
|
|
40
40
|
import { OverlayModule } from '@angular/cdk/overlay';
|
|
41
41
|
import { PortalModule } from '@angular/cdk/portal';
|
|
42
|
-
import * as i3$
|
|
42
|
+
import * as i3$1 from 'primeng/inputtext';
|
|
43
43
|
import { InputTextModule } from 'primeng/inputtext';
|
|
44
44
|
import * as i6 from 'primeng/togglebutton';
|
|
45
45
|
import { ToggleButtonModule } from 'primeng/togglebutton';
|
|
46
46
|
import { MultiImagesStorageService, ResolutionType, AspectType, CropperComponentModal } from '@dataclouder/ngx-cloud-storage';
|
|
47
|
+
import * as i12 from 'primeng/inputnumber';
|
|
48
|
+
import { InputNumberModule } from 'primeng/inputnumber';
|
|
47
49
|
import { DialogRef, DIALOG_DATA } from '@angular/cdk/dialog';
|
|
48
50
|
import * as i6$1 from 'primeng/toggleswitch';
|
|
49
51
|
import { ToggleSwitchModule } from 'primeng/toggleswitch';
|
|
@@ -52,7 +54,7 @@ import { PopoverModule } from 'primeng/popover';
|
|
|
52
54
|
import * as i2$4 from 'primeng/card';
|
|
53
55
|
import { CardModule } from 'primeng/card';
|
|
54
56
|
import { ChipModule } from 'primeng/chip';
|
|
55
|
-
import * as i3$
|
|
57
|
+
import * as i3$2 from 'primeng/listbox';
|
|
56
58
|
import { ListboxModule } from 'primeng/listbox';
|
|
57
59
|
import * as i9 from 'primeng/inputgroupaddon';
|
|
58
60
|
import { InputGroupAddonModule } from 'primeng/inputgroupaddon';
|
|
@@ -62,7 +64,7 @@ import * as i1$4 from 'primeng/paginator';
|
|
|
62
64
|
import { PaginatorModule } from 'primeng/paginator';
|
|
63
65
|
import * as i2$5 from 'primeng/speeddial';
|
|
64
66
|
import { SpeedDialModule } from 'primeng/speeddial';
|
|
65
|
-
import * as i4 from 'primeng/tag';
|
|
67
|
+
import * as i4$1 from 'primeng/tag';
|
|
66
68
|
import { TagModule } from 'primeng/tag';
|
|
67
69
|
|
|
68
70
|
const characterCardStringDataDefinition = `
|
|
@@ -432,6 +434,42 @@ const ConversationTypeOptions = [
|
|
|
432
434
|
{ value: ConversationType.LanguagePractice, label: 'Language Practice Conversation' },
|
|
433
435
|
];
|
|
434
436
|
|
|
437
|
+
function extractJsonFromResponse(content) {
|
|
438
|
+
// Match everything between the first { and last } OR first [ and last ]
|
|
439
|
+
const jsonMatch = content.match(/(\{[\s\S]*?\}|\[[\s\S]*?\])/);
|
|
440
|
+
if (!jsonMatch)
|
|
441
|
+
return null;
|
|
442
|
+
try {
|
|
443
|
+
return JSON.parse(jsonMatch[0]);
|
|
444
|
+
}
|
|
445
|
+
catch (error) {
|
|
446
|
+
console.error('Error parsing JSON:', error);
|
|
447
|
+
return null;
|
|
448
|
+
}
|
|
449
|
+
}
|
|
450
|
+
|
|
451
|
+
var EDoActionType;
|
|
452
|
+
(function (EDoActionType) {
|
|
453
|
+
EDoActionType["ChangePrompt"] = "changePrompt";
|
|
454
|
+
EDoActionType["ChangeModel"] = "changeModel";
|
|
455
|
+
EDoActionType["Summarize"] = "summarize";
|
|
456
|
+
})(EDoActionType || (EDoActionType = {}));
|
|
457
|
+
const DoActionTypeOptions = [
|
|
458
|
+
{ label: 'Cambiar Prompt', value: EDoActionType.ChangePrompt },
|
|
459
|
+
{ label: 'Cambiar Modelo (Pendiente)', value: EDoActionType.ChangeModel },
|
|
460
|
+
{ label: 'Resumir (Pendiente)', value: EDoActionType.Summarize },
|
|
461
|
+
];
|
|
462
|
+
var SystemPromptType;
|
|
463
|
+
(function (SystemPromptType) {
|
|
464
|
+
SystemPromptType["SystemPrompt"] = "systemPrompt";
|
|
465
|
+
SystemPromptType["ConversationType"] = "conversationType";
|
|
466
|
+
SystemPromptType["UserInformation"] = "userInformation";
|
|
467
|
+
SystemPromptType["CharacterDescription"] = "characterDescription";
|
|
468
|
+
SystemPromptType["ScenarioDescription"] = "scenarioDescription";
|
|
469
|
+
SystemPromptType["MessageExamples"] = "messageExamples";
|
|
470
|
+
SystemPromptType["JailBreak"] = "jailBreak";
|
|
471
|
+
})(SystemPromptType || (SystemPromptType = {}));
|
|
472
|
+
|
|
435
473
|
class AudioService {
|
|
436
474
|
playFinishRecordingAudio() {
|
|
437
475
|
const audio = new Audio('assets/sounds/circuitbreaker.mp3');
|
|
@@ -612,7 +650,7 @@ function getDefaultPromptByType(conversationType) {
|
|
|
612
650
|
const prompt = defaultPrompts[conversationType];
|
|
613
651
|
if (!prompt) {
|
|
614
652
|
console.warn('There is no prompt template for conversation type', conversationType);
|
|
615
|
-
return '
|
|
653
|
+
return '';
|
|
616
654
|
}
|
|
617
655
|
return prompt;
|
|
618
656
|
}
|
|
@@ -658,7 +696,7 @@ class DCConversationPromptBuilderService {
|
|
|
658
696
|
convertConversationToHtml(messages, jailBrake = '') {
|
|
659
697
|
let finalPrompt = '';
|
|
660
698
|
for (const message of messages) {
|
|
661
|
-
finalPrompt += `<h5>${message.role}</h5>`;
|
|
699
|
+
finalPrompt += `<h5> <b class='text-blue-700'>${formatCamelCaseString(message.role)}</b> <b class='text-red-700'>${formatCamelCaseString(message.messageId)}</b></h5>`;
|
|
662
700
|
finalPrompt += `<p>${message.content} </p>`;
|
|
663
701
|
}
|
|
664
702
|
if (jailBrake) {
|
|
@@ -684,25 +722,27 @@ class DCConversationPromptBuilderService {
|
|
|
684
722
|
return text;
|
|
685
723
|
}
|
|
686
724
|
buildInitialConversation(characterCard, conversationType = ConversationType.General) {
|
|
687
|
-
|
|
725
|
+
const chat = [];
|
|
688
726
|
if (characterCard?.data?.system_prompt) {
|
|
689
|
-
|
|
727
|
+
chat.push({ role: ChatRole.System, content: characterCard?.data?.system_prompt, messageId: SystemPromptType.SystemPrompt });
|
|
728
|
+
}
|
|
729
|
+
let systemPromptInstructions = getDefaultPromptByType(conversationType);
|
|
730
|
+
if (systemPromptInstructions) {
|
|
731
|
+
chat.push({ role: ChatRole.System, content: systemPromptInstructions, messageId: SystemPromptType.ConversationType });
|
|
690
732
|
}
|
|
691
733
|
if (this.userDataExchange.getUserDataInformation()) {
|
|
692
|
-
|
|
734
|
+
chat.push({ role: ChatRole.System, content: this.userDataExchange.getUserDataInformation(), messageId: SystemPromptType.UserInformation });
|
|
693
735
|
}
|
|
694
|
-
const chat = [];
|
|
695
|
-
chat.push({ role: ChatRole.System, content: systemPromptInstructions });
|
|
696
736
|
if (characterCard.data.description) {
|
|
697
|
-
chat.push({ role: ChatRole.System, content: characterCard.data.description });
|
|
737
|
+
chat.push({ role: ChatRole.System, content: characterCard.data.description, messageId: SystemPromptType.CharacterDescription });
|
|
698
738
|
}
|
|
699
739
|
if (characterCard.data.scenario) {
|
|
700
740
|
const scenarioDesc = 'Simple description for the Scenario: ' + characterCard.data.scenario;
|
|
701
|
-
chat.push({ role: ChatRole.System, content: scenarioDesc });
|
|
741
|
+
chat.push({ role: ChatRole.System, content: scenarioDesc, messageId: SystemPromptType.ScenarioDescription });
|
|
702
742
|
}
|
|
703
743
|
if (characterCard.data.mes_example) {
|
|
704
744
|
const examples = 'Here are some examples of how {{char}} could response to {{user}}: ' + characterCard.data.mes_example;
|
|
705
|
-
chat.push({ role: ChatRole.System, content: examples });
|
|
745
|
+
chat.push({ role: ChatRole.System, content: examples, messageId: SystemPromptType.MessageExamples });
|
|
706
746
|
}
|
|
707
747
|
const gretting = this.selectOneRandomGreeting(characterCard.data.first_mes, characterCard.data.alternate_greetings);
|
|
708
748
|
chat.push({ role: ChatRole.System, content: '[Start a new Chat]' });
|
|
@@ -917,6 +957,124 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.4", ngImpor
|
|
|
917
957
|
}]
|
|
918
958
|
}] });
|
|
919
959
|
|
|
960
|
+
class MessagesStateService {
|
|
961
|
+
constructor() {
|
|
962
|
+
this.messagesSignal = signal([]);
|
|
963
|
+
}
|
|
964
|
+
getMessagesSignal() {
|
|
965
|
+
return this.messagesSignal;
|
|
966
|
+
}
|
|
967
|
+
addMessage(message) {
|
|
968
|
+
if (!message.messageId) {
|
|
969
|
+
message.messageId = nanoid();
|
|
970
|
+
}
|
|
971
|
+
this.messagesSignal.update((messages) => [...messages, message]);
|
|
972
|
+
console.log('Message added via MessagesStateService:', this.messagesSignal());
|
|
973
|
+
return message.messageId;
|
|
974
|
+
}
|
|
975
|
+
updateMessage(messageId, updatedMessage, insertIfNotFound = false) {
|
|
976
|
+
let found = false;
|
|
977
|
+
this.messagesSignal.update((messages) => messages.map((message) => {
|
|
978
|
+
if (message.messageId === messageId) {
|
|
979
|
+
found = true;
|
|
980
|
+
return { ...message, ...updatedMessage };
|
|
981
|
+
}
|
|
982
|
+
return message;
|
|
983
|
+
}));
|
|
984
|
+
if (!found && insertIfNotFound) {
|
|
985
|
+
const newMessage = { ...updatedMessage, messageId };
|
|
986
|
+
this.addMessage(newMessage);
|
|
987
|
+
}
|
|
988
|
+
return found;
|
|
989
|
+
}
|
|
990
|
+
clearMessages() {
|
|
991
|
+
this.messagesSignal.set([]);
|
|
992
|
+
}
|
|
993
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.4", ngImport: i0, type: MessagesStateService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
994
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.2.4", ngImport: i0, type: MessagesStateService, providedIn: 'root' }); }
|
|
995
|
+
}
|
|
996
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.4", ngImport: i0, type: MessagesStateService, decorators: [{
|
|
997
|
+
type: Injectable,
|
|
998
|
+
args: [{
|
|
999
|
+
providedIn: 'root',
|
|
1000
|
+
}]
|
|
1001
|
+
}] });
|
|
1002
|
+
|
|
1003
|
+
class DynamicFlowService {
|
|
1004
|
+
constructor() {
|
|
1005
|
+
this.messagesStateService = inject(MessagesStateService);
|
|
1006
|
+
// State
|
|
1007
|
+
this.conversationFlowState = signal(null);
|
|
1008
|
+
}
|
|
1009
|
+
setConversationFlow(conversationFlow) {
|
|
1010
|
+
this.conversationFlowState.set(conversationFlow);
|
|
1011
|
+
}
|
|
1012
|
+
changePrompt() {
|
|
1013
|
+
// This method is currently empty as per requirements.
|
|
1014
|
+
console.log('DynamicConditionsService: changePrompt called');
|
|
1015
|
+
this.removeSystemPrompts(); // Example call, assuming this is the intended flow
|
|
1016
|
+
}
|
|
1017
|
+
doConditions(condition) {
|
|
1018
|
+
condition.do?.forEach((action) => {
|
|
1019
|
+
switch (action.actionType) {
|
|
1020
|
+
case EDoActionType.ChangePrompt:
|
|
1021
|
+
this.doActionPrompt(action);
|
|
1022
|
+
break;
|
|
1023
|
+
default:
|
|
1024
|
+
break;
|
|
1025
|
+
}
|
|
1026
|
+
});
|
|
1027
|
+
}
|
|
1028
|
+
doActionPrompt(action) {
|
|
1029
|
+
const prompt = action.prompt;
|
|
1030
|
+
const messageId = action.systemPromptType;
|
|
1031
|
+
this.messagesStateService.updateMessage(messageId, { content: prompt, role: ChatRole.System }, true);
|
|
1032
|
+
console.log('DynamicConditionsService: doActionPrompt called', this.messagesStateService.getMessagesSignal()());
|
|
1033
|
+
console.log('DynamicConditionsService: doActionPrompt called');
|
|
1034
|
+
}
|
|
1035
|
+
removeSystemPrompts() {
|
|
1036
|
+
const idsToRemove = [
|
|
1037
|
+
// Ensure idsToRemove is string array
|
|
1038
|
+
SystemPromptType.ScenarioDescription,
|
|
1039
|
+
SystemPromptType.MessageExamples,
|
|
1040
|
+
SystemPromptType.UserInformation,
|
|
1041
|
+
SystemPromptType.CharacterDescription,
|
|
1042
|
+
];
|
|
1043
|
+
const currentMessages = this.messagesStateService.getMessagesSignal()();
|
|
1044
|
+
const filteredMessages = currentMessages.filter((message) => !idsToRemove.includes(message.messageId));
|
|
1045
|
+
this.messagesStateService.clearMessages();
|
|
1046
|
+
filteredMessages.forEach((msg) => this.messagesStateService.addMessage(msg));
|
|
1047
|
+
console.log('System prompts removed, messages updated in state:', this.messagesStateService.getMessagesSignal()());
|
|
1048
|
+
}
|
|
1049
|
+
checkDynamicConditions(previousScore, currentScore) {
|
|
1050
|
+
const dynamicConditions = this.conversationFlowState()?.dynamicConditions;
|
|
1051
|
+
if (dynamicConditions) {
|
|
1052
|
+
dynamicConditions.forEach((condition) => {
|
|
1053
|
+
if (condition.what === EntityWhat.Goal) {
|
|
1054
|
+
if (condition.when === EntityWhen.GreaterThanOrEqual) {
|
|
1055
|
+
const conditionValue = Number(condition.value);
|
|
1056
|
+
// Check if the condition was not met before but is met now
|
|
1057
|
+
if (previousScore < conditionValue && currentScore >= conditionValue) {
|
|
1058
|
+
this.doConditions(condition);
|
|
1059
|
+
// alert('Goal Condition met: Score reached ' + conditionValue);
|
|
1060
|
+
}
|
|
1061
|
+
}
|
|
1062
|
+
// Add more condition checks for 'when' if necessary (e.g., LessThanOrEqual, Equal)
|
|
1063
|
+
}
|
|
1064
|
+
// Add more condition checks for 'what' if necessary
|
|
1065
|
+
});
|
|
1066
|
+
}
|
|
1067
|
+
}
|
|
1068
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.4", ngImport: i0, type: DynamicFlowService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
1069
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.2.4", ngImport: i0, type: DynamicFlowService, providedIn: 'root' }); }
|
|
1070
|
+
}
|
|
1071
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.4", ngImport: i0, type: DynamicFlowService, decorators: [{
|
|
1072
|
+
type: Injectable,
|
|
1073
|
+
args: [{
|
|
1074
|
+
providedIn: 'root',
|
|
1075
|
+
}]
|
|
1076
|
+
}] });
|
|
1077
|
+
|
|
920
1078
|
/**
|
|
921
1079
|
* SafeJsonPipe - A pipe that safely stringifies objects with circular references
|
|
922
1080
|
* This pipe handles circular references and DOM objects that can't be serialized
|
|
@@ -987,26 +1145,12 @@ class ChatHeaderComponent {
|
|
|
987
1145
|
settingsClick() {
|
|
988
1146
|
this.settingsClickEvent.emit();
|
|
989
1147
|
}
|
|
990
|
-
async changeConversationCard() {
|
|
991
|
-
const response = prompt('¿Qué conversación quieres usar? Escribe el titulo ejemplo: word_reflection_level_1_base_es');
|
|
992
|
-
if (response) {
|
|
993
|
-
const filters = {
|
|
994
|
-
filters: {
|
|
995
|
-
title: { $regex: response },
|
|
996
|
-
},
|
|
997
|
-
};
|
|
998
|
-
console.log('filters', filters);
|
|
999
|
-
const conversationCards = await this.agentCardService.filterConversationCards(filters);
|
|
1000
|
-
console.log('conversationCards', conversationCards);
|
|
1001
|
-
this.alternativeConversation = conversationCards.rows;
|
|
1002
|
-
}
|
|
1003
|
-
}
|
|
1004
1148
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.4", ngImport: i0, type: ChatHeaderComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
1005
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.4", type: ChatHeaderComponent, isStandalone: true, selector: "dc-chat-header", inputs: { isAdmin: { classPropertyName: "isAdmin", publicName: "isAdmin", isSignal: true, isRequired: false, transformFunction: null }, alternativeConversation: { classPropertyName: "alternativeConversation", publicName: "alternativeConversation", isSignal: false, isRequired: false, transformFunction: null }, agentCard: { classPropertyName: "agentCard", publicName: "agentCard", isSignal: false, isRequired: false, transformFunction: null } }, outputs: { restartConversationEvent: "restartConversationEvent", showInfoEvent: "showInfoEvent", settingsClickEvent: "settingsClickEvent" }, ngImport: i0, template: "<div class=\"chat-header\">\n <span class=\"pointer\" (click)=\"restartConversation()\">\n @if (agentCard?.title) {\n
|
|
1149
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.4", type: ChatHeaderComponent, isStandalone: true, selector: "dc-chat-header", inputs: { isAdmin: { classPropertyName: "isAdmin", publicName: "isAdmin", isSignal: true, isRequired: false, transformFunction: null }, alternativeConversation: { classPropertyName: "alternativeConversation", publicName: "alternativeConversation", isSignal: false, isRequired: false, transformFunction: null }, agentCard: { classPropertyName: "agentCard", publicName: "agentCard", isSignal: false, isRequired: false, transformFunction: null } }, outputs: { restartConversationEvent: "restartConversationEvent", showInfoEvent: "showInfoEvent", settingsClickEvent: "settingsClickEvent" }, ngImport: i0, template: "<div class=\"chat-header\">\n <span class=\"pointer\" (click)=\"restartConversation()\">\n @if (agentCard?.title) {\n {{ agentCard.title }}\n } @else { Reiniciar conversaci\u00F3n }\n </span>\n\n @for (conversation of alternativeConversation; track conversation._id) {\n <span class=\"pointer\" (click)=\"restartConversation(conversation)\"> {{ conversation.title }} </span>\n }\n\n <div class=\"header-controls\">\n @if (isAdmin()){\n <div class=\"admin-controls\">\n <i style=\"color: rgb(255, 149, 0)\" class=\"pi pi-key\"></i>\n\n <p-button variant=\"text\" [raised]=\"true\" icon=\"pi pi-id-card\" (click)=\"showInfo()\"></p-button>\n\n <!-- <span class=\"pointer\" (click)=\"showInfo()\"> \u26A1\uFE0F </span> -->\n </div>\n }\n\n <div>\n <span class=\"pointer\" (click)=\"settingsClick()\"> \u2699\uFE0F </span>\n </div>\n </div>\n</div>\n", styles: [".chat-header{display:flex;justify-content:space-between;align-items:center;width:100%}.pointer{cursor:pointer}.header-controls{font-size:large;display:flex;justify-content:space-between;gap:10px}.admin-controls{background-color:bisque;padding:2px 5px;border-radius:4px}\n"], dependencies: [{ kind: "ngmodule", type: ButtonModule }, { kind: "component", type: i2.Button, selector: "p-button", inputs: ["type", "iconPos", "icon", "badge", "label", "disabled", "loading", "loadingIcon", "raised", "rounded", "text", "plain", "severity", "outlined", "link", "tabindex", "size", "variant", "style", "styleClass", "badgeClass", "badgeSeverity", "ariaLabel", "autofocus", "fluid", "buttonProps"], outputs: ["onClick", "onFocus", "onBlur"] }] }); }
|
|
1006
1150
|
}
|
|
1007
1151
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.4", ngImport: i0, type: ChatHeaderComponent, decorators: [{
|
|
1008
1152
|
type: Component,
|
|
1009
|
-
args: [{ selector: 'dc-chat-header', standalone: true, imports: [], template: "<div class=\"chat-header\">\n <span class=\"pointer\" (click)=\"restartConversation()\">\n @if (agentCard?.title) {\n
|
|
1153
|
+
args: [{ selector: 'dc-chat-header', standalone: true, imports: [ButtonModule], template: "<div class=\"chat-header\">\n <span class=\"pointer\" (click)=\"restartConversation()\">\n @if (agentCard?.title) {\n {{ agentCard.title }}\n } @else { Reiniciar conversaci\u00F3n }\n </span>\n\n @for (conversation of alternativeConversation; track conversation._id) {\n <span class=\"pointer\" (click)=\"restartConversation(conversation)\"> {{ conversation.title }} </span>\n }\n\n <div class=\"header-controls\">\n @if (isAdmin()){\n <div class=\"admin-controls\">\n <i style=\"color: rgb(255, 149, 0)\" class=\"pi pi-key\"></i>\n\n <p-button variant=\"text\" [raised]=\"true\" icon=\"pi pi-id-card\" (click)=\"showInfo()\"></p-button>\n\n <!-- <span class=\"pointer\" (click)=\"showInfo()\"> \u26A1\uFE0F </span> -->\n </div>\n }\n\n <div>\n <span class=\"pointer\" (click)=\"settingsClick()\"> \u2699\uFE0F </span>\n </div>\n </div>\n</div>\n", styles: [".chat-header{display:flex;justify-content:space-between;align-items:center;width:100%}.pointer{cursor:pointer}.header-controls{font-size:large;display:flex;justify-content:space-between;gap:10px}.admin-controls{background-color:bisque;padding:2px 5px;border-radius:4px}\n"] }]
|
|
1010
1154
|
}], ctorParameters: () => [], propDecorators: { alternativeConversation: [{
|
|
1011
1155
|
type: Input
|
|
1012
1156
|
}], agentCard: [{
|
|
@@ -1520,11 +1664,79 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.4", ngImpor
|
|
|
1520
1664
|
}]
|
|
1521
1665
|
}] });
|
|
1522
1666
|
|
|
1667
|
+
// Helper function to get context messages based on type
|
|
1668
|
+
function getContextMessages(messages, contextType) {
|
|
1669
|
+
const conversationMessages = messages.filter((message) => [ChatRole.User, ChatRole.Assistant].includes(message.role));
|
|
1670
|
+
if (conversationMessages.length === 0) {
|
|
1671
|
+
return [];
|
|
1672
|
+
}
|
|
1673
|
+
switch (contextType) {
|
|
1674
|
+
case ContextType.LastAssistantMessage: {
|
|
1675
|
+
const lastAssistant = conversationMessages
|
|
1676
|
+
.slice()
|
|
1677
|
+
.reverse()
|
|
1678
|
+
.find((m) => m.role === ChatRole.Assistant);
|
|
1679
|
+
return lastAssistant ? [lastAssistant] : [];
|
|
1680
|
+
}
|
|
1681
|
+
case ContextType.LastUserMessage: {
|
|
1682
|
+
const lastUser = conversationMessages
|
|
1683
|
+
.slice()
|
|
1684
|
+
.reverse()
|
|
1685
|
+
.find((m) => m.role === ChatRole.User);
|
|
1686
|
+
return lastUser ? [lastUser] : [];
|
|
1687
|
+
}
|
|
1688
|
+
case ContextType.LastDialog: {
|
|
1689
|
+
const lastUser = conversationMessages
|
|
1690
|
+
.slice()
|
|
1691
|
+
.reverse()
|
|
1692
|
+
.find((m) => m.role === ChatRole.User);
|
|
1693
|
+
const lastAssistant = conversationMessages
|
|
1694
|
+
.slice()
|
|
1695
|
+
.reverse()
|
|
1696
|
+
.find((m) => m.role === ChatRole.Assistant);
|
|
1697
|
+
const dialog = [];
|
|
1698
|
+
if (lastAssistant)
|
|
1699
|
+
dialog.push(lastAssistant);
|
|
1700
|
+
if (lastUser)
|
|
1701
|
+
dialog.push(lastUser);
|
|
1702
|
+
// Sort by timestamp if available, otherwise keep order [Assistant, User] if both exist
|
|
1703
|
+
// Assuming messageId or a timestamp property exists and is comparable
|
|
1704
|
+
// dialog.sort((a, b) => (a.timestamp || 0) - (b.timestamp || 0)); // Example sorting
|
|
1705
|
+
return dialog;
|
|
1706
|
+
}
|
|
1707
|
+
case ContextType.Last2Dialogs: {
|
|
1708
|
+
// I think i have an error with this.
|
|
1709
|
+
const users = conversationMessages.filter((m) => m.role === ChatRole.User);
|
|
1710
|
+
const assistants = conversationMessages.filter((m) => m.role === ChatRole.Assistant);
|
|
1711
|
+
const lastTwoUsers = users.slice(-2);
|
|
1712
|
+
const lastTwoAssistants = assistants.slice(-2);
|
|
1713
|
+
const dialogs = [...lastTwoAssistants, ...lastTwoUsers];
|
|
1714
|
+
// Sort by timestamp if available
|
|
1715
|
+
// dialogs.sort((a, b) => (a.timestamp || 0) - (b.timestamp || 0)); // Example sorting
|
|
1716
|
+
return dialogs;
|
|
1717
|
+
}
|
|
1718
|
+
case ContextType.LastUserAndPreviousAssistant: {
|
|
1719
|
+
const lastUserIndex = conversationMessages.map((m) => m.role).lastIndexOf(ChatRole.User);
|
|
1720
|
+
// Not exactrly getting the last assistant will depend if conversation is one and one.
|
|
1721
|
+
if (lastUserIndex <= 0) {
|
|
1722
|
+
return [];
|
|
1723
|
+
}
|
|
1724
|
+
const messages = conversationMessages.slice(lastUserIndex - 1, lastUserIndex + 1);
|
|
1725
|
+
console.log('LastUserAndPreviousAssistant', messages);
|
|
1726
|
+
return messages;
|
|
1727
|
+
}
|
|
1728
|
+
case ContextType.AllConversation:
|
|
1729
|
+
default:
|
|
1730
|
+
return conversationMessages;
|
|
1731
|
+
}
|
|
1732
|
+
}
|
|
1733
|
+
|
|
1523
1734
|
class EvaluationService {
|
|
1524
1735
|
constructor() {
|
|
1525
1736
|
// Services
|
|
1526
1737
|
this.defaultAgentCardService = inject(DefaultAgentCardsService);
|
|
1527
1738
|
this.toastService = inject(TOAST_ALERTS_TOKEN);
|
|
1739
|
+
this.dynamicFlowService = inject(DynamicFlowService);
|
|
1528
1740
|
// Signals
|
|
1529
1741
|
this.scoreSignal = signal(0); // Only Score
|
|
1530
1742
|
this.evaluationResultSignal = signal(null); // Not sure if ill give some use
|
|
@@ -1582,75 +1794,9 @@ This is the conversation history:
|
|
|
1582
1794
|
return jsonData;
|
|
1583
1795
|
}
|
|
1584
1796
|
getConversationString(messages, contextType) {
|
|
1585
|
-
const contextMessages =
|
|
1797
|
+
const contextMessages = getContextMessages(messages, contextType);
|
|
1586
1798
|
return contextMessages.map((message) => `${message.role}: ${message.content}`).join('\n');
|
|
1587
1799
|
}
|
|
1588
|
-
// Helper function to get context messages based on type
|
|
1589
|
-
getContextMessages(messages, contextType) {
|
|
1590
|
-
const conversationMessages = messages.filter((message) => [ChatRole.User, ChatRole.Assistant].includes(message.role));
|
|
1591
|
-
if (conversationMessages.length === 0) {
|
|
1592
|
-
return [];
|
|
1593
|
-
}
|
|
1594
|
-
switch (contextType) {
|
|
1595
|
-
case ContextType.LastAssistantMessage: {
|
|
1596
|
-
const lastAssistant = conversationMessages
|
|
1597
|
-
.slice()
|
|
1598
|
-
.reverse()
|
|
1599
|
-
.find((m) => m.role === ChatRole.Assistant);
|
|
1600
|
-
return lastAssistant ? [lastAssistant] : [];
|
|
1601
|
-
}
|
|
1602
|
-
case ContextType.LastUserMessage: {
|
|
1603
|
-
const lastUser = conversationMessages
|
|
1604
|
-
.slice()
|
|
1605
|
-
.reverse()
|
|
1606
|
-
.find((m) => m.role === ChatRole.User);
|
|
1607
|
-
return lastUser ? [lastUser] : [];
|
|
1608
|
-
}
|
|
1609
|
-
case ContextType.LastDialog: {
|
|
1610
|
-
const lastUser = conversationMessages
|
|
1611
|
-
.slice()
|
|
1612
|
-
.reverse()
|
|
1613
|
-
.find((m) => m.role === ChatRole.User);
|
|
1614
|
-
const lastAssistant = conversationMessages
|
|
1615
|
-
.slice()
|
|
1616
|
-
.reverse()
|
|
1617
|
-
.find((m) => m.role === ChatRole.Assistant);
|
|
1618
|
-
const dialog = [];
|
|
1619
|
-
if (lastAssistant)
|
|
1620
|
-
dialog.push(lastAssistant);
|
|
1621
|
-
if (lastUser)
|
|
1622
|
-
dialog.push(lastUser);
|
|
1623
|
-
// Sort by timestamp if available, otherwise keep order [Assistant, User] if both exist
|
|
1624
|
-
// Assuming messageId or a timestamp property exists and is comparable
|
|
1625
|
-
// dialog.sort((a, b) => (a.timestamp || 0) - (b.timestamp || 0)); // Example sorting
|
|
1626
|
-
return dialog;
|
|
1627
|
-
}
|
|
1628
|
-
case ContextType.Last2Dialogs: {
|
|
1629
|
-
// I think i have an error with this.
|
|
1630
|
-
const users = conversationMessages.filter((m) => m.role === ChatRole.User);
|
|
1631
|
-
const assistants = conversationMessages.filter((m) => m.role === ChatRole.Assistant);
|
|
1632
|
-
const lastTwoUsers = users.slice(-2);
|
|
1633
|
-
const lastTwoAssistants = assistants.slice(-2);
|
|
1634
|
-
const dialogs = [...lastTwoAssistants, ...lastTwoUsers];
|
|
1635
|
-
// Sort by timestamp if available
|
|
1636
|
-
// dialogs.sort((a, b) => (a.timestamp || 0) - (b.timestamp || 0)); // Example sorting
|
|
1637
|
-
return dialogs;
|
|
1638
|
-
}
|
|
1639
|
-
case ContextType.LastUserAndPreviousAssistant: {
|
|
1640
|
-
const lastUserIndex = conversationMessages.map((m) => m.role).lastIndexOf(ChatRole.User);
|
|
1641
|
-
// Not exactrly getting the last assistant will depend if conversation is one and one.
|
|
1642
|
-
if (lastUserIndex <= 0) {
|
|
1643
|
-
return [];
|
|
1644
|
-
}
|
|
1645
|
-
const messages = conversationMessages.slice(lastUserIndex - 1, lastUserIndex + 1);
|
|
1646
|
-
console.log('LastUserAndPreviousAssistant', messages);
|
|
1647
|
-
return messages;
|
|
1648
|
-
}
|
|
1649
|
-
case ContextType.AllConversation:
|
|
1650
|
-
default:
|
|
1651
|
-
return conversationMessages;
|
|
1652
|
-
}
|
|
1653
|
-
}
|
|
1654
1800
|
/**
|
|
1655
1801
|
* Diference with evaluateConversation is task is already processed here.
|
|
1656
1802
|
* Evaluates a conversation context based on a specific task and attaches the result to a designated message.
|
|
@@ -1677,10 +1823,18 @@ This is the conversation history:
|
|
|
1677
1823
|
}
|
|
1678
1824
|
}
|
|
1679
1825
|
updateScore(additionalScore) {
|
|
1680
|
-
|
|
1681
|
-
|
|
1682
|
-
|
|
1683
|
-
|
|
1826
|
+
// Aqui tengo que verificar que se cumple condición de goal!
|
|
1827
|
+
const previuesScore = this.scoreSignal();
|
|
1828
|
+
const newScore = previuesScore + additionalScore * 10;
|
|
1829
|
+
// How to add the conditions dynamically?
|
|
1830
|
+
this.dynamicFlowService.checkDynamicConditions(previuesScore, newScore);
|
|
1831
|
+
if (newScore > 100) {
|
|
1832
|
+
this.scoreSignal.set(100);
|
|
1833
|
+
}
|
|
1834
|
+
else {
|
|
1835
|
+
console.log('Score updated to:', newScore);
|
|
1836
|
+
this.scoreSignal.set(newScore);
|
|
1837
|
+
}
|
|
1684
1838
|
}
|
|
1685
1839
|
resetScore() {
|
|
1686
1840
|
this.scoreSignal.set(0);
|
|
@@ -1704,27 +1858,23 @@ const EvaluationStructureString = `
|
|
|
1704
1858
|
class ConversationService {
|
|
1705
1859
|
constructor() {
|
|
1706
1860
|
this.defaultAgentCardService = inject(DefaultAgentCardsService);
|
|
1861
|
+
// Services
|
|
1862
|
+
this.toastAlerts = inject(TOAST_ALERTS_TOKEN);
|
|
1707
1863
|
this.messageProcessingService = inject(MessageProcessingService);
|
|
1708
1864
|
this.conversationBuilder = inject(DCConversationPromptBuilderService);
|
|
1709
1865
|
this.userDataExchange = inject(USER_DATA_EXCHANGE);
|
|
1710
1866
|
this.evaluationService = inject(EvaluationService);
|
|
1867
|
+
this.messagesStateService = inject(MessagesStateService);
|
|
1868
|
+
this.dynamicFlowService = inject(DynamicFlowService);
|
|
1711
1869
|
// State Signals
|
|
1712
|
-
this.messagesSignal = signal([]);
|
|
1713
1870
|
this.isThinkingSignal = signal(false);
|
|
1714
|
-
this.
|
|
1715
|
-
this.conversationFlowSignal = signal(null);
|
|
1871
|
+
this.conversationSettingsState = signal(null);
|
|
1716
1872
|
this.isDestroyedSignal = signal(false);
|
|
1717
1873
|
this.micStatusSignal = signal('ready');
|
|
1718
1874
|
this.currentAudioStatus = signal(null); // Orchestrator notifies about audio state
|
|
1719
1875
|
this.wordClickedSignal = signal(null); // Signal for clicked word
|
|
1720
1876
|
// Var State
|
|
1721
|
-
this.avatarImages = {
|
|
1722
|
-
userImg: 'assets/defaults/avatar_user.png',
|
|
1723
|
-
assistantImg: 'assets/defaults/avatar_ai.webp',
|
|
1724
|
-
};
|
|
1725
|
-
}
|
|
1726
|
-
getMessagesSignal() {
|
|
1727
|
-
return this.messagesSignal;
|
|
1877
|
+
this.avatarImages = { userImg: 'assets/defaults/avatar_user.png', assistantImg: 'assets/defaults/avatar_ai.webp' };
|
|
1728
1878
|
}
|
|
1729
1879
|
/**
|
|
1730
1880
|
* Notifies subscribers that a word has been clicked in a message.
|
|
@@ -1741,35 +1891,11 @@ class ConversationService {
|
|
|
1741
1891
|
return this.wordClickedSignal;
|
|
1742
1892
|
}
|
|
1743
1893
|
createNewUserMessage() {
|
|
1744
|
-
const message = {
|
|
1745
|
-
|
|
1746
|
-
|
|
1747
|
-
};
|
|
1748
|
-
const processedMessage = this.messageProcessingService.processMessage(message, this.conversationSettingsSignal(), this.avatarImages);
|
|
1749
|
-
this.addMessage(processedMessage);
|
|
1894
|
+
const message = { content: '...', role: ChatRole.User };
|
|
1895
|
+
const processedMessage = this.messageProcessingService.processMessage(message, this.conversationSettingsState(), this.avatarImages);
|
|
1896
|
+
this.messagesStateService.addMessage(processedMessage);
|
|
1750
1897
|
return processedMessage.messageId;
|
|
1751
1898
|
}
|
|
1752
|
-
// Add message to conversation
|
|
1753
|
-
addMessage(message) {
|
|
1754
|
-
this.messagesSignal.update((messages) => [...messages, message]);
|
|
1755
|
-
console.log('Message added:', this.messagesSignal());
|
|
1756
|
-
return message.messageId;
|
|
1757
|
-
}
|
|
1758
|
-
// Update message by ID
|
|
1759
|
-
updateMessage(messageId, updatedMessage) {
|
|
1760
|
-
let found = false;
|
|
1761
|
-
this.messagesSignal.update((messages) => {
|
|
1762
|
-
return messages.map((message) => {
|
|
1763
|
-
if (message.messageId === messageId) {
|
|
1764
|
-
found = true;
|
|
1765
|
-
// Create a new message object with the updated properties
|
|
1766
|
-
return { ...message, ...updatedMessage };
|
|
1767
|
-
}
|
|
1768
|
-
return message;
|
|
1769
|
-
});
|
|
1770
|
-
});
|
|
1771
|
-
return found;
|
|
1772
|
-
}
|
|
1773
1899
|
// Get thinking state as a signal
|
|
1774
1900
|
isThinking() {
|
|
1775
1901
|
return this.isThinkingSignal;
|
|
@@ -1784,36 +1910,62 @@ class ConversationService {
|
|
|
1784
1910
|
conversationSettings.model = userSettings.model;
|
|
1785
1911
|
}
|
|
1786
1912
|
}
|
|
1787
|
-
setupConversationWithAgentCard(agentCard, parseDict = null,
|
|
1913
|
+
setupConversationWithAgentCard(agentCard, parseDict = null, conversationFlowApp = null) {
|
|
1788
1914
|
// Basically extract settings and flow from agent card, and overrider with user seetings is needed.
|
|
1789
1915
|
this.avatarImages.assistantImg = agentCard?.assets?.image?.url || this.avatarImages.assistantImg; // Set user AI avatar image
|
|
1790
1916
|
const conversationSettings = this.conversationBuilder.buildConversationSettings(agentCard, parseDict);
|
|
1791
1917
|
// Here i need some rules to see when i will override and what.
|
|
1792
1918
|
this.overrideSettingsByUserSettings(conversationSettings);
|
|
1793
|
-
this.
|
|
1919
|
+
this.conversationSettingsState.set(conversationSettings);
|
|
1794
1920
|
// this.conversationFlowSignal.set(this.conversationBuilder.buildConversationFlow(agentCard, parseDict));
|
|
1795
|
-
if (
|
|
1796
|
-
|
|
1921
|
+
if (conversationFlowApp) {
|
|
1922
|
+
// Just replace the default if agent card has a value
|
|
1923
|
+
if (agentCard.conversationFlow) {
|
|
1924
|
+
if (agentCard.conversationFlow?.goal?.task) {
|
|
1925
|
+
conversationFlowApp.goal = agentCard.conversationFlow.goal;
|
|
1926
|
+
}
|
|
1927
|
+
if (agentCard.conversationFlow?.dynamicConditions) {
|
|
1928
|
+
conversationFlowApp.dynamicConditions = agentCard.conversationFlow.dynamicConditions;
|
|
1929
|
+
}
|
|
1930
|
+
if (agentCard.conversationFlow?.triggerTasks) {
|
|
1931
|
+
// Leave default if a concreate task is not provided.
|
|
1932
|
+
if (agentCard.conversationFlow.triggerTasks?.onUserMessage?.task) {
|
|
1933
|
+
conversationFlowApp.triggerTasks.onUserMessage = agentCard.conversationFlow.triggerTasks.onUserMessage;
|
|
1934
|
+
}
|
|
1935
|
+
if (agentCard.conversationFlow.triggerTasks?.onUserMessage?.task) {
|
|
1936
|
+
conversationFlowApp.triggerTasks.onUserMessage = agentCard.conversationFlow.triggerTasks.onUserMessage;
|
|
1937
|
+
}
|
|
1938
|
+
agentCard.conversationFlow.triggerTasks = { ...agentCard.conversationFlow.triggerTasks, ...conversationFlowApp.triggerTasks };
|
|
1939
|
+
}
|
|
1940
|
+
if (agentCard.conversationFlow?.bonus) {
|
|
1941
|
+
conversationFlowApp.bonus = agentCard.conversationFlow.bonus;
|
|
1942
|
+
}
|
|
1943
|
+
}
|
|
1944
|
+
this.dynamicFlowService.setConversationFlow(conversationFlowApp);
|
|
1797
1945
|
}
|
|
1798
1946
|
}
|
|
1799
1947
|
async initConversationWithSettings(conversationSettings, conversationFlow) {
|
|
1800
1948
|
this.overrideSettingsByUserSettings(conversationSettings);
|
|
1801
|
-
this.
|
|
1802
|
-
this.
|
|
1949
|
+
this.conversationSettingsState.set(conversationSettings);
|
|
1950
|
+
this.dynamicFlowService.setConversationFlow(conversationFlow);
|
|
1803
1951
|
await this.initConversation();
|
|
1804
1952
|
}
|
|
1805
1953
|
async initConversation() {
|
|
1806
1954
|
this.avatarImages.userImg = this.userDataExchange.getUserDataExchange().imgUrl;
|
|
1807
|
-
const conversationSettings = this.
|
|
1955
|
+
const conversationSettings = this.conversationSettingsState();
|
|
1808
1956
|
for (const i in conversationSettings.messages) {
|
|
1809
|
-
conversationSettings.messages[i].messageId
|
|
1957
|
+
if (!conversationSettings.messages[i].messageId) {
|
|
1958
|
+
conversationSettings.messages[i].messageId = nanoid();
|
|
1959
|
+
}
|
|
1810
1960
|
}
|
|
1811
1961
|
// Find first assistant message
|
|
1812
1962
|
const firstAssistantMsg = conversationSettings?.messages.find((message) => message.role === ChatRole.Assistant);
|
|
1813
|
-
this.
|
|
1963
|
+
this.messagesStateService.clearMessages(); // Clear previous messages
|
|
1964
|
+
(conversationSettings?.messages || []).forEach((msg) => this.messagesStateService.addMessage(msg));
|
|
1814
1965
|
if (firstAssistantMsg) {
|
|
1815
1966
|
// Process the first assistant message
|
|
1816
|
-
const processedMessage = this.messageProcessingService.processMessage(firstAssistantMsg, this.
|
|
1967
|
+
const processedMessage = this.messageProcessingService.processMessage(firstAssistantMsg, this.conversationSettingsState(), this.avatarImages);
|
|
1968
|
+
this.messagesStateService.updateMessage(firstAssistantMsg.messageId, processedMessage);
|
|
1817
1969
|
// Find the index of the message with the matching ID
|
|
1818
1970
|
const messageIndex = conversationSettings.messages.findIndex((message) => message.messageId === firstAssistantMsg.messageId);
|
|
1819
1971
|
// If found, replace the message at that index
|
|
@@ -1849,7 +2001,7 @@ class ConversationService {
|
|
|
1849
2001
|
if (updateId) {
|
|
1850
2002
|
// if you pass updateId means message exists and you want to update it.
|
|
1851
2003
|
const messageToUpdate = { ...message, messageId: updateId };
|
|
1852
|
-
const updated = this.updateMessage(updateId, messageToUpdate);
|
|
2004
|
+
const updated = this.messagesStateService.updateMessage(updateId, messageToUpdate);
|
|
1853
2005
|
if (!updated) {
|
|
1854
2006
|
console.error(`Failed to update message with ID: ${updateId}`);
|
|
1855
2007
|
// Decide how to handle this - maybe throw an error or return null?
|
|
@@ -1859,10 +2011,10 @@ class ConversationService {
|
|
|
1859
2011
|
}
|
|
1860
2012
|
else {
|
|
1861
2013
|
// Means is new meessage, Process and add the new message
|
|
1862
|
-
const processedMessage = this.messageProcessingService.processMessage(message, this.
|
|
2014
|
+
const processedMessage = this.messageProcessingService.processMessage(message, this.conversationSettingsState(), this.avatarImages);
|
|
1863
2015
|
// Ensure ID exists (processMessage should handle this, but fallback just in case)
|
|
1864
2016
|
processedMessage.messageId = processedMessage.messageId || nanoid();
|
|
1865
|
-
this.addMessage(processedMessage);
|
|
2017
|
+
this.messagesStateService.addMessage(processedMessage);
|
|
1866
2018
|
userMessageId = processedMessage.messageId;
|
|
1867
2019
|
}
|
|
1868
2020
|
// Set thinking state and get AI response
|
|
@@ -1887,10 +2039,14 @@ class ConversationService {
|
|
|
1887
2039
|
if (this.isDestroyedSignal()) {
|
|
1888
2040
|
return null;
|
|
1889
2041
|
}
|
|
1890
|
-
const messages = this.
|
|
1891
|
-
const conversationSettings = this.
|
|
2042
|
+
const messages = this.messagesStateService.getMessagesSignal()();
|
|
2043
|
+
const conversationSettings = this.conversationSettingsState();
|
|
1892
2044
|
if (messages.length > 31) {
|
|
1893
2045
|
// Safety limit to prevent infinite conversations
|
|
2046
|
+
this.toastAlerts.warn({
|
|
2047
|
+
title: 'Conversation limit reached',
|
|
2048
|
+
subtitle: 'The conversation has reached its maximum length. Please start a new conversation.',
|
|
2049
|
+
});
|
|
1894
2050
|
return null;
|
|
1895
2051
|
}
|
|
1896
2052
|
let conversationMessages = messages;
|
|
@@ -1914,7 +2070,7 @@ class ConversationService {
|
|
|
1914
2070
|
}
|
|
1915
2071
|
// Process response
|
|
1916
2072
|
const newMessage = this.messageProcessingService.processMessage({ content: response.content, role: ChatRole.Assistant }, conversationSettings, this.avatarImages);
|
|
1917
|
-
this.addMessage(newMessage);
|
|
2073
|
+
this.messagesStateService.addMessage(newMessage);
|
|
1918
2074
|
this.isThinkingSignal.set(false);
|
|
1919
2075
|
this.runAssistantTrigger(newMessage); // Not waiting should be parallel.
|
|
1920
2076
|
return newMessage.messageId;
|
|
@@ -1922,7 +2078,7 @@ class ConversationService {
|
|
|
1922
2078
|
// Reset conversation
|
|
1923
2079
|
async resetConversation(agentCard) {
|
|
1924
2080
|
// Clear messages
|
|
1925
|
-
this.
|
|
2081
|
+
this.messagesStateService.clearMessages();
|
|
1926
2082
|
}
|
|
1927
2083
|
async getTTSFile(message) {
|
|
1928
2084
|
const userChatSettings = await this.userDataExchange.getUserChatSettings();
|
|
@@ -1930,25 +2086,30 @@ class ConversationService {
|
|
|
1930
2086
|
return this.defaultAgentCardService.getTextAudioFile(ttsRequest);
|
|
1931
2087
|
}
|
|
1932
2088
|
async runAssistantTrigger(message) {
|
|
1933
|
-
const trigger = this.
|
|
2089
|
+
const trigger = this.dynamicFlowService.conversationFlowState().triggerTasks.onAssistantMessage;
|
|
2090
|
+
console.log('Trigger:', trigger);
|
|
1934
2091
|
if (trigger) {
|
|
1935
|
-
|
|
1936
|
-
|
|
2092
|
+
// const contextMessages = getContextMessages(this.messagesSignal(), ContextType.LastAssistantMessage);
|
|
2093
|
+
// i cant override task in trigger.
|
|
2094
|
+
const task = trigger.task + ' Here is the text: ' + (message.text || message.content);
|
|
2095
|
+
const result = await this.evaluationService.evaluateWithTask({ model: trigger.model, task });
|
|
1937
2096
|
console.log('Assistant trigger evaluation result:', result);
|
|
1938
2097
|
message.evaluation = result;
|
|
1939
|
-
this.updateMessage(message.messageId, message);
|
|
2098
|
+
this.messagesStateService.updateMessage(message.messageId, message);
|
|
1940
2099
|
}
|
|
1941
2100
|
}
|
|
1942
2101
|
async runUserFlowEvaluations(message) {
|
|
1943
|
-
const goal = this.
|
|
1944
|
-
const trigger = this.
|
|
2102
|
+
const goal = this.dynamicFlowService.conversationFlowState().goal;
|
|
2103
|
+
const trigger = this.dynamicFlowService.conversationFlowState().triggerTasks.onUserMessage;
|
|
1945
2104
|
// 1) Run Goal Evaluation
|
|
1946
|
-
this.evaluationService.evaluateGoal(goal, this.
|
|
2105
|
+
this.evaluationService.evaluateGoal(goal, this.messagesStateService.getMessagesSignal()());
|
|
1947
2106
|
// 2) Run User Trigger Evaluation
|
|
1948
2107
|
if (trigger) {
|
|
1949
|
-
this.evaluationService
|
|
2108
|
+
this.evaluationService
|
|
2109
|
+
.evaluateConversation(this.messagesStateService.getMessagesSignal()(), trigger, ContextType.LastUserAndPreviousAssistant)
|
|
2110
|
+
.then((evaluation) => {
|
|
1950
2111
|
message.evaluation = evaluation;
|
|
1951
|
-
this.updateMessage(message.messageId, message);
|
|
2112
|
+
this.messagesStateService.updateMessage(message.messageId, message);
|
|
1952
2113
|
console.log('Trigger evaluation result:', evaluation);
|
|
1953
2114
|
});
|
|
1954
2115
|
}
|
|
@@ -1972,7 +2133,7 @@ class ChatFooterComponent {
|
|
|
1972
2133
|
// Inputs
|
|
1973
2134
|
this.isAIThinking = input(false);
|
|
1974
2135
|
this.flow = input();
|
|
1975
|
-
this.micSettings = input({
|
|
2136
|
+
this.micSettings = input({ micMode: 'recognition', lang: 'en' });
|
|
1976
2137
|
// Outputs
|
|
1977
2138
|
this.sendMessage = output();
|
|
1978
2139
|
this.textInputChanged = output();
|
|
@@ -2000,15 +2161,6 @@ class ChatFooterComponent {
|
|
|
2000
2161
|
}
|
|
2001
2162
|
});
|
|
2002
2163
|
}
|
|
2003
|
-
ngOnInit() {
|
|
2004
|
-
// throw new Error('Method not implemented.');
|
|
2005
|
-
// const messages = this.conversationService.getMessagesSignal()();
|
|
2006
|
-
// const firstAssistantMessage = messages.find((msn) => msn.role === ChatRole.Assistant);
|
|
2007
|
-
// if (firstAssistantMessage) {
|
|
2008
|
-
// console.log('Assistant message:', firstAssistantMessage);
|
|
2009
|
-
// this.processBackgroundTask(firstAssistantMessage, ConversationEvents.OnAssistantMessage);
|
|
2010
|
-
// }
|
|
2011
|
-
}
|
|
2012
2164
|
/**
|
|
2013
2165
|
* Method used by the template to determine if the mic should continue listening
|
|
2014
2166
|
*/
|
|
@@ -2103,11 +2255,11 @@ class ChatFooterComponent {
|
|
|
2103
2255
|
}
|
|
2104
2256
|
}
|
|
2105
2257
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.4", ngImport: i0, type: ChatFooterComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
2106
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.4", type: ChatFooterComponent, isStandalone: true, selector: "dc-chat-footer", inputs: { isAIThinking: { classPropertyName: "isAIThinking", publicName: "isAIThinking", isSignal: true, isRequired: false, transformFunction: null }, flow: { classPropertyName: "flow", publicName: "flow", isSignal: true, isRequired: false, transformFunction: null }, micSettings: { classPropertyName: "micSettings", publicName: "micSettings", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { sendMessage: "sendMessage", textInputChanged: "textInputChanged" }, viewQueries: [{ propertyName: "micComponent", first: true, predicate: MicVadComponent, descendants: true }], ngImport: i0, template: "<div class=\"progress-input\">\n <div class=\"input-container\">\n <app-mic-vad\n (audioRecorded)=\"handleAudioRecorded($event)\"\n (statusChanged)=\"handleMicStatusChanged($event)\"\n [continueListening]=\"shouldContinueListening()\"
|
|
2258
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.4", type: ChatFooterComponent, isStandalone: true, selector: "dc-chat-footer", inputs: { isAIThinking: { classPropertyName: "isAIThinking", publicName: "isAIThinking", isSignal: true, isRequired: false, transformFunction: null }, flow: { classPropertyName: "flow", publicName: "flow", isSignal: true, isRequired: false, transformFunction: null }, micSettings: { classPropertyName: "micSettings", publicName: "micSettings", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { sendMessage: "sendMessage", textInputChanged: "textInputChanged" }, viewQueries: [{ propertyName: "micComponent", first: true, predicate: MicVadComponent, descendants: true }], ngImport: i0, template: "<div class=\"progress-input\">\n <div class=\"input-container\">\n <dc-mic (onFinished)=\"handleAudioRecorded($event)\"></dc-mic>\n <!-- \n <app-mic-vad\n (audioRecorded)=\"handleAudioRecorded($event)\"\n (statusChanged)=\"handleMicStatusChanged($event)\"\n [continueListening]=\"shouldContinueListening()\" /> -->\n\n <textarea pTextarea [formControl]=\"chatInputControl\" (keyup.enter)=\"prepareUserMsnAndSend()\" rows=\"1\"></textarea>\n\n <p-button (click)=\"prepareUserMsnAndSend()\" [disabled]=\"isAIThinking() || !chatInputControl.value\" label=\"Enviar\" [rounded]=\"true\" />\n </div>\n\n @if(flow()?.goal) {\n <p-progressbar showValue=\"false\" [value]=\"score()\" [style]=\"{ height: '6px' }\" />\n }\n</div>\n", styles: [".progress-input{padding:10px;background-color:#f5f5f545;border-top:1px solid #b1a8a8}.progress-input .input-container{display:flex;align-items:center;margin-bottom:5px}.progress-input .input-container textarea{flex:1;resize:none;margin:0 10px}.progress-input .input-container .send-button{background-color:#007bff;color:#fff;border:none;border-radius:4px;padding:8px 15px;cursor:pointer}.progress-input .input-container .send-button:disabled{background-color:#ccc;cursor:not-allowed}.progress-input .input-container .send-button:hover:not(:disabled){background-color:#0069d9}\n"], dependencies: [{ kind: "ngmodule", type: ReactiveFormsModule }, { kind: "directive", type: i1.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.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1.FormControlDirective, selector: "[formControl]", inputs: ["formControl", "disabled", "ngModel"], outputs: ["ngModelChange"], exportAs: ["ngForm"] }, { kind: "ngmodule", type: ProgressBarModule }, { kind: "component", type: i2$1.ProgressBar, selector: "p-progressBar, p-progressbar, p-progress-bar", inputs: ["value", "showValue", "styleClass", "valueStyleClass", "style", "unit", "mode", "color"] }, { kind: "ngmodule", type: TextareaModule }, { kind: "directive", type: i4.Textarea, selector: "[pTextarea]", inputs: ["autoResize", "variant", "fluid", "pSize"], outputs: ["onResize"] }, { kind: "ngmodule", type: ButtonModule }, { kind: "component", type: i2.Button, selector: "p-button", inputs: ["type", "iconPos", "icon", "badge", "label", "disabled", "loading", "loadingIcon", "raised", "rounded", "text", "plain", "severity", "outlined", "link", "tabindex", "size", "variant", "style", "styleClass", "badgeClass", "badgeSeverity", "ariaLabel", "autofocus", "fluid", "buttonProps"], outputs: ["onClick", "onFocus", "onBlur"] }, { kind: "component", type: DCMicComponent, selector: "dc-mic", inputs: ["isDone", "targetOrBase", "micSettings"], outputs: ["onInterpretedText", "onFinishedRecognition", "onFinished"] }] }); }
|
|
2107
2259
|
}
|
|
2108
2260
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.4", ngImport: i0, type: ChatFooterComponent, decorators: [{
|
|
2109
2261
|
type: Component,
|
|
2110
|
-
args: [{ selector: 'dc-chat-footer', standalone: true, imports: [ReactiveFormsModule, ProgressBarModule, TextareaModule, ButtonModule, MicVadComponent], template: "<div class=\"progress-input\">\n <div class=\"input-container\">\n <app-mic-vad\n (audioRecorded)=\"handleAudioRecorded($event)\"\n (statusChanged)=\"handleMicStatusChanged($event)\"\n [continueListening]=\"shouldContinueListening()\"
|
|
2262
|
+
args: [{ selector: 'dc-chat-footer', standalone: true, imports: [ReactiveFormsModule, ProgressBarModule, TextareaModule, ButtonModule, MicVadComponent, DCMicComponent], template: "<div class=\"progress-input\">\n <div class=\"input-container\">\n <dc-mic (onFinished)=\"handleAudioRecorded($event)\"></dc-mic>\n <!-- \n <app-mic-vad\n (audioRecorded)=\"handleAudioRecorded($event)\"\n (statusChanged)=\"handleMicStatusChanged($event)\"\n [continueListening]=\"shouldContinueListening()\" /> -->\n\n <textarea pTextarea [formControl]=\"chatInputControl\" (keyup.enter)=\"prepareUserMsnAndSend()\" rows=\"1\"></textarea>\n\n <p-button (click)=\"prepareUserMsnAndSend()\" [disabled]=\"isAIThinking() || !chatInputControl.value\" label=\"Enviar\" [rounded]=\"true\" />\n </div>\n\n @if(flow()?.goal) {\n <p-progressbar showValue=\"false\" [value]=\"score()\" [style]=\"{ height: '6px' }\" />\n }\n</div>\n", styles: [".progress-input{padding:10px;background-color:#f5f5f545;border-top:1px solid #b1a8a8}.progress-input .input-container{display:flex;align-items:center;margin-bottom:5px}.progress-input .input-container textarea{flex:1;resize:none;margin:0 10px}.progress-input .input-container .send-button{background-color:#007bff;color:#fff;border:none;border-radius:4px;padding:8px 15px;cursor:pointer}.progress-input .input-container .send-button:disabled{background-color:#ccc;cursor:not-allowed}.progress-input .input-container .send-button:hover:not(:disabled){background-color:#0069d9}\n"] }]
|
|
2111
2263
|
}], ctorParameters: () => [], propDecorators: { micComponent: [{
|
|
2112
2264
|
type: ViewChild,
|
|
2113
2265
|
args: [MicVadComponent]
|
|
@@ -2720,13 +2872,14 @@ class ChatMessagesListComponent {
|
|
|
2720
2872
|
this.inputMessages = input.required();
|
|
2721
2873
|
// Private services
|
|
2722
2874
|
this.conversationService = inject(ConversationService);
|
|
2875
|
+
this.messagesStateService = inject(MessagesStateService);
|
|
2723
2876
|
this.elementRef = inject(ElementRef);
|
|
2724
2877
|
// State
|
|
2725
2878
|
this.aiIcon = 'assets/defaults/avatar_ai.webp';
|
|
2726
2879
|
this.isThinking = this.conversationService.isThinking();
|
|
2727
2880
|
this.messages = computed(() => {
|
|
2728
2881
|
// Get the actual array of messages from the signal by calling it as a function
|
|
2729
|
-
const allMessages = this.
|
|
2882
|
+
const allMessages = this.messagesStateService.getMessagesSignal()();
|
|
2730
2883
|
console.log('Getting messages', allMessages);
|
|
2731
2884
|
return allMessages.filter((message) => message.role !== ChatRole.System);
|
|
2732
2885
|
});
|
|
@@ -2888,7 +3041,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.4", ngImpor
|
|
|
2888
3041
|
|
|
2889
3042
|
class DCConversationUserChatSettingsComponent {
|
|
2890
3043
|
constructor() {
|
|
2891
|
-
this.dialogRef = inject(DynamicDialogRef);
|
|
3044
|
+
this.dialogRef = inject(DynamicDialogRef, { optional: true });
|
|
2892
3045
|
this.fb = inject(FormBuilder);
|
|
2893
3046
|
this.conversationCardAIService = inject(CONVERSATION_AI_TOKEN);
|
|
2894
3047
|
this.isLoadingModels = true;
|
|
@@ -2902,6 +3055,8 @@ class DCConversationUserChatSettingsComponent {
|
|
|
2902
3055
|
autoTranslate: true,
|
|
2903
3056
|
});
|
|
2904
3057
|
this.onSettingsChange = output();
|
|
3058
|
+
this.closeClicked = output();
|
|
3059
|
+
this.settingsApplied = output();
|
|
2905
3060
|
this.textEngines = Object.values(TextEngines);
|
|
2906
3061
|
this.voiceTTSOptions = Object.values(VoiceTTSOptions);
|
|
2907
3062
|
this.textEngineOptions = TextEngineOptions;
|
|
@@ -2937,16 +3092,27 @@ class DCConversationUserChatSettingsComponent {
|
|
|
2937
3092
|
}
|
|
2938
3093
|
}
|
|
2939
3094
|
close() {
|
|
2940
|
-
this.dialogRef
|
|
3095
|
+
if (this.dialogRef) {
|
|
3096
|
+
this.dialogRef.close();
|
|
3097
|
+
}
|
|
3098
|
+
else {
|
|
3099
|
+
this.closeClicked.emit();
|
|
3100
|
+
}
|
|
2941
3101
|
}
|
|
2942
3102
|
async saveSettings() {
|
|
2943
3103
|
if (this.form.valid) {
|
|
2944
|
-
|
|
2945
|
-
this.
|
|
3104
|
+
const settings = this.form.value;
|
|
3105
|
+
await this.conversationCardAIService.saveConversationUserChatSettings(settings);
|
|
3106
|
+
if (this.dialogRef) {
|
|
3107
|
+
this.dialogRef.close(settings);
|
|
3108
|
+
}
|
|
3109
|
+
else {
|
|
3110
|
+
this.settingsApplied.emit(settings);
|
|
3111
|
+
}
|
|
2946
3112
|
}
|
|
2947
3113
|
}
|
|
2948
3114
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.4", ngImport: i0, type: DCConversationUserChatSettingsComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
2949
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.4", type: DCConversationUserChatSettingsComponent, isStandalone: true, selector: "dc-chat-settings-dialog", inputs: { showFeature: { classPropertyName: "showFeature", publicName: "showFeature", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { onSettingsChange: "onSettingsChange" }, viewQueries: [{ propertyName: "tooltipRef", first: true, predicate: ["tooltipRef"], descendants: true }], ngImport: i0, template: "<div class=\"dialog-container\">\n <form [formGroup]=\"form\">\n @if (showFeature().synthVoice) {\n <div class=\"settings-section\">\n <p>\n <p-checkbox class=\"mr-2\" formControlName=\"synthVoice\" [binary]=\"true\" inputId=\"binary\"></p-checkbox>\n <span [class.cross]=\"form.controls.synthVoice.disabled\">Escuchar Voz</span>\n <br />\n <small>Desmarca si solo quieres leer texto</small>\n </p>\n </div>\n } @if (showFeature().highlightWords) {\n <div class=\"settings-section\">\n <p>\n <p-checkbox class=\"mr-2\" formControlName=\"highlightWords\" [binary]=\"true\" inputId=\"binary\"></p-checkbox>\n <span>Narraci\u00F3n de texto</span>\n <br />\n <small>Remarca las palabras como se van pronuncionando</small>\n </p>\n </div>\n } @if (showFeature().speed) {\n <div class=\"settings-section\">\n <p>\n Velocidad ({{ form.controls.speed.value | speedDisplay }})\n <br />\n\n <!-- <p-rating formControlName=\"speed\" iconOnClass=\"pi pi-step-forward\" iconOffClass=\"pi pi-minus\" /> -->\n\n <p-select\n id=\"speed\"\n [options]=\"speedOptions\"\n formControlName=\"speed\"\n [placeholder]=\"'Select Language'\"\n optionLabel=\"label\"\n optionValue=\"value\"></p-select>\n </p>\n </div>\n } @if (showFeature().realTime) {\n <div class=\"settings-section\">\n <p>\n <p-checkbox class=\"mr-2\" formControlName=\"realTime\" [binary]=\"true\" inputId=\"binary\"></p-checkbox>\n <span [class.cross]=\"form.controls.realTime.disabled\">Tiempo real</span>\n <br />\n <small>No tienes que presionar el microphono, comenzar\u00E1 a grabar en cuanto la AI termine de hablar, cierra el chat para finalizar conversaci\u00F3n.</small>\n </p>\n </div>\n } @if (showFeature().realTime) {\n <div class=\"settings-section\">\n <p>\n <p-checkbox class=\"mr-2\" formControlName=\"repeatRecording\" [binary]=\"true\" inputId=\"binary\"></p-checkbox>\n <span>Reproducir mi grabaci\u00F3n</span>\n <br />\n <small>Escucha tu dialogo, despu\u00E9s de grabar, te ayudar\u00E1 a notar tus errores.</small>\n </p>\n </div>\n } @if (showFeature().superHearing) {\n <div class=\"settings-section\">\n <p>\n <p-checkbox class=\"mr-2\" formControlName=\"superHearing\" [binary]=\"true\" inputId=\"binary\"></p-checkbox>\n <span>Super O\u00EDdo \uD83E\uDDBE</span>\n <br />\n <small>Tu audio se procesa en el servidor para mejor efectividad, si no usa el navegador.</small>\n </p>\n </div>\n }\n\n <!-- @if (showFeature().fixGrammar) {\n <div class=\"settings-section\">\n <p>\n <p-checkbox class=\"mr-2\" formControlName=\"fixGrammar\" [binary]=\"true\" inputId=\"binary\"></p-checkbox>\n <span [class.cross]=\"form.controls.fixGrammar.disabled\">Corregir gram\u00E1tica</span>\n <br />\n <small>La ai corrige tu forma de hablar/escribir y te retrolimenta de tus errores</small>\n </p>\n </div>\n } -->\n\n <!-- @if (showFeature().autoTranslate) {\n <div class=\"settings-section\">\n <p>\n <p-checkbox class=\"mr-2\" formControlName=\"autoTranslate\" [binary]=\"true\" inputId=\"binary\"></p-checkbox>\n <span [class.cross]=\"form.controls.autoTranslate.disabled\">Mostrar Traducciones </span>\n <br />\n <small>Texto adicional con la traducci\u00F3n</small>\n </p>\n </div>\n } -->\n\n @if (showFeature().autoTranslate) {\n <div class=\"voice-selection\">\n <span>Voz Preferencial:</span>\n <br />\n <p-radioButton value=\"random\" formControlName=\"voice\"></p-radioButton>\n <label class=\"space\">Aleatorio</label>\n <p-radioButton value=\"randomMan\" formControlName=\"voice\"></p-radioButton>\n <label class=\"space\">Hombre</label>\n <p-radioButton value=\"randomWoman\" formControlName=\"voice\"></p-radioButton>\n <label class=\"space\">Mujer</label>\n </div>\n }\n\n <div class=\"settings-section\">\n <p>\n <p-checkbox class=\"mr-2\" formControlName=\"userMessageTask\" [binary]=\"true\" inputId=\"binary\"></p-checkbox>\n <span [class.cross]=\"form.controls.userMessageTask.disabled\">Procesar mensajes de usuario</span>\n <br />\n <small>Correcciones, mejoras, retroalimentaci\u00F3n y sugerencias en el texto del usuario </small>\n </p>\n </div>\n\n <div class=\"settings-section\">\n <p>\n <p-checkbox class=\"mr-2\" formControlName=\"assistantMessageTask\" [binary]=\"true\" inputId=\"binary\"></p-checkbox>\n <span [class.cross]=\"form.controls.assistantMessageTask.disabled\">Procesar mensajes de asistente</span>\n <br />\n <small>Correcciones, traducciones, pensamientos adicionales y m\u00E1s ayuda en el texto del asistente </small>\n </p>\n </div>\n\n @if(isAdmin) {\n <div>\n <hr />\n <b>Admin Section</b>\n <br />\n\n <b>Modelo:</b>\n\n <dc-model-selector [modelForm]=\"form.controls.model\"></dc-model-selector>\n </div>\n }\n\n <div class=\"button-group\">\n <p-button (click)=\"saveSettings()\" label=\"Guardar cambios\"></p-button>\n <p-button (click)=\"close()\" label=\"Cancelar\" styleClass=\"p-button-secondary\"></p-button>\n </div>\n </form>\n</div>\n", styles: [".dialog-container{padding:20px;background:#fff;border-radius:8px;min-width:300px;max-width:500px}.dialog-content{margin:20px 0}.dialog-actions{display:flex;justify-content:flex-end}.settings-section{margin-bottom:20px}.settings-section label{display:block;margin-bottom:5px;font-weight:700}.settings-section small{display:block;color:#666;margin-top:2px}.voice-selection{margin:15px 0}.voice-selection label{margin-right:15px}.button-group{margin-top:20px;display:flex;gap:10px;justify-content:flex-end}button{padding:8px 16px;border-radius:4px;border:none;cursor:pointer}button:first-child{background-color:#007bff;color:#fff}button:last-child{background-color:#6c757d;color:#fff}.space{margin-left:3px}\n"], dependencies: [{ kind: "ngmodule", type: ReactiveFormsModule }, { kind: "directive", type: i1.ɵNgNoValidate, selector: "form:not([ngNoForm]):not([ngNativeValidate])" }, { kind: "directive", type: i1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i1.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "directive", type: i1.FormControlName, selector: "[formControlName]", inputs: ["formControlName", "disabled", "ngModel"], outputs: ["ngModelChange"] }, { kind: "ngmodule", type: CheckboxModule }, { kind: "component", type: i2$3.Checkbox, selector: "p-checkbox, p-checkBox, p-check-box", inputs: ["value", "name", "disabled", "binary", "ariaLabelledBy", "ariaLabel", "tabindex", "inputId", "style", "inputStyle", "styleClass", "inputClass", "indeterminate", "size", "formControl", "checkboxIcon", "readonly", "required", "autofocus", "trueValue", "falseValue", "variant"], outputs: ["onChange", "onFocus", "onBlur"] }, { kind: "ngmodule", type: SliderModule }, { kind: "ngmodule", type: RadioButtonModule }, { kind: "component", type: i3$1.RadioButton, selector: "p-radioButton, p-radiobutton, p-radio-button", inputs: ["value", "formControlName", "name", "disabled", "variant", "size", "tabindex", "inputId", "ariaLabelledBy", "ariaLabel", "style", "styleClass", "autofocus", "binary"], outputs: ["onClick", "onFocus", "onBlur"] }, { kind: "ngmodule", type: ButtonModule }, { kind: "component", type: i2$1.Button, selector: "p-button", inputs: ["type", "iconPos", "icon", "badge", "label", "disabled", "loading", "loadingIcon", "raised", "rounded", "text", "plain", "severity", "outlined", "link", "tabindex", "size", "variant", "style", "styleClass", "badgeClass", "badgeSeverity", "ariaLabel", "autofocus", "fluid", "buttonProps"], outputs: ["onClick", "onFocus", "onBlur"] }, { kind: "pipe", type: SpeedDescPipe, name: "speedDisplay" }, { kind: "ngmodule", type: RatingModule }, { kind: "ngmodule", type: TableModule }, { kind: "ngmodule", type: BadgeModule }, { kind: "ngmodule", type: SkeletonModule }, { kind: "ngmodule", type: TooltipModule }, { kind: "component", type: ModelSelectorComponent, selector: "dc-model-selector", inputs: ["modelForm", "shortForm"] }, { kind: "ngmodule", type: SelectModule }, { kind: "component", type: i5.Select, selector: "p-select", inputs: ["id", "scrollHeight", "filter", "name", "style", "panelStyle", "styleClass", "panelStyleClass", "readonly", "required", "editable", "appendTo", "tabindex", "placeholder", "loadingIcon", "filterPlaceholder", "filterLocale", "variant", "inputId", "dataKey", "filterBy", "filterFields", "autofocus", "resetFilterOnHide", "checkmark", "dropdownIcon", "loading", "optionLabel", "optionValue", "optionDisabled", "optionGroupLabel", "optionGroupChildren", "autoDisplayFirst", "group", "showClear", "emptyFilterMessage", "emptyMessage", "lazy", "virtualScroll", "virtualScrollItemSize", "virtualScrollOptions", "size", "overlayOptions", "ariaFilterLabel", "ariaLabel", "ariaLabelledBy", "filterMatchMode", "maxlength", "tooltip", "tooltipPosition", "tooltipPositionStyle", "tooltipStyleClass", "focusOnHover", "selectOnFocus", "autoOptionFocus", "autofocusFilter", "fluid", "disabled", "itemSize", "autoZIndex", "baseZIndex", "showTransitionOptions", "hideTransitionOptions", "filterValue", "options"], outputs: ["onChange", "onFilter", "onFocus", "onBlur", "onClick", "onShow", "onHide", "onClear", "onLazyLoad"] }] }); }
|
|
3115
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.4", type: DCConversationUserChatSettingsComponent, isStandalone: true, selector: "dc-chat-settings-dialog", inputs: { showFeature: { classPropertyName: "showFeature", publicName: "showFeature", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { onSettingsChange: "onSettingsChange", closeClicked: "closeClicked", settingsApplied: "settingsApplied" }, viewQueries: [{ propertyName: "tooltipRef", first: true, predicate: ["tooltipRef"], descendants: true }], ngImport: i0, template: "<div class=\"dialog-container\">\n <form [formGroup]=\"form\">\n @if (showFeature().synthVoice) {\n <div class=\"settings-section\">\n <p>\n <p-checkbox class=\"mr-2\" formControlName=\"synthVoice\" [binary]=\"true\" inputId=\"binary\"></p-checkbox>\n <span [class.cross]=\"form.controls.synthVoice.disabled\">Escuchar Voz</span>\n <br />\n <small>Desmarca si solo quieres leer texto</small>\n </p>\n </div>\n } @if (showFeature().highlightWords) {\n <div class=\"settings-section\">\n <p>\n <p-checkbox class=\"mr-2\" formControlName=\"highlightWords\" [binary]=\"true\" inputId=\"binary\"></p-checkbox>\n <span>Narraci\u00F3n de texto</span>\n <br />\n <small>Remarca las palabras como se van pronuncionando</small>\n </p>\n </div>\n } @if (showFeature().speed) {\n <div class=\"settings-section\">\n <p>\n Velocidad ({{ form.controls.speed.value | speedDisplay }})\n <br />\n\n <!-- <p-rating formControlName=\"speed\" iconOnClass=\"pi pi-step-forward\" iconOffClass=\"pi pi-minus\" /> -->\n\n <p-select\n id=\"speed\"\n [options]=\"speedOptions\"\n formControlName=\"speed\"\n [placeholder]=\"'Select Language'\"\n optionLabel=\"label\"\n optionValue=\"value\"></p-select>\n </p>\n </div>\n } @if (showFeature().realTime) {\n <div class=\"settings-section\">\n <p>\n <p-checkbox class=\"mr-2\" formControlName=\"realTime\" [binary]=\"true\" inputId=\"binary\"></p-checkbox>\n <span [class.cross]=\"form.controls.realTime.disabled\">Tiempo real</span>\n <br />\n <small>No tienes que presionar el microphono, comenzar\u00E1 a grabar en cuanto la AI termine de hablar, cierra el chat para finalizar conversaci\u00F3n.</small>\n </p>\n </div>\n } @if (showFeature().realTime) {\n <div class=\"settings-section\">\n <p>\n <p-checkbox class=\"mr-2\" formControlName=\"repeatRecording\" [binary]=\"true\" inputId=\"binary\"></p-checkbox>\n <span>Reproducir mi grabaci\u00F3n</span>\n <br />\n <small>Escucha tu dialogo, despu\u00E9s de grabar, te ayudar\u00E1 a notar tus errores.</small>\n </p>\n </div>\n } @if (showFeature().superHearing) {\n <div class=\"settings-section\">\n <p>\n <p-checkbox class=\"mr-2\" formControlName=\"superHearing\" [binary]=\"true\" inputId=\"binary\"></p-checkbox>\n <span>Super O\u00EDdo \uD83E\uDDBE</span>\n <br />\n <small>Tu audio se procesa en el servidor para mejor efectividad, si no usa el navegador.</small>\n </p>\n </div>\n }\n\n <!-- @if (showFeature().fixGrammar) {\n <div class=\"settings-section\">\n <p>\n <p-checkbox class=\"mr-2\" formControlName=\"fixGrammar\" [binary]=\"true\" inputId=\"binary\"></p-checkbox>\n <span [class.cross]=\"form.controls.fixGrammar.disabled\">Corregir gram\u00E1tica</span>\n <br />\n <small>La ai corrige tu forma de hablar/escribir y te retrolimenta de tus errores</small>\n </p>\n </div>\n } -->\n\n <!-- @if (showFeature().autoTranslate) {\n <div class=\"settings-section\">\n <p>\n <p-checkbox class=\"mr-2\" formControlName=\"autoTranslate\" [binary]=\"true\" inputId=\"binary\"></p-checkbox>\n <span [class.cross]=\"form.controls.autoTranslate.disabled\">Mostrar Traducciones </span>\n <br />\n <small>Texto adicional con la traducci\u00F3n</small>\n </p>\n </div>\n } -->\n\n @if (showFeature().autoTranslate) {\n <div class=\"voice-selection\">\n <span>Voz Preferencial:</span>\n <br />\n <p-radioButton value=\"random\" formControlName=\"voice\"></p-radioButton>\n <label class=\"space\">Aleatorio</label>\n <p-radioButton value=\"randomMan\" formControlName=\"voice\"></p-radioButton>\n <label class=\"space\">Hombre</label>\n <p-radioButton value=\"randomWoman\" formControlName=\"voice\"></p-radioButton>\n <label class=\"space\">Mujer</label>\n </div>\n }\n\n <div class=\"settings-section\">\n <p>\n <p-checkbox class=\"mr-2\" formControlName=\"userMessageTask\" [binary]=\"true\" inputId=\"binary\"></p-checkbox>\n <span [class.cross]=\"form.controls.userMessageTask.disabled\">Procesar mensajes de usuario</span>\n <br />\n <small>Correcciones, mejoras, retroalimentaci\u00F3n y sugerencias en el texto del usuario </small>\n </p>\n </div>\n\n <div class=\"settings-section\">\n <p>\n <p-checkbox class=\"mr-2\" formControlName=\"assistantMessageTask\" [binary]=\"true\" inputId=\"binary\"></p-checkbox>\n <span [class.cross]=\"form.controls.assistantMessageTask.disabled\">Procesar mensajes de asistente</span>\n <br />\n <small>Correcciones, traducciones, pensamientos adicionales y m\u00E1s ayuda en el texto del asistente </small>\n </p>\n </div>\n\n @if(isAdmin) {\n <div>\n <hr />\n <b>Admin Section</b>\n <br />\n\n <b>Modelo:</b>\n\n <dc-model-selector [modelForm]=\"form.controls.model\"></dc-model-selector>\n </div>\n }\n\n <div class=\"button-group\">\n <p-button (click)=\"saveSettings()\" label=\"Guardar cambios\"></p-button>\n <p-button (click)=\"close()\" label=\"Cancelar\" styleClass=\"p-button-secondary\"></p-button>\n </div>\n </form>\n</div>\n", styles: [".dialog-container{padding:20px;background:#fff;border-radius:8px;min-width:300px;max-width:500px}.dialog-content{margin:20px 0}.dialog-actions{display:flex;justify-content:flex-end}.settings-section{margin-bottom:20px}.settings-section label{display:block;margin-bottom:5px;font-weight:700}.settings-section small{display:block;color:#666;margin-top:2px}.voice-selection{margin:15px 0}.voice-selection label{margin-right:15px}.button-group{margin-top:20px;display:flex;gap:10px;justify-content:flex-end}button{padding:8px 16px;border-radius:4px;border:none;cursor:pointer}button:first-child{background-color:#007bff;color:#fff}button:last-child{background-color:#6c757d;color:#fff}.space{margin-left:3px}\n"], dependencies: [{ kind: "ngmodule", type: ReactiveFormsModule }, { kind: "directive", type: i1.ɵNgNoValidate, selector: "form:not([ngNoForm]):not([ngNativeValidate])" }, { kind: "directive", type: i1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i1.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "directive", type: i1.FormControlName, selector: "[formControlName]", inputs: ["formControlName", "disabled", "ngModel"], outputs: ["ngModelChange"] }, { kind: "ngmodule", type: CheckboxModule }, { kind: "component", type: i2$3.Checkbox, selector: "p-checkbox, p-checkBox, p-check-box", inputs: ["value", "name", "disabled", "binary", "ariaLabelledBy", "ariaLabel", "tabindex", "inputId", "style", "inputStyle", "styleClass", "inputClass", "indeterminate", "size", "formControl", "checkboxIcon", "readonly", "required", "autofocus", "trueValue", "falseValue", "variant"], outputs: ["onChange", "onFocus", "onBlur"] }, { kind: "ngmodule", type: SliderModule }, { kind: "ngmodule", type: RadioButtonModule }, { kind: "component", type: i3.RadioButton, selector: "p-radioButton, p-radiobutton, p-radio-button", inputs: ["value", "formControlName", "name", "disabled", "variant", "size", "tabindex", "inputId", "ariaLabelledBy", "ariaLabel", "style", "styleClass", "autofocus", "binary"], outputs: ["onClick", "onFocus", "onBlur"] }, { kind: "ngmodule", type: ButtonModule }, { kind: "component", type: i2.Button, selector: "p-button", inputs: ["type", "iconPos", "icon", "badge", "label", "disabled", "loading", "loadingIcon", "raised", "rounded", "text", "plain", "severity", "outlined", "link", "tabindex", "size", "variant", "style", "styleClass", "badgeClass", "badgeSeverity", "ariaLabel", "autofocus", "fluid", "buttonProps"], outputs: ["onClick", "onFocus", "onBlur"] }, { kind: "pipe", type: SpeedDescPipe, name: "speedDisplay" }, { kind: "ngmodule", type: RatingModule }, { kind: "ngmodule", type: TableModule }, { kind: "ngmodule", type: BadgeModule }, { kind: "ngmodule", type: SkeletonModule }, { kind: "ngmodule", type: TooltipModule }, { kind: "component", type: ModelSelectorComponent, selector: "dc-model-selector", inputs: ["modelForm", "shortForm"] }, { kind: "ngmodule", type: SelectModule }, { kind: "component", type: i5.Select, selector: "p-select", inputs: ["id", "scrollHeight", "filter", "name", "style", "panelStyle", "styleClass", "panelStyleClass", "readonly", "required", "editable", "appendTo", "tabindex", "placeholder", "loadingIcon", "filterPlaceholder", "filterLocale", "variant", "inputId", "dataKey", "filterBy", "filterFields", "autofocus", "resetFilterOnHide", "checkmark", "dropdownIcon", "loading", "optionLabel", "optionValue", "optionDisabled", "optionGroupLabel", "optionGroupChildren", "autoDisplayFirst", "group", "showClear", "emptyFilterMessage", "emptyMessage", "lazy", "virtualScroll", "virtualScrollItemSize", "virtualScrollOptions", "size", "overlayOptions", "ariaFilterLabel", "ariaLabel", "ariaLabelledBy", "filterMatchMode", "maxlength", "tooltip", "tooltipPosition", "tooltipPositionStyle", "tooltipStyleClass", "focusOnHover", "selectOnFocus", "autoOptionFocus", "autofocusFilter", "fluid", "disabled", "itemSize", "autoZIndex", "baseZIndex", "showTransitionOptions", "hideTransitionOptions", "filterValue", "options"], outputs: ["onChange", "onFilter", "onFocus", "onBlur", "onClick", "onShow", "onHide", "onClear", "onLazyLoad"] }] }); }
|
|
2950
3116
|
}
|
|
2951
3117
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.4", ngImport: i0, type: DCConversationUserChatSettingsComponent, decorators: [{
|
|
2952
3118
|
type: Component,
|
|
@@ -2977,6 +3143,7 @@ class DCChatComponent {
|
|
|
2977
3143
|
this.conversationService = inject(ConversationService);
|
|
2978
3144
|
this.evaluationService = inject(EvaluationService);
|
|
2979
3145
|
this.userDataExchange = inject(USER_DATA_EXCHANGE);
|
|
3146
|
+
this.messageStateService = inject(MessagesStateService);
|
|
2980
3147
|
// 📥 Inputs
|
|
2981
3148
|
this.chatUserSettings = this.userDataExchange.getUserChatSettings(); // Default to user data exchange
|
|
2982
3149
|
this.conversationFlow = null;
|
|
@@ -2990,7 +3157,7 @@ class DCChatComponent {
|
|
|
2990
3157
|
// Signals States
|
|
2991
3158
|
this.messages = signal([]);
|
|
2992
3159
|
// States
|
|
2993
|
-
this.micSettings = {
|
|
3160
|
+
this.micSettings = { micMode: 'recognition', lang: 'en' };
|
|
2994
3161
|
this.isInfoVisible = false;
|
|
2995
3162
|
this.isAdmin = true;
|
|
2996
3163
|
// Subscribe to score updates using effect
|
|
@@ -3059,11 +3226,11 @@ class DCChatComponent {
|
|
|
3059
3226
|
await this.ngOnInit();
|
|
3060
3227
|
}
|
|
3061
3228
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.4", ngImport: i0, type: DCChatComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
3062
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.
|
|
3229
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.4", 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: { sendMessage: "sendMessage", goalCompleted: "goalCompleted" }, providers: [DialogService], viewQueries: [{ propertyName: "chatFooterComponent", first: true, predicate: ChatFooterComponent, descendants: true }], ngImport: i0, template: "<div class=\"chat-container\">\n <!-- Chat Header -->\n <dc-chat-header\n [agentCard]=\"agentCard\"\n [isAdmin]=\"isAdmin\"\n (showInfoEvent)=\"showInfo()\"\n (settingsClickEvent)=\"changeUserChatSettings()\"\n (restartConversationEvent)=\"restartConversation($event)\">\n </dc-chat-header>\n\n <!-- Messages List -->\n <dc-chat-messages-list [chatUserSettings]=\"chatUserSettings\" [inputMessages]=\"messages()\"> </dc-chat-messages-list>\n\n <!-- Chat Footer -->\n <dc-chat-footer [micSettings]=\"micSettings\" [flow]=\"conversationFlow\"> </dc-chat-footer>\n\n <!-- Info Dialog -->\n</div>\n\n<p-dialog [style]=\"{ width: '100vw',}\" [(visible)]=\"isInfoVisible\" [modal]=\"true\" [draggable]=\"false\" [resizable]=\"false\" header=\"Conversation Info\">\n <div class=\"info-content\">\n <div> points : {{ evaluationService.scoreSignal() }} </div>\n <details>\n <summary>Messages</summary>\n @for (message of messageStateService.getMessagesSignal()(); track message.messageId) {\n <h6>\n @if (message.role === 'system') {\n <b class=\"text-red-500\" style=\"text-transform: capitalize\">{{ message.role }}</b> - } @else {\n <b style=\"text-transform: capitalize\">{{ message.role }}</b> - }\n <b style=\"color: var(--info-color); text-transform: capitalize\">{{ message.messageId }}</b></h6\n >\n <p>{{ message.content }}</p>\n }\n </details>\n\n <details>\n <summary>Agent Card</summary>\n <pre>{{ agentCard | safeJson }}</pre>\n </details>\n\n <details>\n <summary>User Settings</summary>\n <pre>{{ chatUserSettings | safeJson }}</pre>\n </details>\n </div>\n</p-dialog>\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: ["isAdmin", "alternativeConversation", "agentCard"], outputs: ["restartConversationEvent", "showInfoEvent", "settingsClickEvent"] }, { kind: "component", type: ChatFooterComponent, selector: "dc-chat-footer", inputs: ["isAIThinking", "flow", "micSettings"], outputs: ["sendMessage", "textInputChanged"] }, { kind: "component", type: ChatMessagesListComponent, selector: "dc-chat-messages-list", inputs: ["chatUserSettings", "inputMessages"] }, { kind: "ngmodule", type: DialogModule }, { kind: "component", type: i1$3.Dialog, selector: "p-dialog", inputs: ["header", "draggable", "resizable", "positionLeft", "positionTop", "contentStyle", "contentStyleClass", "modal", "closeOnEscape", "dismissableMask", "rtl", "closable", "responsive", "appendTo", "breakpoints", "styleClass", "maskStyleClass", "maskStyle", "showHeader", "breakpoint", "blockScroll", "autoZIndex", "baseZIndex", "minX", "minY", "focusOnShow", "maximizable", "keepInViewport", "focusTrap", "transitionOptions", "closeIcon", "closeAriaLabel", "closeTabindex", "minimizeIcon", "maximizeIcon", "closeButtonProps", "maximizeButtonProps", "visible", "style", "position", "role", "content", "contentTemplate", "footerTemplate", "closeIconTemplate", "maximizeIconTemplate", "minimizeIconTemplate", "headlessTemplate"], outputs: ["onShow", "onHide", "visibleChange", "onResizeInit", "onResizeEnd", "onDragEnd", "onMaximize"] }, { kind: "ngmodule", type: ProgressBarModule }, { kind: "pipe", type: SafeJsonPipe, name: "safeJson" }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
3063
3230
|
}
|
|
3064
3231
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.4", ngImport: i0, type: DCChatComponent, decorators: [{
|
|
3065
3232
|
type: Component,
|
|
3066
|
-
args: [{ selector: 'dc-chat', standalone: true, imports: [CommonModule, ChatHeaderComponent, ChatFooterComponent, ChatMessagesListComponent, DialogModule, ProgressBarModule, SafeJsonPipe], changeDetection: ChangeDetectionStrategy.OnPush, providers: [DialogService], template: "<div class=\"chat-container\">\n <!-- Chat Header -->\n <dc-chat-header\n [agentCard]=\"agentCard\"\n [isAdmin]=\"isAdmin\"\n (showInfoEvent)=\"showInfo()\"\n (settingsClickEvent)=\"changeUserChatSettings()\"\n (restartConversationEvent)=\"restartConversation($event)\">\n </dc-chat-header>\n\n <!-- Messages List -->\n <dc-chat-messages-list [chatUserSettings]=\"chatUserSettings\" [inputMessages]=\"messages()\"> </dc-chat-messages-list>\n\n <!-- Chat Footer -->\n <dc-chat-footer [micSettings]=\"micSettings\" [flow]=\"conversationFlow\"> </dc-chat-footer>\n\n <!-- Info Dialog -->\n
|
|
3233
|
+
args: [{ selector: 'dc-chat', standalone: true, imports: [CommonModule, ChatHeaderComponent, ChatFooterComponent, ChatMessagesListComponent, DialogModule, ProgressBarModule, SafeJsonPipe], changeDetection: ChangeDetectionStrategy.OnPush, providers: [DialogService], template: "<div class=\"chat-container\">\n <!-- Chat Header -->\n <dc-chat-header\n [agentCard]=\"agentCard\"\n [isAdmin]=\"isAdmin\"\n (showInfoEvent)=\"showInfo()\"\n (settingsClickEvent)=\"changeUserChatSettings()\"\n (restartConversationEvent)=\"restartConversation($event)\">\n </dc-chat-header>\n\n <!-- Messages List -->\n <dc-chat-messages-list [chatUserSettings]=\"chatUserSettings\" [inputMessages]=\"messages()\"> </dc-chat-messages-list>\n\n <!-- Chat Footer -->\n <dc-chat-footer [micSettings]=\"micSettings\" [flow]=\"conversationFlow\"> </dc-chat-footer>\n\n <!-- Info Dialog -->\n</div>\n\n<p-dialog [style]=\"{ width: '100vw',}\" [(visible)]=\"isInfoVisible\" [modal]=\"true\" [draggable]=\"false\" [resizable]=\"false\" header=\"Conversation Info\">\n <div class=\"info-content\">\n <div> points : {{ evaluationService.scoreSignal() }} </div>\n <details>\n <summary>Messages</summary>\n @for (message of messageStateService.getMessagesSignal()(); track message.messageId) {\n <h6>\n @if (message.role === 'system') {\n <b class=\"text-red-500\" style=\"text-transform: capitalize\">{{ message.role }}</b> - } @else {\n <b style=\"text-transform: capitalize\">{{ message.role }}</b> - }\n <b style=\"color: var(--info-color); text-transform: capitalize\">{{ message.messageId }}</b></h6\n >\n <p>{{ message.content }}</p>\n }\n </details>\n\n <details>\n <summary>Agent Card</summary>\n <pre>{{ agentCard | safeJson }}</pre>\n </details>\n\n <details>\n <summary>User Settings</summary>\n <pre>{{ chatUserSettings | safeJson }}</pre>\n </details>\n </div>\n</p-dialog>\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"] }]
|
|
3067
3234
|
}], ctorParameters: () => [], propDecorators: { chatFooterComponent: [{
|
|
3068
3235
|
type: ViewChild,
|
|
3069
3236
|
args: [ChatFooterComponent]
|
|
@@ -3077,6 +3244,51 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.4", ngImpor
|
|
|
3077
3244
|
type: Input
|
|
3078
3245
|
}] } });
|
|
3079
3246
|
|
|
3247
|
+
class PromptConversationTypesDialogComponent {
|
|
3248
|
+
constructor() {
|
|
3249
|
+
this.dialogRef = inject(DynamicDialogRef);
|
|
3250
|
+
this.conversationTypeOptions = ConversationTypeOptions;
|
|
3251
|
+
}
|
|
3252
|
+
getDefaultPromptByType(conversationType) {
|
|
3253
|
+
return getDefaultPromptByType(conversationType);
|
|
3254
|
+
}
|
|
3255
|
+
selectOption(option) {
|
|
3256
|
+
this.dialogRef.close(option);
|
|
3257
|
+
}
|
|
3258
|
+
close() {
|
|
3259
|
+
this.dialogRef.close();
|
|
3260
|
+
}
|
|
3261
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.4", ngImport: i0, type: PromptConversationTypesDialogComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
3262
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.4", type: PromptConversationTypesDialogComponent, isStandalone: true, selector: "dc-prompt-conversation-types-dialog", ngImport: i0, template: `
|
|
3263
|
+
<div class="prompt-conversation-types-dialog-content p-d-flex p-flex-column p-gap-2">
|
|
3264
|
+
@for (option of conversationTypeOptions; track $index) {
|
|
3265
|
+
<h4 class="p-text-center text-blue-500"
|
|
3266
|
+
><b>{{ option.label }}</b></h4
|
|
3267
|
+
>
|
|
3268
|
+
<p>{{ getDefaultPromptByType(option.value) }}</p>
|
|
3269
|
+
}
|
|
3270
|
+
</div>
|
|
3271
|
+
`, isInline: true, dependencies: [{ kind: "ngmodule", type: DialogModule }, { kind: "ngmodule", type: ButtonModule }] }); }
|
|
3272
|
+
}
|
|
3273
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.4", ngImport: i0, type: PromptConversationTypesDialogComponent, decorators: [{
|
|
3274
|
+
type: Component,
|
|
3275
|
+
args: [{
|
|
3276
|
+
selector: 'dc-prompt-conversation-types-dialog',
|
|
3277
|
+
standalone: true,
|
|
3278
|
+
imports: [DialogModule, ButtonModule],
|
|
3279
|
+
template: `
|
|
3280
|
+
<div class="prompt-conversation-types-dialog-content p-d-flex p-flex-column p-gap-2">
|
|
3281
|
+
@for (option of conversationTypeOptions; track $index) {
|
|
3282
|
+
<h4 class="p-text-center text-blue-500"
|
|
3283
|
+
><b>{{ option.label }}</b></h4
|
|
3284
|
+
>
|
|
3285
|
+
<p>{{ getDefaultPromptByType(option.value) }}</p>
|
|
3286
|
+
}
|
|
3287
|
+
</div>
|
|
3288
|
+
`,
|
|
3289
|
+
}]
|
|
3290
|
+
}] });
|
|
3291
|
+
|
|
3080
3292
|
async function getCharacterData(file) {
|
|
3081
3293
|
if (file.name.endsWith('.png')) {
|
|
3082
3294
|
const filebuffer = await getFileBuffer(file);
|
|
@@ -3218,6 +3430,7 @@ class PromptPreviewDialogComponent {
|
|
|
3218
3430
|
constructor() {
|
|
3219
3431
|
this.dynamicDialogConfig = inject(DynamicDialogConfig);
|
|
3220
3432
|
this.dialogRef = inject(DynamicDialogRef);
|
|
3433
|
+
debugger;
|
|
3221
3434
|
this.data = this.dynamicDialogConfig.data;
|
|
3222
3435
|
}
|
|
3223
3436
|
close() {
|
|
@@ -3302,65 +3515,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.4", ngImpor
|
|
|
3302
3515
|
`, styles: [".translate-dialog{padding:20px;background:#fff;border-radius:8px;box-shadow:0 2px 8px #00000026}.actions{margin-top:20px;display:flex;justify-content:flex-end;gap:10px}select{width:100%;padding:8px;margin-top:10px;border:1px solid #ccc;border-radius:4px}button{padding:8px 16px;border:none;border-radius:4px;cursor:pointer}button:first-child{background:#f0f0f0}button:last-child{background:#007bff;color:#fff}button:disabled{background:#ccc;cursor:not-allowed}h2{margin:0 0 16px;color:#333}\n"] }]
|
|
3303
3516
|
}], ctorParameters: () => [] });
|
|
3304
3517
|
|
|
3305
|
-
function markdownToHTML(markdownText) {
|
|
3306
|
-
// Convert italics-bold (***text***)
|
|
3307
|
-
let htmlText = markdownText.replace(/\*\*\*(.+?)\*\*\*/g, '<em><strong>$1</strong></em>');
|
|
3308
|
-
// Convert bold (**text**)
|
|
3309
|
-
htmlText = htmlText.replace(/\*\*(.+?)\*\*/g, '<strong>$1</strong>');
|
|
3310
|
-
// Convert italics (*text*)
|
|
3311
|
-
htmlText = htmlText.replace(/\*(.+?)\*/g, '<em>$1</em>');
|
|
3312
|
-
// Convert text enclosed by double quotes ("text")
|
|
3313
|
-
// htmlText = htmlText.replace(/"(.+?)"/g, '<cite>$1</cite>');
|
|
3314
|
-
return htmlText;
|
|
3315
|
-
}
|
|
3316
|
-
class SimpleMdToHtmlPipe {
|
|
3317
|
-
transform(text) {
|
|
3318
|
-
return markdownToHTML(text);
|
|
3319
|
-
}
|
|
3320
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.4", ngImport: i0, type: SimpleMdToHtmlPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe }); }
|
|
3321
|
-
static { this.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "19.2.4", ngImport: i0, type: SimpleMdToHtmlPipe, isStandalone: true, name: "simpleMdToHtml" }); }
|
|
3322
|
-
}
|
|
3323
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.4", ngImport: i0, type: SimpleMdToHtmlPipe, decorators: [{
|
|
3324
|
-
type: Pipe,
|
|
3325
|
-
args: [{
|
|
3326
|
-
name: 'simpleMdToHtml',
|
|
3327
|
-
standalone: true,
|
|
3328
|
-
}]
|
|
3329
|
-
}] });
|
|
3330
|
-
class StartDivToHtmlPipe {
|
|
3331
|
-
// solo create espacio entre lineas
|
|
3332
|
-
transform(text) {
|
|
3333
|
-
text = text.replace(/<start>/gi, '<hr>');
|
|
3334
|
-
text = text.replace(/\n/g, '<br>');
|
|
3335
|
-
return text;
|
|
3336
|
-
}
|
|
3337
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.4", ngImport: i0, type: StartDivToHtmlPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe }); }
|
|
3338
|
-
static { this.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "19.2.4", ngImport: i0, type: StartDivToHtmlPipe, isStandalone: true, name: "startDividerToHtml" }); }
|
|
3339
|
-
}
|
|
3340
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.4", ngImport: i0, type: StartDivToHtmlPipe, decorators: [{
|
|
3341
|
-
type: Pipe,
|
|
3342
|
-
args: [{
|
|
3343
|
-
name: 'startDividerToHtml',
|
|
3344
|
-
standalone: true,
|
|
3345
|
-
}]
|
|
3346
|
-
}] });
|
|
3347
|
-
class MdToHtmlArrayPipe {
|
|
3348
|
-
// devuelve un array de objetos con el contenido y el tag
|
|
3349
|
-
transform(text) {
|
|
3350
|
-
const htmlArray = convertToHTML(text);
|
|
3351
|
-
return htmlArray.map((val) => val.content).join('');
|
|
3352
|
-
}
|
|
3353
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.4", ngImport: i0, type: MdToHtmlArrayPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe }); }
|
|
3354
|
-
static { this.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "19.2.4", ngImport: i0, type: MdToHtmlArrayPipe, isStandalone: true, name: "mdToHtmlArray" }); }
|
|
3355
|
-
}
|
|
3356
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.4", ngImport: i0, type: MdToHtmlArrayPipe, decorators: [{
|
|
3357
|
-
type: Pipe,
|
|
3358
|
-
args: [{
|
|
3359
|
-
name: 'mdToHtmlArray',
|
|
3360
|
-
standalone: true,
|
|
3361
|
-
}]
|
|
3362
|
-
}] });
|
|
3363
|
-
|
|
3364
3518
|
class AccountPlatformForm {
|
|
3365
3519
|
constructor() {
|
|
3366
3520
|
this.route = inject(ActivatedRoute);
|
|
@@ -3422,7 +3576,7 @@ class AccountPlatformForm {
|
|
|
3422
3576
|
}
|
|
3423
3577
|
}
|
|
3424
3578
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.4", ngImport: i0, type: AccountPlatformForm, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
3425
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.4", type: AccountPlatformForm, isStandalone: true, selector: "account-platform-form", inputs: { formArray: "formArray" }, ngImport: i0, template: "<div class=\"source-form-card\">\n <p-card header=\"Cuenta\">\n @for (formAccount of formArray.controls; track formAccount) {\n <form [formGroup]=\"$any(formAccount)\">\n <div class=\"form-field\">\n <label class=\"block\">Platform</label>\n <p-dropdown [options]=\"platformOptions\" formControlName=\"platform\" optionLabel=\"label\" optionValue=\"value\" placeholder=\"Select a platform\"></p-dropdown>\n </div>\n\n <div class=\"form-field\">\n <label for=\"name\" class=\"block\">Username</label>\n <input pInputText id=\"name\" type=\"text\" formControlName=\"name\" placeholder=\"Enter name\" class=\"w-full\" />\n </div>\n\n <div class=\"form-field\">\n <label class=\"block\">Email</label>\n <input pInputText type=\"text\" formControlName=\"email\" placeholder=\"Enter name\" class=\"w-full\" />\n </div>\n </form>\n }\n </p-card>\n</div>\n", styles: [":host{display:block;padding:1rem}.source-form-card{max-width:800px;margin:0 auto}.form-field{margin-bottom:1.5rem;display:flex;flex-direction:column}.form-field label{margin-bottom:.5rem;font-weight:500;color:#495057}.form-field input,.form-field textarea,.form-field ::ng-deep .p-element{margin-top:.25rem}:host ::ng-deep .p-card .p-card-content>div:last-child{margin-top:1.5rem;display:flex;justify-content:flex-end}:host ::ng-deep .p-card .p-card-header{background-color:#f8f9fa;padding:1rem;border-bottom:1px solid #dee2e6}h3{color:#495057;margin-bottom:1.5rem;text-align:center}\n"], dependencies: [{ kind: "ngmodule", type: ReactiveFormsModule }, { kind: "directive", type: i1.ɵNgNoValidate, selector: "form:not([ngNoForm]):not([ngNativeValidate])" }, { kind: "directive", type: i1.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.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i1.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "directive", type: i1.FormControlName, selector: "[formControlName]", inputs: ["formControlName", "disabled", "ngModel"], outputs: ["ngModelChange"] }, { kind: "ngmodule", type: CardModule }, { kind: "component", type: i2$4.Card, selector: "p-card", inputs: ["header", "subheader", "style", "styleClass"] }, { kind: "ngmodule", type: TextareaModule }, { kind: "ngmodule", type: DropdownModule }, { kind: "component", type: i2$2.Dropdown, selector: "p-dropdown", inputs: ["id", "scrollHeight", "filter", "name", "style", "panelStyle", "styleClass", "panelStyleClass", "readonly", "required", "editable", "appendTo", "tabindex", "placeholder", "loadingIcon", "filterPlaceholder", "filterLocale", "variant", "inputId", "dataKey", "filterBy", "filterFields", "autofocus", "resetFilterOnHide", "checkmark", "dropdownIcon", "loading", "optionLabel", "optionValue", "optionDisabled", "optionGroupLabel", "optionGroupChildren", "autoDisplayFirst", "group", "showClear", "emptyFilterMessage", "emptyMessage", "lazy", "virtualScroll", "virtualScrollItemSize", "virtualScrollOptions", "overlayOptions", "ariaFilterLabel", "ariaLabel", "ariaLabelledBy", "filterMatchMode", "maxlength", "tooltip", "tooltipPosition", "tooltipPositionStyle", "tooltipStyleClass", "focusOnHover", "selectOnFocus", "autoOptionFocus", "autofocusFilter", "fluid", "disabled", "itemSize", "autoZIndex", "baseZIndex", "showTransitionOptions", "hideTransitionOptions", "filterValue", "options"], outputs: ["onChange", "onFilter", "onFocus", "onBlur", "onClick", "onShow", "onHide", "onClear", "onLazyLoad"] }, { kind: "ngmodule", type: ButtonModule }, { kind: "ngmodule", type: SelectModule }, { kind: "ngmodule", type: InputTextModule }, { kind: "directive", type: i3$
|
|
3579
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.4", type: AccountPlatformForm, isStandalone: true, selector: "account-platform-form", inputs: { formArray: "formArray" }, ngImport: i0, template: "<div class=\"source-form-card\">\n <p-card header=\"Cuenta\">\n @for (formAccount of formArray.controls; track formAccount) {\n <form [formGroup]=\"$any(formAccount)\">\n <div class=\"form-field\">\n <label class=\"block\">Platform</label>\n <p-dropdown [options]=\"platformOptions\" formControlName=\"platform\" optionLabel=\"label\" optionValue=\"value\" placeholder=\"Select a platform\"></p-dropdown>\n </div>\n\n <div class=\"form-field\">\n <label for=\"name\" class=\"block\">Username</label>\n <input pInputText id=\"name\" type=\"text\" formControlName=\"name\" placeholder=\"Enter name\" class=\"w-full\" />\n </div>\n\n <div class=\"form-field\">\n <label class=\"block\">Email</label>\n <input pInputText type=\"text\" formControlName=\"email\" placeholder=\"Enter name\" class=\"w-full\" />\n </div>\n </form>\n }\n </p-card>\n</div>\n", styles: [":host{display:block;padding:1rem}.source-form-card{max-width:800px;margin:0 auto}.form-field{margin-bottom:1.5rem;display:flex;flex-direction:column}.form-field label{margin-bottom:.5rem;font-weight:500;color:#495057}.form-field input,.form-field textarea,.form-field ::ng-deep .p-element{margin-top:.25rem}:host ::ng-deep .p-card .p-card-content>div:last-child{margin-top:1.5rem;display:flex;justify-content:flex-end}:host ::ng-deep .p-card .p-card-header{background-color:#f8f9fa;padding:1rem;border-bottom:1px solid #dee2e6}h3{color:#495057;margin-bottom:1.5rem;text-align:center}\n"], dependencies: [{ kind: "ngmodule", type: ReactiveFormsModule }, { kind: "directive", type: i1.ɵNgNoValidate, selector: "form:not([ngNoForm]):not([ngNativeValidate])" }, { kind: "directive", type: i1.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.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i1.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "directive", type: i1.FormControlName, selector: "[formControlName]", inputs: ["formControlName", "disabled", "ngModel"], outputs: ["ngModelChange"] }, { kind: "ngmodule", type: CardModule }, { kind: "component", type: i2$4.Card, selector: "p-card", inputs: ["header", "subheader", "style", "styleClass"] }, { kind: "ngmodule", type: TextareaModule }, { kind: "ngmodule", type: DropdownModule }, { kind: "component", type: i2$2.Dropdown, selector: "p-dropdown", inputs: ["id", "scrollHeight", "filter", "name", "style", "panelStyle", "styleClass", "panelStyleClass", "readonly", "required", "editable", "appendTo", "tabindex", "placeholder", "loadingIcon", "filterPlaceholder", "filterLocale", "variant", "inputId", "dataKey", "filterBy", "filterFields", "autofocus", "resetFilterOnHide", "checkmark", "dropdownIcon", "loading", "optionLabel", "optionValue", "optionDisabled", "optionGroupLabel", "optionGroupChildren", "autoDisplayFirst", "group", "showClear", "emptyFilterMessage", "emptyMessage", "lazy", "virtualScroll", "virtualScrollItemSize", "virtualScrollOptions", "overlayOptions", "ariaFilterLabel", "ariaLabel", "ariaLabelledBy", "filterMatchMode", "maxlength", "tooltip", "tooltipPosition", "tooltipPositionStyle", "tooltipStyleClass", "focusOnHover", "selectOnFocus", "autoOptionFocus", "autofocusFilter", "fluid", "disabled", "itemSize", "autoZIndex", "baseZIndex", "showTransitionOptions", "hideTransitionOptions", "filterValue", "options"], outputs: ["onChange", "onFilter", "onFocus", "onBlur", "onClick", "onShow", "onHide", "onClear", "onLazyLoad"] }, { kind: "ngmodule", type: ButtonModule }, { kind: "ngmodule", type: SelectModule }, { kind: "ngmodule", type: InputTextModule }, { kind: "directive", type: i3$1.InputText, selector: "[pInputText]", inputs: ["variant", "fluid", "pSize"] }, { kind: "ngmodule", type: ChipModule }, { kind: "ngmodule", type: TooltipModule }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
3426
3580
|
}
|
|
3427
3581
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.4", ngImport: i0, type: AccountPlatformForm, decorators: [{
|
|
3428
3582
|
type: Component,
|
|
@@ -3560,7 +3714,7 @@ class VoiceSelectorComponent {
|
|
|
3560
3714
|
this.dialogRef.close();
|
|
3561
3715
|
}
|
|
3562
3716
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.4", ngImport: i0, type: VoiceSelectorComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
3563
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.2.4", type: VoiceSelectorComponent, isStandalone: true, selector: "dc-voice-selector", ngImport: i0, template: "<div class=\"p-fluid\">\n <div class=\"p-field mb-3\">\n <label for=\"language\">Select Language</label>\n <p-dropdown\n inputId=\"language\"\n [options]=\"availableLanguages\"\n [(ngModel)]=\"selectedLanguageCode\"\n optionLabel=\"name\"\n optionValue=\"code\"\n placeholder=\"Select a Language\"\n [filter]=\"true\"\n filterBy=\"name\"\n [style]=\"{ width: '100%' }\"\n [showClear]=\"true\">\n </p-dropdown>\n </div>\n\n <a href=\"https://cloud.google.com/text-to-speech/docs/chirp3-hd\" target=\"_blank\">Check Google Voice Examples</a>\n\n <div class=\"p-field\">\n <label for=\"voice\">Select Voice</label>\n <p-listbox\n inputId=\"voice\"\n [options]=\"voices\"\n [(ngModel)]=\"selectedVoiceId\"\n optionLabel=\"name\"\n optionValue=\"id\"\n [style]=\"{ width: '100%' }\"\n listStyleClass=\"p-listbox-sm\"\n [filter]=\"true\"\n filterBy=\"name\"\n placeholder=\"Search voice\">\n </p-listbox>\n </div>\n</div>\n<div class=\"p-dialog-footer\">\n <p-button label=\"Cancel\" icon=\"pi pi-times\" (click)=\"cancel()\" styleClass=\"p-button-text\"></p-button>\n <p-button label=\"Select\" icon=\"pi pi-check\" (click)=\"selectVoice()\" [disabled]=\"!selectedVoiceId && !selectedLanguageCode\"></p-button>\n</div>\n", styles: [":host ::ng-deep .p-listbox-sm .p-listbox-item{padding:.5rem .75rem;font-size:.875rem}:host ::ng-deep .p-dialog-footer{padding-top:1rem;display:flex;justify-content:flex-end;gap:.5rem}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "ngmodule", type: FormsModule }, { kind: "directive", type: i1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "ngmodule", type: ButtonModule }, { kind: "component", type: i2
|
|
3717
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.2.4", type: VoiceSelectorComponent, isStandalone: true, selector: "dc-voice-selector", ngImport: i0, template: "<div class=\"p-fluid\">\n <div class=\"p-field mb-3\">\n <label for=\"language\">Select Language</label>\n <p-dropdown\n inputId=\"language\"\n [options]=\"availableLanguages\"\n [(ngModel)]=\"selectedLanguageCode\"\n optionLabel=\"name\"\n optionValue=\"code\"\n placeholder=\"Select a Language\"\n [filter]=\"true\"\n filterBy=\"name\"\n [style]=\"{ width: '100%' }\"\n [showClear]=\"true\">\n </p-dropdown>\n </div>\n\n <a href=\"https://cloud.google.com/text-to-speech/docs/chirp3-hd\" target=\"_blank\">Check Google Voice Examples</a>\n\n <div class=\"p-field\">\n <label for=\"voice\">Select Voice</label>\n <p-listbox\n inputId=\"voice\"\n [options]=\"voices\"\n [(ngModel)]=\"selectedVoiceId\"\n optionLabel=\"name\"\n optionValue=\"id\"\n [style]=\"{ width: '100%' }\"\n listStyleClass=\"p-listbox-sm\"\n [filter]=\"true\"\n filterBy=\"name\"\n placeholder=\"Search voice\">\n </p-listbox>\n </div>\n</div>\n<div class=\"p-dialog-footer\">\n <p-button label=\"Cancel\" icon=\"pi pi-times\" (click)=\"cancel()\" styleClass=\"p-button-text\"></p-button>\n <p-button label=\"Select\" icon=\"pi pi-check\" (click)=\"selectVoice()\" [disabled]=\"!selectedVoiceId && !selectedLanguageCode\"></p-button>\n</div>\n", styles: [":host ::ng-deep .p-listbox-sm .p-listbox-item{padding:.5rem .75rem;font-size:.875rem}:host ::ng-deep .p-dialog-footer{padding-top:1rem;display:flex;justify-content:flex-end;gap:.5rem}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "ngmodule", type: FormsModule }, { kind: "directive", type: i1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "ngmodule", type: ButtonModule }, { kind: "component", type: i2.Button, selector: "p-button", inputs: ["type", "iconPos", "icon", "badge", "label", "disabled", "loading", "loadingIcon", "raised", "rounded", "text", "plain", "severity", "outlined", "link", "tabindex", "size", "variant", "style", "styleClass", "badgeClass", "badgeSeverity", "ariaLabel", "autofocus", "fluid", "buttonProps"], outputs: ["onClick", "onFocus", "onBlur"] }, { kind: "ngmodule", type: ListboxModule }, { kind: "component", type: i3$2.Listbox, selector: "p-listbox, p-listBox, p-list-box", inputs: ["id", "searchMessage", "emptySelectionMessage", "selectionMessage", "autoOptionFocus", "ariaLabel", "selectOnFocus", "searchLocale", "focusOnHover", "filterMessage", "filterFields", "lazy", "virtualScroll", "virtualScrollItemSize", "virtualScrollOptions", "scrollHeight", "tabindex", "multiple", "style", "styleClass", "listStyle", "listStyleClass", "readonly", "disabled", "checkbox", "filter", "filterBy", "filterMatchMode", "filterLocale", "metaKeySelection", "dataKey", "showToggleAll", "optionLabel", "optionValue", "optionGroupChildren", "optionGroupLabel", "optionDisabled", "ariaFilterLabel", "filterPlaceHolder", "emptyFilterMessage", "emptyMessage", "group", "options", "filterValue", "selectAll", "striped", "highlightOnSelect", "checkmark", "dragdrop"], outputs: ["onChange", "onClick", "onDblClick", "onFilter", "onFocus", "onBlur", "onSelectAllChange", "onLazyLoad", "onDrop"] }, { kind: "ngmodule", type: DropdownModule }, { kind: "component", type: i2$2.Dropdown, selector: "p-dropdown", inputs: ["id", "scrollHeight", "filter", "name", "style", "panelStyle", "styleClass", "panelStyleClass", "readonly", "required", "editable", "appendTo", "tabindex", "placeholder", "loadingIcon", "filterPlaceholder", "filterLocale", "variant", "inputId", "dataKey", "filterBy", "filterFields", "autofocus", "resetFilterOnHide", "checkmark", "dropdownIcon", "loading", "optionLabel", "optionValue", "optionDisabled", "optionGroupLabel", "optionGroupChildren", "autoDisplayFirst", "group", "showClear", "emptyFilterMessage", "emptyMessage", "lazy", "virtualScroll", "virtualScrollItemSize", "virtualScrollOptions", "overlayOptions", "ariaFilterLabel", "ariaLabel", "ariaLabelledBy", "filterMatchMode", "maxlength", "tooltip", "tooltipPosition", "tooltipPositionStyle", "tooltipStyleClass", "focusOnHover", "selectOnFocus", "autoOptionFocus", "autofocusFilter", "fluid", "disabled", "itemSize", "autoZIndex", "baseZIndex", "showTransitionOptions", "hideTransitionOptions", "filterValue", "options"], outputs: ["onChange", "onFilter", "onFocus", "onBlur", "onClick", "onShow", "onHide", "onClear", "onLazyLoad"] }] }); }
|
|
3564
3718
|
}
|
|
3565
3719
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.4", ngImport: i0, type: VoiceSelectorComponent, decorators: [{
|
|
3566
3720
|
type: Component,
|
|
@@ -3609,6 +3763,7 @@ class FormGroupService {
|
|
|
3609
3763
|
authorId: [''],
|
|
3610
3764
|
authorEmail: [''],
|
|
3611
3765
|
takenCount: [0],
|
|
3766
|
+
level: [0],
|
|
3612
3767
|
});
|
|
3613
3768
|
}
|
|
3614
3769
|
createModelFormGroup(model) {
|
|
@@ -3633,7 +3788,15 @@ class FormGroupService {
|
|
|
3633
3788
|
when: this.fb.control(condition?.when || ''),
|
|
3634
3789
|
value: this.fb.control(condition?.value || ''),
|
|
3635
3790
|
then: this.fb.control(condition?.then || ''),
|
|
3636
|
-
task: this.createSimpleAgentTaskFormGroup(condition?.task),
|
|
3791
|
+
// task: this.createSimpleAgentTaskFormGroup(condition?.task),
|
|
3792
|
+
do: this.fb.array([]), // Correctly typed FormArray
|
|
3793
|
+
});
|
|
3794
|
+
}
|
|
3795
|
+
createDoActionFormGroup(action) {
|
|
3796
|
+
return this.fb.group({
|
|
3797
|
+
actionType: this.fb.control(action?.actionType || ''), // Default or from params
|
|
3798
|
+
systemPromptType: this.fb.control(action?.systemPromptType || ''), // Default or from params
|
|
3799
|
+
prompt: this.fb.control(action?.prompt || ''), // Default or from params
|
|
3637
3800
|
});
|
|
3638
3801
|
}
|
|
3639
3802
|
createTriggerTasksFormGroup() {
|
|
@@ -3652,6 +3815,50 @@ class FormGroupService {
|
|
|
3652
3815
|
model: this.createModelFormGroup(task?.model),
|
|
3653
3816
|
});
|
|
3654
3817
|
}
|
|
3818
|
+
// Operations with Array
|
|
3819
|
+
// If you have the main fromGroup use this fisrt versión
|
|
3820
|
+
removeArrayItem(formGroup, controlPath, index) {
|
|
3821
|
+
// controlPath is dot separated path to the form array
|
|
3822
|
+
const control = formGroup.get(controlPath);
|
|
3823
|
+
if (control) {
|
|
3824
|
+
control.removeAt(index);
|
|
3825
|
+
// this.cdr.detectChanges();
|
|
3826
|
+
}
|
|
3827
|
+
}
|
|
3828
|
+
addArrayItem(formGroup, controlPath, itemFactory = () => this.fb.control('')) {
|
|
3829
|
+
// you can add array with function or add empty formGroup
|
|
3830
|
+
const control = formGroup.get(controlPath);
|
|
3831
|
+
if (control) {
|
|
3832
|
+
control.push(itemFactory());
|
|
3833
|
+
// this.cdr.detectChanges();
|
|
3834
|
+
}
|
|
3835
|
+
}
|
|
3836
|
+
updateArrayField(formGroup, controlPath, index, event) {
|
|
3837
|
+
const control = formGroup.get(controlPath);
|
|
3838
|
+
if (control instanceof FormArray && event.target instanceof HTMLInputElement) {
|
|
3839
|
+
const formControlAtIndex = control.at(index);
|
|
3840
|
+
if (formControlAtIndex) {
|
|
3841
|
+
formControlAtIndex.setValue(event.target.value);
|
|
3842
|
+
}
|
|
3843
|
+
}
|
|
3844
|
+
else if (control instanceof FormArray && event.target instanceof HTMLTextAreaElement) {
|
|
3845
|
+
// Handle textarea
|
|
3846
|
+
const formControlAtIndex = control.at(index);
|
|
3847
|
+
if (formControlAtIndex) {
|
|
3848
|
+
formControlAtIndex.setValue(event.target.value);
|
|
3849
|
+
}
|
|
3850
|
+
}
|
|
3851
|
+
}
|
|
3852
|
+
// If you have the reference to the formArray use this second versión or native solution.
|
|
3853
|
+
addItemToFormArray(formArray, itemFactory = () => this.fb.control('')) {
|
|
3854
|
+
formArray.push(itemFactory());
|
|
3855
|
+
}
|
|
3856
|
+
removeItemFromFormArray(formArray, index) {
|
|
3857
|
+
formArray.removeAt(index);
|
|
3858
|
+
}
|
|
3859
|
+
getItemFromFormArray(formArray, index) {
|
|
3860
|
+
return formArray.at(index);
|
|
3861
|
+
}
|
|
3655
3862
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.4", ngImport: i0, type: FormGroupService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
3656
3863
|
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.2.4", ngImport: i0, type: FormGroupService, providedIn: 'root' }); }
|
|
3657
3864
|
}
|
|
@@ -3685,7 +3892,7 @@ class AgentTaskFormComponent {
|
|
|
3685
3892
|
console.log(this.formGroup);
|
|
3686
3893
|
}
|
|
3687
3894
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.4", ngImport: i0, type: AgentTaskFormComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
3688
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.4", 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 <label for=\"task\" class=\"block text-sm font-medium text-gray-700\">Task</label>\n <input pInputText id=\"task\" [formControl]=\"formGroup.controls?.task\" class=\"w-full\" />\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: "ngmodule", type: InputTextModule }, { kind: "directive", type: i3$
|
|
3895
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.4", 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 <label for=\"task\" class=\"block text-sm font-medium text-gray-700\">Task</label>\n <input pInputText id=\"task\" [formControl]=\"formGroup.controls?.task\" class=\"w-full\" />\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: "ngmodule", type: InputTextModule }, { kind: "directive", type: i3$1.InputText, selector: "[pInputText]", inputs: ["variant", "fluid", "pSize"] }, { kind: "ngmodule", type: ReactiveFormsModule }, { kind: "directive", type: i1.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.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i1.FormControlDirective, selector: "[formControl]", inputs: ["formControl", "disabled", "ngModel"], outputs: ["ngModelChange"], exportAs: ["ngForm"] }, { kind: "directive", type: i1.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "ngmodule", type: DropdownModule }, { kind: "component", type: ModelSelectorComponent, selector: "dc-model-selector", inputs: ["modelForm", "shortForm"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
3689
3896
|
}
|
|
3690
3897
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.4", ngImport: i0, type: AgentTaskFormComponent, decorators: [{
|
|
3691
3898
|
type: Component,
|
|
@@ -3696,57 +3903,205 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.4", ngImpor
|
|
|
3696
3903
|
type: Input
|
|
3697
3904
|
}] } });
|
|
3698
3905
|
|
|
3699
|
-
class
|
|
3906
|
+
class DcDoActionFormComponent {
|
|
3700
3907
|
constructor() {
|
|
3701
|
-
this.
|
|
3702
|
-
this.
|
|
3703
|
-
this.entityWhenOptions = EntityWhenOptions;
|
|
3704
|
-
this.formGroup = this.formGroupService.createConversationFlowFormGroup();
|
|
3705
|
-
this.conversationEvents = ConversationEvents;
|
|
3706
|
-
this.objectKeys = Object.keys;
|
|
3908
|
+
this.removeItem = new EventEmitter();
|
|
3909
|
+
this.doActionTypeOptions = DoActionTypeOptions;
|
|
3707
3910
|
}
|
|
3708
|
-
|
|
3709
|
-
|
|
3710
|
-
throw new Error('DCConversationFlowFormComponent requires a formGroup input.');
|
|
3711
|
-
}
|
|
3911
|
+
onRemoveItem() {
|
|
3912
|
+
this.removeItem.emit({ conditionIndex: this.conditionIndex, doItemIndex: this.doItemIndex });
|
|
3712
3913
|
}
|
|
3713
|
-
|
|
3714
|
-
|
|
3914
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.4", ngImport: i0, type: DcDoActionFormComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
3915
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.2.4", type: DcDoActionFormComponent, isStandalone: true, selector: "dc-do-action-form", inputs: { formGroup: "formGroup", conditionIndex: "conditionIndex", doItemIndex: "doItemIndex", systemPromptTypeOptions: "systemPromptTypeOptions" }, outputs: { removeItem: "removeItem" }, ngImport: i0, template: "<div [formGroup]=\"formGroup\" class=\"bg-white shadow-md rounded-lg p-6 mb-6 border border-gray-200\">\n <div class=\"flex justify-between items-center mb-4\">\n <h5 class=\"text-lg font-semibold text-gray-700\">Task {{ doItemIndex + 1 }}</h5>\n <button pButton type=\"button\" severity=\"danger\" icon=\"pi pi-trash\" (click)=\"onRemoveItem()\" class=\"p-button-sm p-button-text p-button-rounded\"></button>\n </div>\n <div class=\"space-y-4\">\n <!-- Action Type -->\n <div class=\"flex flex-col\">\n <label [for]=\"'actionType_' + conditionIndex + '_' + doItemIndex\" class=\"mb-1 text-sm font-medium text-gray-600\">Action Type</label>\n <p-select\n [options]=\"doActionTypeOptions\"\n formControlName=\"actionType\"\n optionLabel=\"label\"\n optionValue=\"value\"\n [placeholder]=\"'Select Action Type'\"\n [id]=\"'actionType_' + conditionIndex + '_' + doItemIndex\"\n styleClass=\"w-full\"\n [panelStyle]=\"{ width: '100%' }\"></p-select>\n </div>\n\n <!-- System Prompt Type -->\n <div class=\"flex flex-col\">\n <label [for]=\"'systemPromptType_' + conditionIndex + '_' + doItemIndex\" class=\"mb-1 text-sm font-medium text-gray-600\">System Prompt Type</label>\n <p-select\n [options]=\"systemPromptTypeOptions\"\n formControlName=\"systemPromptType\"\n optionLabel=\"label\"\n optionValue=\"value\"\n [placeholder]=\"'Select System Prompt Type'\"\n [id]=\"'systemPromptType_' + conditionIndex + '_' + doItemIndex\"\n styleClass=\"w-full\"\n [panelStyle]=\"{ width: '100%' }\"></p-select>\n </div>\n\n <!-- Prompt -->\n <div class=\"flex flex-col\">\n <label [for]=\"'prompt_' + conditionIndex + '_' + doItemIndex\" class=\"mb-1 text-sm font-medium text-gray-600\">Prompt</label>\n <textarea\n pTextarea\n [autoResize]=\"true\"\n [id]=\"'prompt_' + conditionIndex + '_' + doItemIndex\"\n formControlName=\"prompt\"\n rows=\"3\"\n class=\"w-full p-inputtext p-component rounded-md border-gray-300 focus:border-primary-500 focus:ring focus:ring-primary-200 focus:ring-opacity-50\"></textarea>\n </div>\n </div>\n</div>\n", styles: [""], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "ngmodule", type: ReactiveFormsModule }, { kind: "directive", type: i1.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.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i1.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "directive", type: i1.FormControlName, selector: "[formControlName]", inputs: ["formControlName", "disabled", "ngModel"], outputs: ["ngModelChange"] }, { kind: "ngmodule", type: ButtonModule }, { kind: "directive", type: i2.ButtonDirective, selector: "[pButton]", inputs: ["iconPos", "loadingIcon", "loading", "severity", "raised", "rounded", "text", "outlined", "size", "plain", "fluid", "label", "icon", "buttonProps"] }, { kind: "ngmodule", type: SelectModule }, { kind: "component", type: i5.Select, selector: "p-select", inputs: ["id", "scrollHeight", "filter", "name", "style", "panelStyle", "styleClass", "panelStyleClass", "readonly", "required", "editable", "appendTo", "tabindex", "placeholder", "loadingIcon", "filterPlaceholder", "filterLocale", "variant", "inputId", "dataKey", "filterBy", "filterFields", "autofocus", "resetFilterOnHide", "checkmark", "dropdownIcon", "loading", "optionLabel", "optionValue", "optionDisabled", "optionGroupLabel", "optionGroupChildren", "autoDisplayFirst", "group", "showClear", "emptyFilterMessage", "emptyMessage", "lazy", "virtualScroll", "virtualScrollItemSize", "virtualScrollOptions", "size", "overlayOptions", "ariaFilterLabel", "ariaLabel", "ariaLabelledBy", "filterMatchMode", "maxlength", "tooltip", "tooltipPosition", "tooltipPositionStyle", "tooltipStyleClass", "focusOnHover", "selectOnFocus", "autoOptionFocus", "autofocusFilter", "fluid", "disabled", "itemSize", "autoZIndex", "baseZIndex", "showTransitionOptions", "hideTransitionOptions", "filterValue", "options"], outputs: ["onChange", "onFilter", "onFocus", "onBlur", "onClick", "onShow", "onHide", "onClear", "onLazyLoad"] }, { kind: "ngmodule", type: TextareaModule }, { kind: "directive", type: i4.Textarea, selector: "[pTextarea]", inputs: ["autoResize", "variant", "fluid", "pSize"], outputs: ["onResize"] }, { kind: "ngmodule", type: TooltipModule }] }); }
|
|
3916
|
+
}
|
|
3917
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.4", ngImport: i0, type: DcDoActionFormComponent, decorators: [{
|
|
3918
|
+
type: Component,
|
|
3919
|
+
args: [{ selector: 'dc-do-action-form', standalone: true, imports: [CommonModule, ReactiveFormsModule, ButtonModule, SelectModule, TextareaModule, TooltipModule], template: "<div [formGroup]=\"formGroup\" class=\"bg-white shadow-md rounded-lg p-6 mb-6 border border-gray-200\">\n <div class=\"flex justify-between items-center mb-4\">\n <h5 class=\"text-lg font-semibold text-gray-700\">Task {{ doItemIndex + 1 }}</h5>\n <button pButton type=\"button\" severity=\"danger\" icon=\"pi pi-trash\" (click)=\"onRemoveItem()\" class=\"p-button-sm p-button-text p-button-rounded\"></button>\n </div>\n <div class=\"space-y-4\">\n <!-- Action Type -->\n <div class=\"flex flex-col\">\n <label [for]=\"'actionType_' + conditionIndex + '_' + doItemIndex\" class=\"mb-1 text-sm font-medium text-gray-600\">Action Type</label>\n <p-select\n [options]=\"doActionTypeOptions\"\n formControlName=\"actionType\"\n optionLabel=\"label\"\n optionValue=\"value\"\n [placeholder]=\"'Select Action Type'\"\n [id]=\"'actionType_' + conditionIndex + '_' + doItemIndex\"\n styleClass=\"w-full\"\n [panelStyle]=\"{ width: '100%' }\"></p-select>\n </div>\n\n <!-- System Prompt Type -->\n <div class=\"flex flex-col\">\n <label [for]=\"'systemPromptType_' + conditionIndex + '_' + doItemIndex\" class=\"mb-1 text-sm font-medium text-gray-600\">System Prompt Type</label>\n <p-select\n [options]=\"systemPromptTypeOptions\"\n formControlName=\"systemPromptType\"\n optionLabel=\"label\"\n optionValue=\"value\"\n [placeholder]=\"'Select System Prompt Type'\"\n [id]=\"'systemPromptType_' + conditionIndex + '_' + doItemIndex\"\n styleClass=\"w-full\"\n [panelStyle]=\"{ width: '100%' }\"></p-select>\n </div>\n\n <!-- Prompt -->\n <div class=\"flex flex-col\">\n <label [for]=\"'prompt_' + conditionIndex + '_' + doItemIndex\" class=\"mb-1 text-sm font-medium text-gray-600\">Prompt</label>\n <textarea\n pTextarea\n [autoResize]=\"true\"\n [id]=\"'prompt_' + conditionIndex + '_' + doItemIndex\"\n formControlName=\"prompt\"\n rows=\"3\"\n class=\"w-full p-inputtext p-component rounded-md border-gray-300 focus:border-primary-500 focus:ring focus:ring-primary-200 focus:ring-opacity-50\"></textarea>\n </div>\n </div>\n</div>\n" }]
|
|
3920
|
+
}], propDecorators: { formGroup: [{
|
|
3921
|
+
type: Input,
|
|
3922
|
+
args: [{ required: true }]
|
|
3923
|
+
}], conditionIndex: [{
|
|
3924
|
+
type: Input,
|
|
3925
|
+
args: [{ required: true }]
|
|
3926
|
+
}], doItemIndex: [{
|
|
3927
|
+
type: Input,
|
|
3928
|
+
args: [{ required: true }]
|
|
3929
|
+
}], systemPromptTypeOptions: [{
|
|
3930
|
+
type: Input,
|
|
3931
|
+
args: [{ required: true }]
|
|
3932
|
+
}], removeItem: [{
|
|
3933
|
+
type: Output
|
|
3934
|
+
}] } });
|
|
3935
|
+
|
|
3936
|
+
class DcDynamicConditionsFormComponent {
|
|
3937
|
+
constructor() {
|
|
3938
|
+
this.formGroupService = inject(FormGroupService);
|
|
3715
3939
|
}
|
|
3716
3940
|
addDynamicCondition() {
|
|
3717
|
-
this.
|
|
3941
|
+
this.formGroupService.addItemToFormArray(this.dynamicConditionsArray, () => this.formGroupService.createDynamicConditionFormGroup());
|
|
3718
3942
|
}
|
|
3719
3943
|
removeDynamicCondition(index) {
|
|
3720
|
-
this.
|
|
3944
|
+
this.formGroupService.removeItemFromFormArray(this.dynamicConditionsArray, index);
|
|
3945
|
+
}
|
|
3946
|
+
getDoArray(conditionIndex) {
|
|
3947
|
+
const conditionPath = `${this.dynamicConditionsPath}.${conditionIndex}.do`;
|
|
3948
|
+
return this.formGroupService.getItemFromFormArray(this.dynamicConditionsArray, conditionIndex);
|
|
3949
|
+
}
|
|
3950
|
+
getDoControls(conditionIndex) {
|
|
3951
|
+
return this.getDoArray(conditionIndex).controls;
|
|
3952
|
+
}
|
|
3953
|
+
getDoItemFormGroup(conditionIndex, doItemIndex) {
|
|
3954
|
+
const doItemPath = `${this.dynamicConditionsPath}.${conditionIndex}.do.${doItemIndex}`;
|
|
3955
|
+
return this.formGroupService.getItemFromFormArray(this.dynamicConditionsArray, doItemIndex);
|
|
3956
|
+
}
|
|
3957
|
+
addDoItem(conditionIndex) {
|
|
3958
|
+
this.formGroupService.addItemToFormArray(this.dynamicConditionsArray, () => this.formGroupService.createDoActionFormGroup());
|
|
3721
3959
|
}
|
|
3722
|
-
|
|
3723
|
-
|
|
3724
|
-
|
|
3960
|
+
removeDoItem(conditionIndex, doItemIndex) {
|
|
3961
|
+
debugger;
|
|
3962
|
+
this.formGroupService.removeItemFromFormArray(this.dynamicConditionsArray, doItemIndex);
|
|
3725
3963
|
}
|
|
3726
3964
|
// Helper to safely cast to FormControl for the template
|
|
3727
3965
|
getFormControl(control) {
|
|
3728
3966
|
if (!(control instanceof FormControl)) {
|
|
3729
|
-
// This case should ideally not happen if types are correct,
|
|
3730
|
-
// but it's a safeguard.
|
|
3731
3967
|
console.error('Expected a FormControl, but received:', control);
|
|
3732
|
-
// Return a dummy FormControl or handle error appropriately
|
|
3733
3968
|
return new FormControl(null);
|
|
3734
3969
|
}
|
|
3735
3970
|
return control;
|
|
3736
3971
|
}
|
|
3972
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.4", ngImport: i0, type: DcDynamicConditionsFormComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
3973
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.4", type: DcDynamicConditionsFormComponent, isStandalone: true, selector: "dc-dynamic-conditions-form", inputs: { dynamicConditionsArray: "dynamicConditionsArray", dynamicConditionsPath: "dynamicConditionsPath", entityWhatOptions: "entityWhatOptions", entityWhenOptions: "entityWhenOptions", systemPromptTypeOptions: "systemPromptTypeOptions" }, ngImport: i0, template: "<div class=\"group\">\n <h4>Dynamic Conditions <span pTooltip=\"Conditions that trigger tasks based on conversation state\">\u2139\uFE0F</span></h4>\n @for (conditionControl of dynamicConditionsArray.controls; track conditionControl; let i = $index) {\n <div class=\"group nested-group dynamic-condition-item\">\n <div class=\"flex justify-between items-center mb-4\">\n <h5>Condition {{ i + 1 }}</h5>\n <button\n pTooltip=\"Remove Condition\"\n variant=\"outlined\"\n [raised]=\"true\"\n pButton\n severity=\"danger\"\n icon=\"pi pi-trash\"\n (click)=\"removeDynamicCondition(i)\"></button>\n </div>\n\n <div class=\"form-field\">\n <label [for]=\"'conditionWhat' + i\">What <span pTooltip=\"Identifier for this condition (optional)\">\u2139\uFE0F</span></label>\n <p-select\n [id]=\"'conditionWhat' + i\"\n [options]=\"entityWhatOptions\"\n [formControl]=\"conditionControl.controls.what\"\n optionLabel=\"label\"\n optionValue=\"value\"\n [placeholder]=\"'Select What'\"></p-select>\n </div>\n\n <div class=\"form-field\">\n <label [for]=\"'conditionWhen' + i\">When <span pTooltip=\"Field or variable to check\">\u2139\uFE0F</span></label>\n <p-select\n [id]=\"'conditionWhen' + i\"\n [options]=\"entityWhenOptions\"\n [formControl]=\"conditionControl.controls.when\"\n optionLabel=\"label\"\n optionValue=\"value\"\n [placeholder]=\"'Select When'\"></p-select>\n </div>\n <div class=\"form-field\">\n <label [for]=\"'conditionValue' + i\">Value <span pTooltip=\"Value to compare against\">\u2139\uFE0F</span></label>\n <input pInputText [id]=\"'conditionValue' + i\" type=\"text\" [formControl]=\"conditionControl.controls.value\" />\n </div>\n\n <div class=\"group very-nested-group\">\n <h6>DO THIS <span pTooltip=\"Tasks to execute if this condition is met\">\u2139\uFE0F</span></h6>\n @for (doItemControl of conditionControl.controls.do.controls; track doItemControl; let j = $index) {\n <dc-do-action-form\n [formGroup]=\"doItemControl\"\n [conditionIndex]=\"i\"\n [doItemIndex]=\"j\"\n [systemPromptTypeOptions]=\"systemPromptTypeOptions\"\n (removeItem)=\"removeDoItem(i, j)\">\n </dc-do-action-form>\n }\n <button\n pButton\n type=\"button\"\n label=\"Add 'Do' Task\"\n icon=\"pi pi-plus\"\n (click)=\"addDoItem(i)\"\n class=\"p-button-outlined p-button-sm\"\n style=\"margin-top: 10px\"></button>\n </div>\n </div>\n }\n <button pButton type=\"button\" severity=\"info\" label=\"Add Dynamic Condition\" (click)=\"addDynamicCondition()\"></button>\n</div>\n", styles: [".nested-group{border:1px solid #eee;padding:10px;margin-top:10px;border-radius:4px}.very-nested-group{border:1px dashed #ccc;padding:8px;margin-top:8px;border-radius:4px}.dynamic-condition-item{margin-bottom:15px}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "ngmodule", type: ReactiveFormsModule }, { kind: "directive", type: i1.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.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i1.FormControlDirective, selector: "[formControl]", inputs: ["formControl", "disabled", "ngModel"], outputs: ["ngModelChange"], exportAs: ["ngForm"] }, { kind: "directive", type: i1.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "ngmodule", type: ButtonModule }, { kind: "directive", type: i2.ButtonDirective, selector: "[pButton]", inputs: ["iconPos", "loadingIcon", "loading", "severity", "raised", "rounded", "text", "outlined", "size", "plain", "fluid", "label", "icon", "buttonProps"] }, { kind: "ngmodule", type: InputTextModule }, { kind: "directive", type: i3$1.InputText, selector: "[pInputText]", inputs: ["variant", "fluid", "pSize"] }, { kind: "ngmodule", type: SelectModule }, { kind: "component", type: i5.Select, selector: "p-select", inputs: ["id", "scrollHeight", "filter", "name", "style", "panelStyle", "styleClass", "panelStyleClass", "readonly", "required", "editable", "appendTo", "tabindex", "placeholder", "loadingIcon", "filterPlaceholder", "filterLocale", "variant", "inputId", "dataKey", "filterBy", "filterFields", "autofocus", "resetFilterOnHide", "checkmark", "dropdownIcon", "loading", "optionLabel", "optionValue", "optionDisabled", "optionGroupLabel", "optionGroupChildren", "autoDisplayFirst", "group", "showClear", "emptyFilterMessage", "emptyMessage", "lazy", "virtualScroll", "virtualScrollItemSize", "virtualScrollOptions", "size", "overlayOptions", "ariaFilterLabel", "ariaLabel", "ariaLabelledBy", "filterMatchMode", "maxlength", "tooltip", "tooltipPosition", "tooltipPositionStyle", "tooltipStyleClass", "focusOnHover", "selectOnFocus", "autoOptionFocus", "autofocusFilter", "fluid", "disabled", "itemSize", "autoZIndex", "baseZIndex", "showTransitionOptions", "hideTransitionOptions", "filterValue", "options"], outputs: ["onChange", "onFilter", "onFocus", "onBlur", "onClick", "onShow", "onHide", "onClear", "onLazyLoad"] }, { kind: "ngmodule", type: TooltipModule }, { kind: "directive", type: i5$1.Tooltip, selector: "[pTooltip]", inputs: ["tooltipPosition", "tooltipEvent", "appendTo", "positionStyle", "tooltipStyleClass", "tooltipZIndex", "escape", "showDelay", "hideDelay", "life", "positionTop", "positionLeft", "autoHide", "fitContent", "hideOnEscape", "pTooltip", "tooltipDisabled", "tooltipOptions"] }, { kind: "component", type: DcDoActionFormComponent, selector: "dc-do-action-form", inputs: ["formGroup", "conditionIndex", "doItemIndex", "systemPromptTypeOptions"], outputs: ["removeItem"] }] }); }
|
|
3974
|
+
}
|
|
3975
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.4", ngImport: i0, type: DcDynamicConditionsFormComponent, decorators: [{
|
|
3976
|
+
type: Component,
|
|
3977
|
+
args: [{ selector: 'dc-dynamic-conditions-form', standalone: true, imports: [CommonModule, ReactiveFormsModule, ButtonModule, InputTextModule, SelectModule, TooltipModule, DcDoActionFormComponent], template: "<div class=\"group\">\n <h4>Dynamic Conditions <span pTooltip=\"Conditions that trigger tasks based on conversation state\">\u2139\uFE0F</span></h4>\n @for (conditionControl of dynamicConditionsArray.controls; track conditionControl; let i = $index) {\n <div class=\"group nested-group dynamic-condition-item\">\n <div class=\"flex justify-between items-center mb-4\">\n <h5>Condition {{ i + 1 }}</h5>\n <button\n pTooltip=\"Remove Condition\"\n variant=\"outlined\"\n [raised]=\"true\"\n pButton\n severity=\"danger\"\n icon=\"pi pi-trash\"\n (click)=\"removeDynamicCondition(i)\"></button>\n </div>\n\n <div class=\"form-field\">\n <label [for]=\"'conditionWhat' + i\">What <span pTooltip=\"Identifier for this condition (optional)\">\u2139\uFE0F</span></label>\n <p-select\n [id]=\"'conditionWhat' + i\"\n [options]=\"entityWhatOptions\"\n [formControl]=\"conditionControl.controls.what\"\n optionLabel=\"label\"\n optionValue=\"value\"\n [placeholder]=\"'Select What'\"></p-select>\n </div>\n\n <div class=\"form-field\">\n <label [for]=\"'conditionWhen' + i\">When <span pTooltip=\"Field or variable to check\">\u2139\uFE0F</span></label>\n <p-select\n [id]=\"'conditionWhen' + i\"\n [options]=\"entityWhenOptions\"\n [formControl]=\"conditionControl.controls.when\"\n optionLabel=\"label\"\n optionValue=\"value\"\n [placeholder]=\"'Select When'\"></p-select>\n </div>\n <div class=\"form-field\">\n <label [for]=\"'conditionValue' + i\">Value <span pTooltip=\"Value to compare against\">\u2139\uFE0F</span></label>\n <input pInputText [id]=\"'conditionValue' + i\" type=\"text\" [formControl]=\"conditionControl.controls.value\" />\n </div>\n\n <div class=\"group very-nested-group\">\n <h6>DO THIS <span pTooltip=\"Tasks to execute if this condition is met\">\u2139\uFE0F</span></h6>\n @for (doItemControl of conditionControl.controls.do.controls; track doItemControl; let j = $index) {\n <dc-do-action-form\n [formGroup]=\"doItemControl\"\n [conditionIndex]=\"i\"\n [doItemIndex]=\"j\"\n [systemPromptTypeOptions]=\"systemPromptTypeOptions\"\n (removeItem)=\"removeDoItem(i, j)\">\n </dc-do-action-form>\n }\n <button\n pButton\n type=\"button\"\n label=\"Add 'Do' Task\"\n icon=\"pi pi-plus\"\n (click)=\"addDoItem(i)\"\n class=\"p-button-outlined p-button-sm\"\n style=\"margin-top: 10px\"></button>\n </div>\n </div>\n }\n <button pButton type=\"button\" severity=\"info\" label=\"Add Dynamic Condition\" (click)=\"addDynamicCondition()\"></button>\n</div>\n", styles: [".nested-group{border:1px solid #eee;padding:10px;margin-top:10px;border-radius:4px}.very-nested-group{border:1px dashed #ccc;padding:8px;margin-top:8px;border-radius:4px}.dynamic-condition-item{margin-bottom:15px}\n"] }]
|
|
3978
|
+
}], propDecorators: { dynamicConditionsArray: [{
|
|
3979
|
+
type: Input,
|
|
3980
|
+
args: [{ required: true }]
|
|
3981
|
+
}], dynamicConditionsPath: [{
|
|
3982
|
+
type: Input,
|
|
3983
|
+
args: [{ required: true }]
|
|
3984
|
+
}], entityWhatOptions: [{
|
|
3985
|
+
type: Input,
|
|
3986
|
+
args: [{ required: true }]
|
|
3987
|
+
}], entityWhenOptions: [{
|
|
3988
|
+
type: Input,
|
|
3989
|
+
args: [{ required: true }]
|
|
3990
|
+
}], systemPromptTypeOptions: [{
|
|
3991
|
+
type: Input,
|
|
3992
|
+
args: [{ required: true }]
|
|
3993
|
+
}] } });
|
|
3994
|
+
|
|
3995
|
+
class DCConversationFlowFormComponent {
|
|
3996
|
+
constructor() {
|
|
3997
|
+
// Services
|
|
3998
|
+
this.formGroupService = inject(FormGroupService);
|
|
3999
|
+
// Options vars
|
|
4000
|
+
this.entityWhatOptions = EntityWhatOptions;
|
|
4001
|
+
this.entityWhenOptions = EntityWhenOptions;
|
|
4002
|
+
// FORM GROUP
|
|
4003
|
+
this.formGroup = this.formGroupService.createConversationFlowFormGroup();
|
|
4004
|
+
this.conversationEvents = ConversationEvents;
|
|
4005
|
+
this.objectKeys = Object.keys;
|
|
4006
|
+
this.doActionTypeOptions = Object.values(EDoActionType).map((value) => ({ label: this.formatEnumKey(value), value }));
|
|
4007
|
+
this.systemPromptTypeOptions = Object.values(SystemPromptType).map((value) => ({ label: this.formatEnumKey(value), value }));
|
|
4008
|
+
}
|
|
4009
|
+
ngOnInit() {
|
|
4010
|
+
if (!this.formGroup) {
|
|
4011
|
+
throw new Error('DCConversationFlowFormComponent requires a formGroup input.');
|
|
4012
|
+
}
|
|
4013
|
+
}
|
|
4014
|
+
formatEnumKey(key) {
|
|
4015
|
+
// Converts camelCase or PascalCase to Title Case
|
|
4016
|
+
const result = key.replace(/([A-Z])/g, ' $1');
|
|
4017
|
+
return result.charAt(0).toUpperCase() + result.slice(1).trim();
|
|
4018
|
+
}
|
|
4019
|
+
removeArrayItem(controlPath, index) {
|
|
4020
|
+
this.formGroupService.removeArrayItem(this.formGroup, controlPath, index);
|
|
4021
|
+
}
|
|
3737
4022
|
showData() {
|
|
3738
4023
|
console.log(this.formGroup.value);
|
|
3739
4024
|
}
|
|
3740
4025
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.4", ngImport: i0, type: DCConversationFlowFormComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
3741
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.4", type: DCConversationFlowFormComponent, isStandalone: true, selector: "dc-conversation-flow-form", inputs: { formGroup: "formGroup" }, ngImport: i0, template: "<div [formGroup]=\"formGroup\" class=\"group\">\n <h3>Conversation Flow <span pTooltip=\"Define the flow and logic of the conversation\">\u2139\uFE0F</span></h3>\n\n <div class=\"form-field\">\n <label for=\"flowGoal\">Goal <span pTooltip=\"The main objective of this conversation flow\">\u2139\uFE0F</span></label>\n\n <agent-task-form [formGroup]=\"formGroup.controls.goal\" [shortForm]=\"true\"></agent-task-form>\n </div>\n\n <details>\n <summary>Trigger Tasks</summary>\n\n <div formGroupName=\"triggerTasks\" class=\"group\">\n <h4>Trigger Tasks <span (click)=\"showData()\" pTooltip=\"Tasks to be executed on specific conversation events\">\u2139\uFE0F</span></h4>\n @for (eventKey of objectKeys(formGroup.controls.triggerTasks.controls); track eventKey) {\n <!-- {{ eventKey }} -->\n <div class=\"form-field\">\n <label [for]=\"eventKey\">{{ eventKey }}</label>\n <agent-task-form [formGroup]=\"formGroup.controls.triggerTasks.controls[eventKey]\"></agent-task-form>\n </div>\n }\n
|
|
4026
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.4", type: DCConversationFlowFormComponent, isStandalone: true, selector: "dc-conversation-flow-form", inputs: { formGroup: "formGroup" }, ngImport: i0, template: "<div [formGroup]=\"formGroup\" class=\"group bg-pink-50\">\n <h3>Conversation Flow <span pTooltip=\"Define the flow and logic of the conversation\">\u2139\uFE0F</span></h3>\n\n <div class=\"form-field\">\n <label for=\"flowGoal\">Goal <span pTooltip=\"The main objective of this conversation flow\">\u2139\uFE0F</span></label>\n\n <agent-task-form [formGroup]=\"formGroup.controls.goal\" [shortForm]=\"true\"></agent-task-form>\n </div>\n\n <details>\n <summary>Trigger Tasks</summary>\n\n <div formGroupName=\"triggerTasks\" class=\"group\">\n <h4>Trigger Tasks <span (click)=\"showData()\" pTooltip=\"Tasks to be executed on specific conversation events\">\u2139\uFE0F</span></h4>\n @for (eventKey of objectKeys(formGroup.controls.triggerTasks.controls); track eventKey) {\n <!-- {{ eventKey }} -->\n <div class=\"form-field\">\n <label [for]=\"eventKey\">{{ eventKey }}</label>\n <agent-task-form [formGroup]=\"formGroup.controls.triggerTasks.controls[eventKey]\"></agent-task-form>\n </div>\n }\n </div>\n </details>\n\n <div class=\"form-field\">\n <label for=\"flowBonus\">Bonus <span pTooltip=\"Bonus information or context (e.g., JSON string)\">\u2139\uFE0F</span></label>\n <input id=\"flowBonus\" formControlName=\"bonus\" />\n </div>\n\n <dc-dynamic-conditions-form\n [dynamicConditionsArray]=\"formGroup.controls.dynamicConditions\"\n [dynamicConditionsPath]=\"'formGroup.controls.dynamicConditions'\"\n [entityWhatOptions]=\"entityWhatOptions\"\n [entityWhenOptions]=\"entityWhenOptions\"\n [systemPromptTypeOptions]=\"systemPromptTypeOptions\">\n </dc-dynamic-conditions-form>\n</div>\n", styles: [".nested-group{border:1px solid #eee;padding:10px;margin-top:10px;border-radius:4px}.very-nested-group{border:1px dashed #ccc;padding:8px;margin-top:8px;border-radius:4px}.dynamic-condition-item{margin-bottom:15px}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "ngmodule", type: ReactiveFormsModule }, { kind: "directive", type: i1.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.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i1.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "directive", type: i1.FormControlName, selector: "[formControlName]", inputs: ["formControlName", "disabled", "ngModel"], outputs: ["ngModelChange"] }, { kind: "directive", type: i1.FormGroupName, selector: "[formGroupName]", inputs: ["formGroupName"] }, { kind: "ngmodule", type: ButtonModule }, { kind: "ngmodule", type: InputTextModule }, { kind: "ngmodule", type: TextareaModule }, { kind: "ngmodule", type: TooltipModule }, { kind: "directive", type: i5$1.Tooltip, selector: "[pTooltip]", inputs: ["tooltipPosition", "tooltipEvent", "appendTo", "positionStyle", "tooltipStyleClass", "tooltipZIndex", "escape", "showDelay", "hideDelay", "life", "positionTop", "positionLeft", "autoHide", "fitContent", "hideOnEscape", "pTooltip", "tooltipDisabled", "tooltipOptions"] }, { kind: "component", type: AgentTaskFormComponent, selector: "agent-task-form", inputs: ["formGroup", "shortForm"] }, { kind: "ngmodule", type: SelectModule }, { kind: "component", type: DcDynamicConditionsFormComponent, selector: "dc-dynamic-conditions-form", inputs: ["dynamicConditionsArray", "dynamicConditionsPath", "entityWhatOptions", "entityWhenOptions", "systemPromptTypeOptions"] }] }); }
|
|
3742
4027
|
}
|
|
3743
4028
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.4", ngImport: i0, type: DCConversationFlowFormComponent, decorators: [{
|
|
3744
4029
|
type: Component,
|
|
3745
|
-
args: [{ selector: 'dc-conversation-flow-form', standalone: true, imports: [
|
|
3746
|
-
|
|
4030
|
+
args: [{ selector: 'dc-conversation-flow-form', standalone: true, imports: [
|
|
4031
|
+
CommonModule,
|
|
4032
|
+
ReactiveFormsModule,
|
|
4033
|
+
ButtonModule,
|
|
4034
|
+
InputTextModule,
|
|
4035
|
+
TextareaModule,
|
|
4036
|
+
TooltipModule,
|
|
4037
|
+
AgentTaskFormComponent,
|
|
4038
|
+
SelectModule,
|
|
4039
|
+
DcDoActionFormComponent,
|
|
4040
|
+
DcDynamicConditionsFormComponent,
|
|
4041
|
+
], template: "<div [formGroup]=\"formGroup\" class=\"group bg-pink-50\">\n <h3>Conversation Flow <span pTooltip=\"Define the flow and logic of the conversation\">\u2139\uFE0F</span></h3>\n\n <div class=\"form-field\">\n <label for=\"flowGoal\">Goal <span pTooltip=\"The main objective of this conversation flow\">\u2139\uFE0F</span></label>\n\n <agent-task-form [formGroup]=\"formGroup.controls.goal\" [shortForm]=\"true\"></agent-task-form>\n </div>\n\n <details>\n <summary>Trigger Tasks</summary>\n\n <div formGroupName=\"triggerTasks\" class=\"group\">\n <h4>Trigger Tasks <span (click)=\"showData()\" pTooltip=\"Tasks to be executed on specific conversation events\">\u2139\uFE0F</span></h4>\n @for (eventKey of objectKeys(formGroup.controls.triggerTasks.controls); track eventKey) {\n <!-- {{ eventKey }} -->\n <div class=\"form-field\">\n <label [for]=\"eventKey\">{{ eventKey }}</label>\n <agent-task-form [formGroup]=\"formGroup.controls.triggerTasks.controls[eventKey]\"></agent-task-form>\n </div>\n }\n </div>\n </details>\n\n <div class=\"form-field\">\n <label for=\"flowBonus\">Bonus <span pTooltip=\"Bonus information or context (e.g., JSON string)\">\u2139\uFE0F</span></label>\n <input id=\"flowBonus\" formControlName=\"bonus\" />\n </div>\n\n <dc-dynamic-conditions-form\n [dynamicConditionsArray]=\"formGroup.controls.dynamicConditions\"\n [dynamicConditionsPath]=\"'formGroup.controls.dynamicConditions'\"\n [entityWhatOptions]=\"entityWhatOptions\"\n [entityWhenOptions]=\"entityWhenOptions\"\n [systemPromptTypeOptions]=\"systemPromptTypeOptions\">\n </dc-dynamic-conditions-form>\n</div>\n", styles: [".nested-group{border:1px solid #eee;padding:10px;margin-top:10px;border-radius:4px}.very-nested-group{border:1px dashed #ccc;padding:8px;margin-top:8px;border-radius:4px}.dynamic-condition-item{margin-bottom:15px}\n"] }]
|
|
4042
|
+
}], ctorParameters: () => [], propDecorators: { formGroup: [{
|
|
3747
4043
|
type: Input
|
|
3748
4044
|
}] } });
|
|
3749
4045
|
|
|
4046
|
+
function markdownToHTML(markdownText) {
|
|
4047
|
+
// Convert italics-bold (***text***)
|
|
4048
|
+
let htmlText = markdownText.replace(/\*\*\*(.+?)\*\*\*/g, '<em><strong>$1</strong></em>');
|
|
4049
|
+
// Convert bold (**text**)
|
|
4050
|
+
htmlText = htmlText.replace(/\*\*(.+?)\*\*/g, '<strong>$1</strong>');
|
|
4051
|
+
// Convert italics (*text*)
|
|
4052
|
+
htmlText = htmlText.replace(/\*(.+?)\*/g, '<em>$1</em>');
|
|
4053
|
+
// Convert text enclosed by double quotes ("text")
|
|
4054
|
+
// htmlText = htmlText.replace(/"(.+?)"/g, '<cite>$1</cite>');
|
|
4055
|
+
return htmlText;
|
|
4056
|
+
}
|
|
4057
|
+
class SimpleMdToHtmlPipe {
|
|
4058
|
+
transform(text) {
|
|
4059
|
+
return markdownToHTML(text);
|
|
4060
|
+
}
|
|
4061
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.4", ngImport: i0, type: SimpleMdToHtmlPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe }); }
|
|
4062
|
+
static { this.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "19.2.4", ngImport: i0, type: SimpleMdToHtmlPipe, isStandalone: true, name: "simpleMdToHtml" }); }
|
|
4063
|
+
}
|
|
4064
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.4", ngImport: i0, type: SimpleMdToHtmlPipe, decorators: [{
|
|
4065
|
+
type: Pipe,
|
|
4066
|
+
args: [{
|
|
4067
|
+
name: 'simpleMdToHtml',
|
|
4068
|
+
standalone: true,
|
|
4069
|
+
}]
|
|
4070
|
+
}] });
|
|
4071
|
+
class StartDivToHtmlPipe {
|
|
4072
|
+
// solo create espacio entre lineas
|
|
4073
|
+
transform(text) {
|
|
4074
|
+
text = text.replace(/<start>/gi, '<hr>');
|
|
4075
|
+
text = text.replace(/\n/g, '<br>');
|
|
4076
|
+
return text;
|
|
4077
|
+
}
|
|
4078
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.4", ngImport: i0, type: StartDivToHtmlPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe }); }
|
|
4079
|
+
static { this.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "19.2.4", ngImport: i0, type: StartDivToHtmlPipe, isStandalone: true, name: "startDividerToHtml" }); }
|
|
4080
|
+
}
|
|
4081
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.4", ngImport: i0, type: StartDivToHtmlPipe, decorators: [{
|
|
4082
|
+
type: Pipe,
|
|
4083
|
+
args: [{
|
|
4084
|
+
name: 'startDividerToHtml',
|
|
4085
|
+
standalone: true,
|
|
4086
|
+
}]
|
|
4087
|
+
}] });
|
|
4088
|
+
class MdToHtmlArrayPipe {
|
|
4089
|
+
// devuelve un array de objetos con el contenido y el tag
|
|
4090
|
+
transform(text) {
|
|
4091
|
+
const htmlArray = convertToHTML(text);
|
|
4092
|
+
return htmlArray.map((val) => val.content).join('');
|
|
4093
|
+
}
|
|
4094
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.4", ngImport: i0, type: MdToHtmlArrayPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe }); }
|
|
4095
|
+
static { this.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "19.2.4", ngImport: i0, type: MdToHtmlArrayPipe, isStandalone: true, name: "mdToHtmlArray" }); }
|
|
4096
|
+
}
|
|
4097
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.4", ngImport: i0, type: MdToHtmlArrayPipe, decorators: [{
|
|
4098
|
+
type: Pipe,
|
|
4099
|
+
args: [{
|
|
4100
|
+
name: 'mdToHtmlArray',
|
|
4101
|
+
standalone: true,
|
|
4102
|
+
}]
|
|
4103
|
+
}] });
|
|
4104
|
+
|
|
3750
4105
|
class DcCharacterCardFormComponent {
|
|
3751
4106
|
constructor() {
|
|
3752
4107
|
this.generateMissingDataRequest = new EventEmitter();
|
|
@@ -3754,7 +4109,8 @@ class DcCharacterCardFormComponent {
|
|
|
3754
4109
|
this.cdr = inject(ChangeDetectorRef);
|
|
3755
4110
|
this.agentCardService = inject(CONVERSATION_AI_TOKEN);
|
|
3756
4111
|
this.toastService = inject(TOAST_ALERTS_TOKEN, { optional: true });
|
|
3757
|
-
this.
|
|
4112
|
+
this.formGroupService = inject(FormGroupService);
|
|
4113
|
+
this.markdownForm = new FormGroup({ seeMarkdown: new FormControl(false) });
|
|
3758
4114
|
this.isGenerating = false; // For improveFirstMessage loading state
|
|
3759
4115
|
}
|
|
3760
4116
|
get dataGroup() {
|
|
@@ -3781,34 +4137,15 @@ class DcCharacterCardFormComponent {
|
|
|
3781
4137
|
this.cdr.detectChanges();
|
|
3782
4138
|
}
|
|
3783
4139
|
addArrayItem(controlPath) {
|
|
3784
|
-
|
|
3785
|
-
|
|
3786
|
-
control.push(this.fb.control(''));
|
|
3787
|
-
this.cdr.detectChanges();
|
|
3788
|
-
}
|
|
4140
|
+
this.formGroupService.addArrayItem(this.dataGroup, controlPath);
|
|
4141
|
+
this.cdr.detectChanges();
|
|
3789
4142
|
}
|
|
3790
4143
|
removeArrayItem(controlPath, index) {
|
|
3791
|
-
|
|
3792
|
-
|
|
3793
|
-
control.removeAt(index);
|
|
3794
|
-
this.cdr.detectChanges();
|
|
3795
|
-
}
|
|
4144
|
+
this.formGroupService.removeArrayItem(this.dataGroup, controlPath, index);
|
|
4145
|
+
this.cdr.detectChanges();
|
|
3796
4146
|
}
|
|
3797
4147
|
updateArrayField(controlPath, index, event) {
|
|
3798
|
-
|
|
3799
|
-
if (control instanceof FormArray && event.target instanceof HTMLInputElement) {
|
|
3800
|
-
const formControlAtIndex = control.at(index);
|
|
3801
|
-
if (formControlAtIndex) {
|
|
3802
|
-
formControlAtIndex.setValue(event.target.value);
|
|
3803
|
-
}
|
|
3804
|
-
}
|
|
3805
|
-
else if (control instanceof FormArray && event.target instanceof HTMLTextAreaElement) {
|
|
3806
|
-
// Handle textarea
|
|
3807
|
-
const formControlAtIndex = control.at(index);
|
|
3808
|
-
if (formControlAtIndex) {
|
|
3809
|
-
formControlAtIndex.setValue(event.target.value);
|
|
3810
|
-
}
|
|
3811
|
-
}
|
|
4148
|
+
this.formGroupService.updateArrayField(this.dataGroup, controlPath, index, event);
|
|
3812
4149
|
}
|
|
3813
4150
|
async improveFirstMessage() {
|
|
3814
4151
|
const confirmImprove = window.confirm('Are you sure you want to improve the first message? It might be shortened.');
|
|
@@ -3870,11 +4207,11 @@ Improve the following first message:`;
|
|
|
3870
4207
|
return control;
|
|
3871
4208
|
}
|
|
3872
4209
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.4", ngImport: i0, type: DcCharacterCardFormComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
3873
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.4", type: DcCharacterCardFormComponent, isStandalone: true, selector: "dc-character-card-form", inputs: { characterCardForm: "characterCardForm" }, outputs: { generateMissingDataRequest: "generateMissingDataRequest" }, ngImport: i0, template: "<div [formGroup]=\"characterCardForm\" class=\"p-6 bg-gray-50 min-h-screen\">\n <div formGroupName=\"data\" class=\"card-group space-y-6 bg-white p-8 rounded-lg shadow-md\">\n <div class=\"flex justify-end\">\n <p-button\n (click)=\"generateMissingDataRequest.emit()\"\n icon=\"pi pi-sparkles\"\n [rounded]=\"true\"\n severity=\"info\"\n label=\"Arreglar Campos\"\n styleClass=\"p-button-sm\" />\n </div>\n\n <h3 class=\"text-2xl font-semibold text-gray-700 mb-6\"\n >Character Card <span pTooltip=\"Informaci\u00F3n de la ficha del personaje\" class=\"text-blue-500 cursor-pointer\">\u2139\uFE0F</span></h3\n >\n\n <div class=\"form-field grid grid-cols-1 gap-2\">\n <label for=\"cardName\" class=\"block text-sm font-medium text-gray-700\"\n >Name <span pTooltip=\"El nombre del personaje\" class=\"text-blue-500 cursor-pointer\">\u2139\uFE0F</span></label\n >\n <input\n pInputText\n id=\"cardName\"\n type=\"text\"\n formControlName=\"name\"\n class=\"mt-1 block w-full px-3 py-2 border border-gray-300 rounded-md shadow-sm focus:outline-none focus:ring-indigo-500 focus:border-indigo-500 sm:text-sm\" />\n @if (dataGroup.controls['name']?.errors?.['required'] && dataGroup.controls['name']?.touched) {\n <div class=\"error text-red-500 text-xs mt-1\"> Name is required </div>\n }\n </div>\n\n <div class=\"form-field grid grid-cols-1 gap-2\">\n <label for=\"cardDescription\" class=\"block text-sm font-medium text-gray-700\"\n >Description <span pTooltip=\"Descripci\u00F3n detallada del personaje\" class=\"text-blue-500 cursor-pointer\">\u2139\uFE0F</span></label\n >\n <textarea\n class=\"textmin mt-1 block w-full px-3 py-2 border border-gray-300 rounded-md shadow-sm focus:outline-none focus:ring-indigo-500 focus:border-indigo-500 sm:text-sm\"\n rows=\"3\"\n pTextarea\n [autoResize]=\"true\"\n id=\"cardDescription\"\n formControlName=\"description\"></textarea>\n @if (dataGroup.controls['description']?.errors?.['required'] && dataGroup.controls['description']?.touched) {\n <div class=\"error text-red-500 text-xs mt-1\"> Description is required </div>\n }\n </div>\n\n <div class=\"form-field grid grid-cols-1 gap-2\">\n <label for=\"cardScenario\" class=\"block text-sm font-medium text-gray-700\"\n >Scenario <span pTooltip=\"Describe the context or setting for the conversation\" class=\"text-blue-500 cursor-pointer\">\u2139\uFE0F</span></label\n >\n <textarea\n rows=\"2\"\n pTextarea\n [autoResize]=\"true\"\n id=\"cardScenario\"\n formControlName=\"scenario\"\n class=\"mt-1 block w-full px-3 py-2 border border-gray-300 rounded-md shadow-sm focus:outline-none focus:ring-indigo-500 focus:border-indigo-500 sm:text-sm\"></textarea>\n </div>\n\n <div class=\"form-field grid grid-cols-1 gap-2\">\n <label for=\"cardFirstMessage\" class=\"flex flex-col text-sm font-medium text-gray-700\">\n <div class=\"flex justify-between items-center\">\n <span\n >First Message\n <span\n pTooltip=\"Es muy importante que la historia inicie bien, ya que es el patr\u00F3n inicial para la AI, respetar las convenciones de texto\"\n class=\"text-blue-500 cursor-pointer\"\n >\u2139\uFE0F</span\n ></span\n >\n <div class=\"flex items-center space-x-2\">\n <p-togglebutton\n [formControl]=\"markdownForm.controls.seeMarkdown\"\n [onLabel]=\"'Editar'\"\n [offLabel]=\"'Ver Markdown'\"\n size=\"small\"\n styleClass=\"min-w-16 p-button-sm\"\n (onChange)=\"checkCdr()\" />\n <p-button icon=\"pi pi-refresh\" (click)=\"improveFirstMessage()\" label=\"Mejorar\" styleClass=\"p-button-sm p-button-outlined\"></p-button>\n </div>\n </div>\n </label>\n\n @if(markdownForm.controls.seeMarkdown.value){\n <div [innerHTML]=\"dataGroup.controls['first_mes'].value | mdToHtmlArray\" class=\"prose mt-1 p-3 border border-gray-200 rounded-md bg-gray-50\"></div>\n }@else{\n <textarea\n rows=\"2\"\n pTextarea\n [autoResize]=\"true\"\n id=\"cardFirstMessage\"\n formControlName=\"first_mes\"\n class=\"mt-1 block w-full px-3 py-2 border border-gray-300 rounded-md shadow-sm focus:outline-none focus:ring-indigo-500 focus:border-indigo-500 sm:text-sm\">\n </textarea>\n }\n </div>\n\n <div class=\"form-field grid grid-cols-1 gap-2\">\n <label for=\"mes_example\" class=\"block text-sm font-medium text-gray-700\"\n >Mensajes de Ejemplo <span pTooltip=\"Importante para el estilo de la conversaci\u00F3n\" class=\"text-blue-500 cursor-pointer\">\u2139\uFE0F</span></label\n >\n <textarea\n rows=\"2\"\n pTextarea\n [autoResize]=\"true\"\n id=\"mes_example\"\n formControlName=\"mes_example\"\n class=\"mt-1 block w-full px-3 py-2 border border-gray-300 rounded-md shadow-sm focus:outline-none focus:ring-indigo-500 focus:border-indigo-500 sm:text-sm\"></textarea>\n </div>\n\n <div class=\"form-field grid grid-cols-1 gap-2\">\n <label for=\"cardCreatorNotes\" class=\"block text-sm font-medium text-gray-700\"\n >Creator Notes <span pTooltip=\"son solo notas del creador, no afecta nada a la conversaci\u00F3n\" class=\"text-blue-500 cursor-pointer\">\u2139\uFE0F</span></label\n >\n <textarea\n rows=\"2\"\n pTextarea\n [autoResize]=\"true\"\n id=\"cardCreatorNotes\"\n formControlName=\"creator_notes\"\n class=\"mt-1 block w-full px-3 py-2 border border-gray-300 rounded-md shadow-sm focus:outline-none focus:ring-indigo-500 focus:border-indigo-500 sm:text-sm\"></textarea>\n </div>\n\n <div class=\"form-field grid grid-cols-1 gap-2\">\n <label for=\"cardSystemPrompt\" class=\"block text-sm font-medium text-gray-700\"\n >System Prompt (Opcional) <span pTooltip=\"Instrucciones del sistema para la conversaci\u00F3n\" class=\"text-blue-500 cursor-pointer\">\u2139\uFE0F</span></label\n >\n <textarea\n rows=\"2\"\n pTextarea\n [autoResize]=\"true\"\n id=\"cardSystemPrompt\"\n formControlName=\"system_prompt\"\n class=\"mt-1 block w-full px-3 py-2 border border-gray-300 rounded-md shadow-sm focus:outline-none focus:ring-indigo-500 focus:border-indigo-500 sm:text-sm\"></textarea>\n @if (dataGroup.controls['system_prompt']?.errors?.['required'] && dataGroup.controls['system_prompt']?.touched) {\n <div class=\"error text-red-500 text-xs mt-1\"> System prompt is required </div>\n }\n </div>\n\n <div class=\"form-field grid grid-cols-1 gap-2\">\n <label class=\"block text-sm font-medium text-gray-700\">Image Description</label>\n <textarea\n rows=\"2\"\n pTextarea\n [autoResize]=\"true\"\n formControlName=\"picture_description\"\n class=\"mt-1 block w-full px-3 py-2 border border-gray-300 rounded-md shadow-sm focus:outline-none focus:ring-indigo-500 focus:border-indigo-500 sm:text-sm\"></textarea>\n </div>\n\n <div class=\"form-field grid grid-cols-1 gap-2\">\n <label for=\"cardPostHistoryInstructions\" class=\"block text-sm font-medium text-gray-700\"\n >Post-History Instructions (Opcional)\n <span\n pTooltip=\"Dejar en blanco, al menos que se sepa como funciona, esto se llama jailbreak, es para darle instrucciones finales y m\u00E1s importantes al modelo\"\n class=\"text-blue-500 cursor-pointer\"\n >\u2139\uFE0F</span\n ></label\n >\n <textarea\n rows=\"2\"\n pTextarea\n [autoResize]=\"true\"\n formControlName=\"post_history_instructions\"\n class=\"mt-1 block w-full px-3 py-2 border border-gray-300 rounded-md shadow-sm focus:outline-none focus:ring-indigo-500 focus:border-indigo-500 sm:text-sm\"></textarea>\n </div>\n\n <div class=\"form-field grid grid-cols-1 gap-2\">\n <label for=\"cardAlternateGreetings\" class=\"block text-sm font-medium text-gray-700\"\n >Alternate Greetings <span pTooltip=\"Saludos alternativos para comenzar una historia diferente\" class=\"text-blue-500 cursor-pointer\">\u2139\uFE0F</span></label\n >\n <div class=\"array-field space-y-2\">\n @for (greeting of alternateGreetingsArray.controls; track greeting; let i = $index) {\n <div class=\"array-item flex items-center space-x-2\" style=\"position: relative\">\n <textarea\n pTextarea\n rows=\"1\"\n [autoResize]=\"true\"\n [id]=\"'cardAlternateGreeting' + i\"\n [formControl]=\"asFormControl(greeting)\"\n (input)=\"updateArrayField('alternate_greetings', i, $event)\"\n class=\"mt-1 block w-full px-3 py-2 border border-gray-300 rounded-md shadow-sm focus:outline-none focus:ring-indigo-500 focus:border-indigo-500 sm:text-sm flex-grow\">\n </textarea>\n <button\n pButton\n severity=\"danger\"\n icon=\"pi pi-times\"\n class=\"remove-button p-button-sm p-button-rounded p-button-danger\"\n (click)=\"removeArrayItem('alternate_greetings', i)\"></button>\n </div>\n }\n <button pButton severity=\"info\" label=\"Add Greeting\" icon=\"pi pi-plus\" (click)=\"addArrayItem('alternate_greetings')\" class=\"p-button-sm\"></button>\n </div>\n </div>\n\n <div class=\"form-field grid grid-cols-1 gap-2\">\n <label pTooltip=\"Agrega las categorias\" for=\"cardTags\" class=\"block text-sm font-medium text-gray-700\">Tags \u2139\uFE0F</label>\n <div class=\"array-field space-y-2\">\n @for (tag of tagsArray.controls; track tag; let i = $index) {\n <div class=\"array-item flex items-center space-x-2\">\n <input\n pInputText\n [id]=\"'cardTag' + i\"\n type=\"text\"\n [formControl]=\"asFormControl(tag)\"\n (input)=\"updateArrayField('tags', i, $event)\"\n class=\"mt-1 block w-full px-3 py-2 border border-gray-300 rounded-md shadow-sm focus:outline-none focus:ring-indigo-500 focus:border-indigo-500 sm:text-sm flex-grow\" />\n <button pButton severity=\"danger\" label=\"Remove\" icon=\"pi pi-times\" (click)=\"removeArrayItem('tags', i)\" class=\"p-button-sm\"></button>\n </div>\n }\n <button pButton severity=\"info\" label=\"Add Tag\" icon=\"pi pi-plus\" (click)=\"addArrayItem('tags')\" class=\"p-button-sm\"></button>\n </div>\n </div>\n </div>\n</div>\n", styles: [".textmin{min-height:40px}.array-field{display:flex;flex-direction:column;gap:8px}.array-item{display:flex;align-items:center;gap:8px;position:relative}.array-item textarea,.array-item input[type=text]{flex-grow:1}.remove-button{position:absolute;right:5px;top:5px;min-width:auto!important;width:2rem;height:2rem}\n"], dependencies: [{ kind: "ngmodule", type: ReactiveFormsModule }, { kind: "directive", type: i1.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.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i1.FormControlDirective, selector: "[formControl]", inputs: ["formControl", "disabled", "ngModel"], outputs: ["ngModelChange"], exportAs: ["ngForm"] }, { kind: "directive", type: i1.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "directive", type: i1.FormControlName, selector: "[formControlName]", inputs: ["formControlName", "disabled", "ngModel"], outputs: ["ngModelChange"] }, { kind: "directive", type: i1.FormGroupName, selector: "[formGroupName]", inputs: ["formGroupName"] }, { kind: "ngmodule", type: FormsModule }, { kind: "ngmodule", type: ButtonModule }, { kind: "directive", type: i2$1.ButtonDirective, selector: "[pButton]", inputs: ["iconPos", "loadingIcon", "loading", "severity", "raised", "rounded", "text", "outlined", "size", "plain", "fluid", "label", "icon", "buttonProps"] }, { kind: "component", type: i2$1.Button, selector: "p-button", inputs: ["type", "iconPos", "icon", "badge", "label", "disabled", "loading", "loadingIcon", "raised", "rounded", "text", "plain", "severity", "outlined", "link", "tabindex", "size", "variant", "style", "styleClass", "badgeClass", "badgeSeverity", "ariaLabel", "autofocus", "fluid", "buttonProps"], outputs: ["onClick", "onFocus", "onBlur"] }, { kind: "ngmodule", type: InputTextModule }, { kind: "directive", type: i3$2.InputText, selector: "[pInputText]", inputs: ["variant", "fluid", "pSize"] }, { kind: "ngmodule", type: TextareaModule }, { kind: "directive", type: i3.Textarea, selector: "[pTextarea]", inputs: ["autoResize", "variant", "fluid", "pSize"], outputs: ["onResize"] }, { kind: "ngmodule", type: TooltipModule }, { kind: "directive", type: i5$1.Tooltip, selector: "[pTooltip]", inputs: ["tooltipPosition", "tooltipEvent", "appendTo", "positionStyle", "tooltipStyleClass", "tooltipZIndex", "escape", "showDelay", "hideDelay", "life", "positionTop", "positionLeft", "autoHide", "fitContent", "hideOnEscape", "pTooltip", "tooltipDisabled", "tooltipOptions"] }, { kind: "ngmodule", type: ToggleButtonModule }, { kind: "component", type: i6.ToggleButton, selector: "p-toggleButton, p-togglebutton, p-toggle-button", inputs: ["onLabel", "offLabel", "onIcon", "offIcon", "ariaLabel", "ariaLabelledBy", "disabled", "style", "styleClass", "inputId", "tabindex", "size", "iconPos", "autofocus", "allowEmpty"], outputs: ["onChange"] }, { kind: "pipe", type: MdToHtmlArrayPipe, name: "mdToHtmlArray" }] }); }
|
|
4210
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.4", type: DcCharacterCardFormComponent, isStandalone: true, selector: "dc-character-card-form", inputs: { characterCardForm: "characterCardForm" }, outputs: { generateMissingDataRequest: "generateMissingDataRequest" }, ngImport: i0, template: "<div [formGroup]=\"characterCardForm\" class=\"p-6 bg-teal-50 min-h-screen\">\n <div formGroupName=\"data\" class=\"card-group space-y-6 bg-white p-8 rounded-lg shadow-md\">\n <div class=\"flex justify-end\">\n <p-button\n (click)=\"generateMissingDataRequest.emit()\"\n icon=\"pi pi-sparkles\"\n [rounded]=\"true\"\n severity=\"info\"\n label=\"Arreglar Campos\"\n styleClass=\"p-button-sm\" />\n </div>\n\n <h3 class=\"text-2xl font-semibold text-gray-700 mb-6\"\n >Character Card <span pTooltip=\"Informaci\u00F3n de la ficha del personaje\" class=\"text-blue-500 cursor-pointer\">\u2139\uFE0F</span></h3\n >\n\n <div class=\"form-field grid grid-cols-1 gap-2\">\n <label for=\"cardName\" class=\"block text-sm font-medium text-gray-700\"\n >Name <span pTooltip=\"El nombre del personaje\" class=\"text-blue-500 cursor-pointer\">\u2139\uFE0F</span></label\n >\n <input\n pInputText\n id=\"cardName\"\n type=\"text\"\n formControlName=\"name\"\n class=\"mt-1 block w-full px-3 py-2 border border-gray-300 rounded-md shadow-sm focus:outline-none focus:ring-indigo-500 focus:border-indigo-500 sm:text-sm\" />\n @if (dataGroup.controls['name']?.errors?.['required'] && dataGroup.controls['name']?.touched) {\n <div class=\"error text-red-500 text-xs mt-1\"> Name is required </div>\n }\n </div>\n\n <div class=\"form-field grid grid-cols-1 gap-2\">\n <label for=\"cardDescription\" class=\"block text-sm font-medium text-gray-700\"\n >Description <span pTooltip=\"Descripci\u00F3n detallada del personaje\" class=\"text-blue-500 cursor-pointer\">\u2139\uFE0F</span></label\n >\n <textarea\n class=\"textmin mt-1 block w-full px-3 py-2 border border-gray-300 rounded-md shadow-sm focus:outline-none focus:ring-indigo-500 focus:border-indigo-500 sm:text-sm\"\n rows=\"3\"\n pTextarea\n [autoResize]=\"true\"\n id=\"cardDescription\"\n formControlName=\"description\"></textarea>\n @if (dataGroup.controls['description']?.errors?.['required'] && dataGroup.controls['description']?.touched) {\n <div class=\"error text-red-500 text-xs mt-1\"> Description is required </div>\n }\n </div>\n\n <div class=\"form-field grid grid-cols-1 gap-2\">\n <label for=\"cardScenario\" class=\"block text-sm font-medium text-gray-700\"\n >Scenario <span pTooltip=\"Describe the context or setting for the conversation\" class=\"text-blue-500 cursor-pointer\">\u2139\uFE0F</span></label\n >\n <textarea\n rows=\"2\"\n pTextarea\n [autoResize]=\"true\"\n id=\"cardScenario\"\n formControlName=\"scenario\"\n class=\"mt-1 block w-full px-3 py-2 border border-gray-300 rounded-md shadow-sm focus:outline-none focus:ring-indigo-500 focus:border-indigo-500 sm:text-sm\"></textarea>\n </div>\n\n <div class=\"form-field grid grid-cols-1 gap-2\">\n <label for=\"cardFirstMessage\" class=\"flex flex-col text-sm font-medium text-gray-700\">\n <div class=\"flex justify-between items-center\">\n <span\n >First Message\n <span\n pTooltip=\"Es muy importante que la historia inicie bien, ya que es el patr\u00F3n inicial para la AI, respetar las convenciones de texto\"\n class=\"text-blue-500 cursor-pointer\"\n >\u2139\uFE0F</span\n ></span\n >\n <div class=\"flex items-center space-x-2\">\n <p-togglebutton\n [formControl]=\"markdownForm.controls.seeMarkdown\"\n [onLabel]=\"'Editar'\"\n [offLabel]=\"'Ver Markdown'\"\n size=\"small\"\n styleClass=\"min-w-16 p-button-sm\"\n (onChange)=\"checkCdr()\" />\n <p-button icon=\"pi pi-refresh\" (click)=\"improveFirstMessage()\" label=\"Mejorar\" styleClass=\"p-button-sm p-button-outlined\"></p-button>\n </div>\n </div>\n </label>\n\n @if(markdownForm.controls.seeMarkdown.value){\n <div [innerHTML]=\"dataGroup.controls['first_mes'].value | mdToHtmlArray\" class=\"prose mt-1 p-3 border border-gray-200 rounded-md\"></div>\n }@else{\n <textarea\n rows=\"2\"\n pTextarea\n [autoResize]=\"true\"\n id=\"cardFirstMessage\"\n formControlName=\"first_mes\"\n class=\"mt-1 block w-full px-3 py-2 border border-gray-300 rounded-md shadow-sm focus:outline-none focus:ring-indigo-500 focus:border-indigo-500 sm:text-sm\">\n </textarea>\n }\n </div>\n\n <div class=\"form-field grid grid-cols-1 gap-2\">\n <label for=\"mes_example\" class=\"block text-sm font-medium text-gray-700\"\n >Mensajes de Ejemplo <span pTooltip=\"Importante para el estilo de la conversaci\u00F3n\" class=\"text-blue-500 cursor-pointer\">\u2139\uFE0F</span></label\n >\n <textarea\n rows=\"2\"\n pTextarea\n [autoResize]=\"true\"\n id=\"mes_example\"\n formControlName=\"mes_example\"\n class=\"mt-1 block w-full px-3 py-2 border border-gray-300 rounded-md shadow-sm focus:outline-none focus:ring-indigo-500 focus:border-indigo-500 sm:text-sm\"></textarea>\n </div>\n\n <div class=\"form-field grid grid-cols-1 gap-2\">\n <label for=\"cardCreatorNotes\" class=\"block text-sm font-medium text-gray-700\"\n >Creator Notes <span pTooltip=\"son solo notas del creador, no afecta nada a la conversaci\u00F3n\" class=\"text-blue-500 cursor-pointer\">\u2139\uFE0F</span></label\n >\n <textarea\n rows=\"2\"\n pTextarea\n [autoResize]=\"true\"\n id=\"cardCreatorNotes\"\n formControlName=\"creator_notes\"\n class=\"mt-1 block w-full px-3 py-2 border border-gray-300 rounded-md shadow-sm focus:outline-none focus:ring-indigo-500 focus:border-indigo-500 sm:text-sm\"></textarea>\n </div>\n\n <div class=\"form-field grid grid-cols-1 gap-2\">\n <label for=\"cardSystemPrompt\" class=\"block text-sm font-medium text-gray-700\"\n >System Prompt (Opcional) <span pTooltip=\"Instrucciones del sistema para la conversaci\u00F3n\" class=\"text-blue-500 cursor-pointer\">\u2139\uFE0F</span></label\n >\n <textarea\n rows=\"2\"\n pTextarea\n [autoResize]=\"true\"\n id=\"cardSystemPrompt\"\n formControlName=\"system_prompt\"\n class=\"mt-1 block w-full px-3 py-2 border border-gray-300 rounded-md shadow-sm focus:outline-none focus:ring-indigo-500 focus:border-indigo-500 sm:text-sm\"></textarea>\n @if (dataGroup.controls['system_prompt']?.errors?.['required'] && dataGroup.controls['system_prompt']?.touched) {\n <div class=\"error text-red-500 text-xs mt-1\"> System prompt is required </div>\n }\n </div>\n\n <div class=\"form-field grid grid-cols-1 gap-2\">\n <label class=\"block text-sm font-medium text-gray-700\">Image Description</label>\n <textarea\n rows=\"2\"\n pTextarea\n [autoResize]=\"true\"\n formControlName=\"picture_description\"\n class=\"mt-1 block w-full px-3 py-2 border border-gray-300 rounded-md shadow-sm focus:outline-none focus:ring-indigo-500 focus:border-indigo-500 sm:text-sm\"></textarea>\n </div>\n\n <div class=\"form-field grid grid-cols-1 gap-2\">\n <label for=\"cardPostHistoryInstructions\" class=\"block text-sm font-medium text-gray-700\"\n >Post-History Instructions (Opcional)\n <span\n pTooltip=\"Dejar en blanco, al menos que se sepa como funciona, esto se llama jailbreak, es para darle instrucciones finales y m\u00E1s importantes al modelo\"\n class=\"text-blue-500 cursor-pointer\"\n >\u2139\uFE0F</span\n ></label\n >\n <textarea\n rows=\"2\"\n pTextarea\n [autoResize]=\"true\"\n formControlName=\"post_history_instructions\"\n class=\"mt-1 block w-full px-3 py-2 border border-gray-300 rounded-md shadow-sm focus:outline-none focus:ring-indigo-500 focus:border-indigo-500 sm:text-sm\"></textarea>\n </div>\n\n <div class=\"form-field grid grid-cols-1 gap-2\">\n <label for=\"cardAlternateGreetings\" class=\"block text-sm font-medium text-gray-700\"\n >Alternate Greetings <span pTooltip=\"Saludos alternativos para comenzar una historia diferente\" class=\"text-blue-500 cursor-pointer\">\u2139\uFE0F</span></label\n >\n <div class=\"array-field space-y-2\">\n @for (greeting of alternateGreetingsArray.controls; track greeting; let i = $index) {\n <div class=\"array-item flex items-center space-x-2\" style=\"position: relative\">\n <textarea\n pTextarea\n rows=\"1\"\n [autoResize]=\"true\"\n [id]=\"'cardAlternateGreeting' + i\"\n [formControl]=\"asFormControl(greeting)\"\n (input)=\"updateArrayField('alternate_greetings', i, $event)\"\n class=\"mt-1 block w-full px-3 py-2 border border-gray-300 rounded-md shadow-sm focus:outline-none focus:ring-indigo-500 focus:border-indigo-500 sm:text-sm flex-grow\">\n </textarea>\n <button\n pButton\n severity=\"danger\"\n icon=\"pi pi-times\"\n class=\"remove-button p-button-sm p-button-rounded p-button-danger\"\n (click)=\"removeArrayItem('alternate_greetings', i)\"></button>\n </div>\n }\n <button pButton severity=\"info\" label=\"Add Greeting\" icon=\"pi pi-plus\" (click)=\"addArrayItem('alternate_greetings')\" class=\"p-button-sm\"></button>\n </div>\n </div>\n\n <div class=\"form-field grid grid-cols-1 gap-2\">\n <label pTooltip=\"Agrega las categorias\" for=\"cardTags\" class=\"block text-sm font-medium text-gray-700\">Tags \u2139\uFE0F</label>\n <div class=\"array-field space-y-2\">\n @for (tag of tagsArray.controls; track tag; let i = $index) {\n <div class=\"array-item flex items-center space-x-2\">\n <input\n pInputText\n [id]=\"'cardTag' + i\"\n type=\"text\"\n [formControl]=\"asFormControl(tag)\"\n (input)=\"updateArrayField('tags', i, $event)\"\n class=\"mt-1 block w-full px-3 py-2 border border-gray-300 rounded-md shadow-sm focus:outline-none focus:ring-indigo-500 focus:border-indigo-500 sm:text-sm flex-grow\" />\n <button pButton severity=\"danger\" label=\"Remove\" icon=\"pi pi-times\" (click)=\"removeArrayItem('tags', i)\" class=\"p-button-sm\"></button>\n </div>\n }\n <button pButton severity=\"info\" label=\"Add Tag\" icon=\"pi pi-plus\" (click)=\"addArrayItem('tags')\" class=\"p-button-sm\"></button>\n </div>\n </div>\n </div>\n</div>\n", styles: [".textmin{min-height:40px}.array-field{display:flex;flex-direction:column;gap:8px}.array-item{display:flex;align-items:center;gap:8px;position:relative}.array-item textarea,.array-item input[type=text]{flex-grow:1}.remove-button{position:absolute;right:5px;top:5px;min-width:auto!important;width:2rem;height:2rem}\n"], dependencies: [{ kind: "ngmodule", type: ReactiveFormsModule }, { kind: "directive", type: i1.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.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i1.FormControlDirective, selector: "[formControl]", inputs: ["formControl", "disabled", "ngModel"], outputs: ["ngModelChange"], exportAs: ["ngForm"] }, { kind: "directive", type: i1.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "directive", type: i1.FormControlName, selector: "[formControlName]", inputs: ["formControlName", "disabled", "ngModel"], outputs: ["ngModelChange"] }, { kind: "directive", type: i1.FormGroupName, selector: "[formGroupName]", inputs: ["formGroupName"] }, { kind: "ngmodule", type: FormsModule }, { kind: "ngmodule", type: ButtonModule }, { kind: "directive", type: i2.ButtonDirective, selector: "[pButton]", inputs: ["iconPos", "loadingIcon", "loading", "severity", "raised", "rounded", "text", "outlined", "size", "plain", "fluid", "label", "icon", "buttonProps"] }, { kind: "component", type: i2.Button, selector: "p-button", inputs: ["type", "iconPos", "icon", "badge", "label", "disabled", "loading", "loadingIcon", "raised", "rounded", "text", "plain", "severity", "outlined", "link", "tabindex", "size", "variant", "style", "styleClass", "badgeClass", "badgeSeverity", "ariaLabel", "autofocus", "fluid", "buttonProps"], outputs: ["onClick", "onFocus", "onBlur"] }, { kind: "ngmodule", type: InputTextModule }, { kind: "directive", type: i3$1.InputText, selector: "[pInputText]", inputs: ["variant", "fluid", "pSize"] }, { kind: "ngmodule", type: TextareaModule }, { kind: "directive", type: i4.Textarea, selector: "[pTextarea]", inputs: ["autoResize", "variant", "fluid", "pSize"], outputs: ["onResize"] }, { kind: "ngmodule", type: TooltipModule }, { kind: "directive", type: i5$1.Tooltip, selector: "[pTooltip]", inputs: ["tooltipPosition", "tooltipEvent", "appendTo", "positionStyle", "tooltipStyleClass", "tooltipZIndex", "escape", "showDelay", "hideDelay", "life", "positionTop", "positionLeft", "autoHide", "fitContent", "hideOnEscape", "pTooltip", "tooltipDisabled", "tooltipOptions"] }, { kind: "ngmodule", type: ToggleButtonModule }, { kind: "component", type: i6.ToggleButton, selector: "p-toggleButton, p-togglebutton, p-toggle-button", inputs: ["onLabel", "offLabel", "onIcon", "offIcon", "ariaLabel", "ariaLabelledBy", "disabled", "style", "styleClass", "inputId", "tabindex", "size", "iconPos", "autofocus", "allowEmpty"], outputs: ["onChange"] }, { kind: "pipe", type: MdToHtmlArrayPipe, name: "mdToHtmlArray" }] }); }
|
|
3874
4211
|
}
|
|
3875
4212
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.4", ngImport: i0, type: DcCharacterCardFormComponent, decorators: [{
|
|
3876
4213
|
type: Component,
|
|
3877
|
-
args: [{ selector: 'dc-character-card-form', standalone: true, imports: [ReactiveFormsModule, FormsModule, ButtonModule, InputTextModule, TextareaModule, TooltipModule, ToggleButtonModule, MdToHtmlArrayPipe], template: "<div [formGroup]=\"characterCardForm\" class=\"p-6 bg-gray-50 min-h-screen\">\n <div formGroupName=\"data\" class=\"card-group space-y-6 bg-white p-8 rounded-lg shadow-md\">\n <div class=\"flex justify-end\">\n <p-button\n (click)=\"generateMissingDataRequest.emit()\"\n icon=\"pi pi-sparkles\"\n [rounded]=\"true\"\n severity=\"info\"\n label=\"Arreglar Campos\"\n styleClass=\"p-button-sm\" />\n </div>\n\n <h3 class=\"text-2xl font-semibold text-gray-700 mb-6\"\n >Character Card <span pTooltip=\"Informaci\u00F3n de la ficha del personaje\" class=\"text-blue-500 cursor-pointer\">\u2139\uFE0F</span></h3\n >\n\n <div class=\"form-field grid grid-cols-1 gap-2\">\n <label for=\"cardName\" class=\"block text-sm font-medium text-gray-700\"\n >Name <span pTooltip=\"El nombre del personaje\" class=\"text-blue-500 cursor-pointer\">\u2139\uFE0F</span></label\n >\n <input\n pInputText\n id=\"cardName\"\n type=\"text\"\n formControlName=\"name\"\n class=\"mt-1 block w-full px-3 py-2 border border-gray-300 rounded-md shadow-sm focus:outline-none focus:ring-indigo-500 focus:border-indigo-500 sm:text-sm\" />\n @if (dataGroup.controls['name']?.errors?.['required'] && dataGroup.controls['name']?.touched) {\n <div class=\"error text-red-500 text-xs mt-1\"> Name is required </div>\n }\n </div>\n\n <div class=\"form-field grid grid-cols-1 gap-2\">\n <label for=\"cardDescription\" class=\"block text-sm font-medium text-gray-700\"\n >Description <span pTooltip=\"Descripci\u00F3n detallada del personaje\" class=\"text-blue-500 cursor-pointer\">\u2139\uFE0F</span></label\n >\n <textarea\n class=\"textmin mt-1 block w-full px-3 py-2 border border-gray-300 rounded-md shadow-sm focus:outline-none focus:ring-indigo-500 focus:border-indigo-500 sm:text-sm\"\n rows=\"3\"\n pTextarea\n [autoResize]=\"true\"\n id=\"cardDescription\"\n formControlName=\"description\"></textarea>\n @if (dataGroup.controls['description']?.errors?.['required'] && dataGroup.controls['description']?.touched) {\n <div class=\"error text-red-500 text-xs mt-1\"> Description is required </div>\n }\n </div>\n\n <div class=\"form-field grid grid-cols-1 gap-2\">\n <label for=\"cardScenario\" class=\"block text-sm font-medium text-gray-700\"\n >Scenario <span pTooltip=\"Describe the context or setting for the conversation\" class=\"text-blue-500 cursor-pointer\">\u2139\uFE0F</span></label\n >\n <textarea\n rows=\"2\"\n pTextarea\n [autoResize]=\"true\"\n id=\"cardScenario\"\n formControlName=\"scenario\"\n class=\"mt-1 block w-full px-3 py-2 border border-gray-300 rounded-md shadow-sm focus:outline-none focus:ring-indigo-500 focus:border-indigo-500 sm:text-sm\"></textarea>\n </div>\n\n <div class=\"form-field grid grid-cols-1 gap-2\">\n <label for=\"cardFirstMessage\" class=\"flex flex-col text-sm font-medium text-gray-700\">\n <div class=\"flex justify-between items-center\">\n <span\n >First Message\n <span\n pTooltip=\"Es muy importante que la historia inicie bien, ya que es el patr\u00F3n inicial para la AI, respetar las convenciones de texto\"\n class=\"text-blue-500 cursor-pointer\"\n >\u2139\uFE0F</span\n ></span\n >\n <div class=\"flex items-center space-x-2\">\n <p-togglebutton\n [formControl]=\"markdownForm.controls.seeMarkdown\"\n [onLabel]=\"'Editar'\"\n [offLabel]=\"'Ver Markdown'\"\n size=\"small\"\n styleClass=\"min-w-16 p-button-sm\"\n (onChange)=\"checkCdr()\" />\n <p-button icon=\"pi pi-refresh\" (click)=\"improveFirstMessage()\" label=\"Mejorar\" styleClass=\"p-button-sm p-button-outlined\"></p-button>\n </div>\n </div>\n </label>\n\n @if(markdownForm.controls.seeMarkdown.value){\n <div [innerHTML]=\"dataGroup.controls['first_mes'].value | mdToHtmlArray\" class=\"prose mt-1 p-3 border border-gray-200 rounded-md bg-gray-50\"></div>\n }@else{\n <textarea\n rows=\"2\"\n pTextarea\n [autoResize]=\"true\"\n id=\"cardFirstMessage\"\n formControlName=\"first_mes\"\n class=\"mt-1 block w-full px-3 py-2 border border-gray-300 rounded-md shadow-sm focus:outline-none focus:ring-indigo-500 focus:border-indigo-500 sm:text-sm\">\n </textarea>\n }\n </div>\n\n <div class=\"form-field grid grid-cols-1 gap-2\">\n <label for=\"mes_example\" class=\"block text-sm font-medium text-gray-700\"\n >Mensajes de Ejemplo <span pTooltip=\"Importante para el estilo de la conversaci\u00F3n\" class=\"text-blue-500 cursor-pointer\">\u2139\uFE0F</span></label\n >\n <textarea\n rows=\"2\"\n pTextarea\n [autoResize]=\"true\"\n id=\"mes_example\"\n formControlName=\"mes_example\"\n class=\"mt-1 block w-full px-3 py-2 border border-gray-300 rounded-md shadow-sm focus:outline-none focus:ring-indigo-500 focus:border-indigo-500 sm:text-sm\"></textarea>\n </div>\n\n <div class=\"form-field grid grid-cols-1 gap-2\">\n <label for=\"cardCreatorNotes\" class=\"block text-sm font-medium text-gray-700\"\n >Creator Notes <span pTooltip=\"son solo notas del creador, no afecta nada a la conversaci\u00F3n\" class=\"text-blue-500 cursor-pointer\">\u2139\uFE0F</span></label\n >\n <textarea\n rows=\"2\"\n pTextarea\n [autoResize]=\"true\"\n id=\"cardCreatorNotes\"\n formControlName=\"creator_notes\"\n class=\"mt-1 block w-full px-3 py-2 border border-gray-300 rounded-md shadow-sm focus:outline-none focus:ring-indigo-500 focus:border-indigo-500 sm:text-sm\"></textarea>\n </div>\n\n <div class=\"form-field grid grid-cols-1 gap-2\">\n <label for=\"cardSystemPrompt\" class=\"block text-sm font-medium text-gray-700\"\n >System Prompt (Opcional) <span pTooltip=\"Instrucciones del sistema para la conversaci\u00F3n\" class=\"text-blue-500 cursor-pointer\">\u2139\uFE0F</span></label\n >\n <textarea\n rows=\"2\"\n pTextarea\n [autoResize]=\"true\"\n id=\"cardSystemPrompt\"\n formControlName=\"system_prompt\"\n class=\"mt-1 block w-full px-3 py-2 border border-gray-300 rounded-md shadow-sm focus:outline-none focus:ring-indigo-500 focus:border-indigo-500 sm:text-sm\"></textarea>\n @if (dataGroup.controls['system_prompt']?.errors?.['required'] && dataGroup.controls['system_prompt']?.touched) {\n <div class=\"error text-red-500 text-xs mt-1\"> System prompt is required </div>\n }\n </div>\n\n <div class=\"form-field grid grid-cols-1 gap-2\">\n <label class=\"block text-sm font-medium text-gray-700\">Image Description</label>\n <textarea\n rows=\"2\"\n pTextarea\n [autoResize]=\"true\"\n formControlName=\"picture_description\"\n class=\"mt-1 block w-full px-3 py-2 border border-gray-300 rounded-md shadow-sm focus:outline-none focus:ring-indigo-500 focus:border-indigo-500 sm:text-sm\"></textarea>\n </div>\n\n <div class=\"form-field grid grid-cols-1 gap-2\">\n <label for=\"cardPostHistoryInstructions\" class=\"block text-sm font-medium text-gray-700\"\n >Post-History Instructions (Opcional)\n <span\n pTooltip=\"Dejar en blanco, al menos que se sepa como funciona, esto se llama jailbreak, es para darle instrucciones finales y m\u00E1s importantes al modelo\"\n class=\"text-blue-500 cursor-pointer\"\n >\u2139\uFE0F</span\n ></label\n >\n <textarea\n rows=\"2\"\n pTextarea\n [autoResize]=\"true\"\n formControlName=\"post_history_instructions\"\n class=\"mt-1 block w-full px-3 py-2 border border-gray-300 rounded-md shadow-sm focus:outline-none focus:ring-indigo-500 focus:border-indigo-500 sm:text-sm\"></textarea>\n </div>\n\n <div class=\"form-field grid grid-cols-1 gap-2\">\n <label for=\"cardAlternateGreetings\" class=\"block text-sm font-medium text-gray-700\"\n >Alternate Greetings <span pTooltip=\"Saludos alternativos para comenzar una historia diferente\" class=\"text-blue-500 cursor-pointer\">\u2139\uFE0F</span></label\n >\n <div class=\"array-field space-y-2\">\n @for (greeting of alternateGreetingsArray.controls; track greeting; let i = $index) {\n <div class=\"array-item flex items-center space-x-2\" style=\"position: relative\">\n <textarea\n pTextarea\n rows=\"1\"\n [autoResize]=\"true\"\n [id]=\"'cardAlternateGreeting' + i\"\n [formControl]=\"asFormControl(greeting)\"\n (input)=\"updateArrayField('alternate_greetings', i, $event)\"\n class=\"mt-1 block w-full px-3 py-2 border border-gray-300 rounded-md shadow-sm focus:outline-none focus:ring-indigo-500 focus:border-indigo-500 sm:text-sm flex-grow\">\n </textarea>\n <button\n pButton\n severity=\"danger\"\n icon=\"pi pi-times\"\n class=\"remove-button p-button-sm p-button-rounded p-button-danger\"\n (click)=\"removeArrayItem('alternate_greetings', i)\"></button>\n </div>\n }\n <button pButton severity=\"info\" label=\"Add Greeting\" icon=\"pi pi-plus\" (click)=\"addArrayItem('alternate_greetings')\" class=\"p-button-sm\"></button>\n </div>\n </div>\n\n <div class=\"form-field grid grid-cols-1 gap-2\">\n <label pTooltip=\"Agrega las categorias\" for=\"cardTags\" class=\"block text-sm font-medium text-gray-700\">Tags \u2139\uFE0F</label>\n <div class=\"array-field space-y-2\">\n @for (tag of tagsArray.controls; track tag; let i = $index) {\n <div class=\"array-item flex items-center space-x-2\">\n <input\n pInputText\n [id]=\"'cardTag' + i\"\n type=\"text\"\n [formControl]=\"asFormControl(tag)\"\n (input)=\"updateArrayField('tags', i, $event)\"\n class=\"mt-1 block w-full px-3 py-2 border border-gray-300 rounded-md shadow-sm focus:outline-none focus:ring-indigo-500 focus:border-indigo-500 sm:text-sm flex-grow\" />\n <button pButton severity=\"danger\" label=\"Remove\" icon=\"pi pi-times\" (click)=\"removeArrayItem('tags', i)\" class=\"p-button-sm\"></button>\n </div>\n }\n <button pButton severity=\"info\" label=\"Add Tag\" icon=\"pi pi-plus\" (click)=\"addArrayItem('tags')\" class=\"p-button-sm\"></button>\n </div>\n </div>\n </div>\n</div>\n", styles: [".textmin{min-height:40px}.array-field{display:flex;flex-direction:column;gap:8px}.array-item{display:flex;align-items:center;gap:8px;position:relative}.array-item textarea,.array-item input[type=text]{flex-grow:1}.remove-button{position:absolute;right:5px;top:5px;min-width:auto!important;width:2rem;height:2rem}\n"] }]
|
|
4214
|
+
args: [{ selector: 'dc-character-card-form', standalone: true, imports: [ReactiveFormsModule, FormsModule, ButtonModule, InputTextModule, TextareaModule, TooltipModule, ToggleButtonModule, MdToHtmlArrayPipe], template: "<div [formGroup]=\"characterCardForm\" class=\"p-6 bg-teal-50 min-h-screen\">\n <div formGroupName=\"data\" class=\"card-group space-y-6 bg-white p-8 rounded-lg shadow-md\">\n <div class=\"flex justify-end\">\n <p-button\n (click)=\"generateMissingDataRequest.emit()\"\n icon=\"pi pi-sparkles\"\n [rounded]=\"true\"\n severity=\"info\"\n label=\"Arreglar Campos\"\n styleClass=\"p-button-sm\" />\n </div>\n\n <h3 class=\"text-2xl font-semibold text-gray-700 mb-6\"\n >Character Card <span pTooltip=\"Informaci\u00F3n de la ficha del personaje\" class=\"text-blue-500 cursor-pointer\">\u2139\uFE0F</span></h3\n >\n\n <div class=\"form-field grid grid-cols-1 gap-2\">\n <label for=\"cardName\" class=\"block text-sm font-medium text-gray-700\"\n >Name <span pTooltip=\"El nombre del personaje\" class=\"text-blue-500 cursor-pointer\">\u2139\uFE0F</span></label\n >\n <input\n pInputText\n id=\"cardName\"\n type=\"text\"\n formControlName=\"name\"\n class=\"mt-1 block w-full px-3 py-2 border border-gray-300 rounded-md shadow-sm focus:outline-none focus:ring-indigo-500 focus:border-indigo-500 sm:text-sm\" />\n @if (dataGroup.controls['name']?.errors?.['required'] && dataGroup.controls['name']?.touched) {\n <div class=\"error text-red-500 text-xs mt-1\"> Name is required </div>\n }\n </div>\n\n <div class=\"form-field grid grid-cols-1 gap-2\">\n <label for=\"cardDescription\" class=\"block text-sm font-medium text-gray-700\"\n >Description <span pTooltip=\"Descripci\u00F3n detallada del personaje\" class=\"text-blue-500 cursor-pointer\">\u2139\uFE0F</span></label\n >\n <textarea\n class=\"textmin mt-1 block w-full px-3 py-2 border border-gray-300 rounded-md shadow-sm focus:outline-none focus:ring-indigo-500 focus:border-indigo-500 sm:text-sm\"\n rows=\"3\"\n pTextarea\n [autoResize]=\"true\"\n id=\"cardDescription\"\n formControlName=\"description\"></textarea>\n @if (dataGroup.controls['description']?.errors?.['required'] && dataGroup.controls['description']?.touched) {\n <div class=\"error text-red-500 text-xs mt-1\"> Description is required </div>\n }\n </div>\n\n <div class=\"form-field grid grid-cols-1 gap-2\">\n <label for=\"cardScenario\" class=\"block text-sm font-medium text-gray-700\"\n >Scenario <span pTooltip=\"Describe the context or setting for the conversation\" class=\"text-blue-500 cursor-pointer\">\u2139\uFE0F</span></label\n >\n <textarea\n rows=\"2\"\n pTextarea\n [autoResize]=\"true\"\n id=\"cardScenario\"\n formControlName=\"scenario\"\n class=\"mt-1 block w-full px-3 py-2 border border-gray-300 rounded-md shadow-sm focus:outline-none focus:ring-indigo-500 focus:border-indigo-500 sm:text-sm\"></textarea>\n </div>\n\n <div class=\"form-field grid grid-cols-1 gap-2\">\n <label for=\"cardFirstMessage\" class=\"flex flex-col text-sm font-medium text-gray-700\">\n <div class=\"flex justify-between items-center\">\n <span\n >First Message\n <span\n pTooltip=\"Es muy importante que la historia inicie bien, ya que es el patr\u00F3n inicial para la AI, respetar las convenciones de texto\"\n class=\"text-blue-500 cursor-pointer\"\n >\u2139\uFE0F</span\n ></span\n >\n <div class=\"flex items-center space-x-2\">\n <p-togglebutton\n [formControl]=\"markdownForm.controls.seeMarkdown\"\n [onLabel]=\"'Editar'\"\n [offLabel]=\"'Ver Markdown'\"\n size=\"small\"\n styleClass=\"min-w-16 p-button-sm\"\n (onChange)=\"checkCdr()\" />\n <p-button icon=\"pi pi-refresh\" (click)=\"improveFirstMessage()\" label=\"Mejorar\" styleClass=\"p-button-sm p-button-outlined\"></p-button>\n </div>\n </div>\n </label>\n\n @if(markdownForm.controls.seeMarkdown.value){\n <div [innerHTML]=\"dataGroup.controls['first_mes'].value | mdToHtmlArray\" class=\"prose mt-1 p-3 border border-gray-200 rounded-md\"></div>\n }@else{\n <textarea\n rows=\"2\"\n pTextarea\n [autoResize]=\"true\"\n id=\"cardFirstMessage\"\n formControlName=\"first_mes\"\n class=\"mt-1 block w-full px-3 py-2 border border-gray-300 rounded-md shadow-sm focus:outline-none focus:ring-indigo-500 focus:border-indigo-500 sm:text-sm\">\n </textarea>\n }\n </div>\n\n <div class=\"form-field grid grid-cols-1 gap-2\">\n <label for=\"mes_example\" class=\"block text-sm font-medium text-gray-700\"\n >Mensajes de Ejemplo <span pTooltip=\"Importante para el estilo de la conversaci\u00F3n\" class=\"text-blue-500 cursor-pointer\">\u2139\uFE0F</span></label\n >\n <textarea\n rows=\"2\"\n pTextarea\n [autoResize]=\"true\"\n id=\"mes_example\"\n formControlName=\"mes_example\"\n class=\"mt-1 block w-full px-3 py-2 border border-gray-300 rounded-md shadow-sm focus:outline-none focus:ring-indigo-500 focus:border-indigo-500 sm:text-sm\"></textarea>\n </div>\n\n <div class=\"form-field grid grid-cols-1 gap-2\">\n <label for=\"cardCreatorNotes\" class=\"block text-sm font-medium text-gray-700\"\n >Creator Notes <span pTooltip=\"son solo notas del creador, no afecta nada a la conversaci\u00F3n\" class=\"text-blue-500 cursor-pointer\">\u2139\uFE0F</span></label\n >\n <textarea\n rows=\"2\"\n pTextarea\n [autoResize]=\"true\"\n id=\"cardCreatorNotes\"\n formControlName=\"creator_notes\"\n class=\"mt-1 block w-full px-3 py-2 border border-gray-300 rounded-md shadow-sm focus:outline-none focus:ring-indigo-500 focus:border-indigo-500 sm:text-sm\"></textarea>\n </div>\n\n <div class=\"form-field grid grid-cols-1 gap-2\">\n <label for=\"cardSystemPrompt\" class=\"block text-sm font-medium text-gray-700\"\n >System Prompt (Opcional) <span pTooltip=\"Instrucciones del sistema para la conversaci\u00F3n\" class=\"text-blue-500 cursor-pointer\">\u2139\uFE0F</span></label\n >\n <textarea\n rows=\"2\"\n pTextarea\n [autoResize]=\"true\"\n id=\"cardSystemPrompt\"\n formControlName=\"system_prompt\"\n class=\"mt-1 block w-full px-3 py-2 border border-gray-300 rounded-md shadow-sm focus:outline-none focus:ring-indigo-500 focus:border-indigo-500 sm:text-sm\"></textarea>\n @if (dataGroup.controls['system_prompt']?.errors?.['required'] && dataGroup.controls['system_prompt']?.touched) {\n <div class=\"error text-red-500 text-xs mt-1\"> System prompt is required </div>\n }\n </div>\n\n <div class=\"form-field grid grid-cols-1 gap-2\">\n <label class=\"block text-sm font-medium text-gray-700\">Image Description</label>\n <textarea\n rows=\"2\"\n pTextarea\n [autoResize]=\"true\"\n formControlName=\"picture_description\"\n class=\"mt-1 block w-full px-3 py-2 border border-gray-300 rounded-md shadow-sm focus:outline-none focus:ring-indigo-500 focus:border-indigo-500 sm:text-sm\"></textarea>\n </div>\n\n <div class=\"form-field grid grid-cols-1 gap-2\">\n <label for=\"cardPostHistoryInstructions\" class=\"block text-sm font-medium text-gray-700\"\n >Post-History Instructions (Opcional)\n <span\n pTooltip=\"Dejar en blanco, al menos que se sepa como funciona, esto se llama jailbreak, es para darle instrucciones finales y m\u00E1s importantes al modelo\"\n class=\"text-blue-500 cursor-pointer\"\n >\u2139\uFE0F</span\n ></label\n >\n <textarea\n rows=\"2\"\n pTextarea\n [autoResize]=\"true\"\n formControlName=\"post_history_instructions\"\n class=\"mt-1 block w-full px-3 py-2 border border-gray-300 rounded-md shadow-sm focus:outline-none focus:ring-indigo-500 focus:border-indigo-500 sm:text-sm\"></textarea>\n </div>\n\n <div class=\"form-field grid grid-cols-1 gap-2\">\n <label for=\"cardAlternateGreetings\" class=\"block text-sm font-medium text-gray-700\"\n >Alternate Greetings <span pTooltip=\"Saludos alternativos para comenzar una historia diferente\" class=\"text-blue-500 cursor-pointer\">\u2139\uFE0F</span></label\n >\n <div class=\"array-field space-y-2\">\n @for (greeting of alternateGreetingsArray.controls; track greeting; let i = $index) {\n <div class=\"array-item flex items-center space-x-2\" style=\"position: relative\">\n <textarea\n pTextarea\n rows=\"1\"\n [autoResize]=\"true\"\n [id]=\"'cardAlternateGreeting' + i\"\n [formControl]=\"asFormControl(greeting)\"\n (input)=\"updateArrayField('alternate_greetings', i, $event)\"\n class=\"mt-1 block w-full px-3 py-2 border border-gray-300 rounded-md shadow-sm focus:outline-none focus:ring-indigo-500 focus:border-indigo-500 sm:text-sm flex-grow\">\n </textarea>\n <button\n pButton\n severity=\"danger\"\n icon=\"pi pi-times\"\n class=\"remove-button p-button-sm p-button-rounded p-button-danger\"\n (click)=\"removeArrayItem('alternate_greetings', i)\"></button>\n </div>\n }\n <button pButton severity=\"info\" label=\"Add Greeting\" icon=\"pi pi-plus\" (click)=\"addArrayItem('alternate_greetings')\" class=\"p-button-sm\"></button>\n </div>\n </div>\n\n <div class=\"form-field grid grid-cols-1 gap-2\">\n <label pTooltip=\"Agrega las categorias\" for=\"cardTags\" class=\"block text-sm font-medium text-gray-700\">Tags \u2139\uFE0F</label>\n <div class=\"array-field space-y-2\">\n @for (tag of tagsArray.controls; track tag; let i = $index) {\n <div class=\"array-item flex items-center space-x-2\">\n <input\n pInputText\n [id]=\"'cardTag' + i\"\n type=\"text\"\n [formControl]=\"asFormControl(tag)\"\n (input)=\"updateArrayField('tags', i, $event)\"\n class=\"mt-1 block w-full px-3 py-2 border border-gray-300 rounded-md shadow-sm focus:outline-none focus:ring-indigo-500 focus:border-indigo-500 sm:text-sm flex-grow\" />\n <button pButton severity=\"danger\" label=\"Remove\" icon=\"pi pi-times\" (click)=\"removeArrayItem('tags', i)\" class=\"p-button-sm\"></button>\n </div>\n }\n <button pButton severity=\"info\" label=\"Add Tag\" icon=\"pi pi-plus\" (click)=\"addArrayItem('tags')\" class=\"p-button-sm\"></button>\n </div>\n </div>\n </div>\n</div>\n", styles: [".textmin{min-height:40px}.array-field{display:flex;flex-direction:column;gap:8px}.array-item{display:flex;align-items:center;gap:8px;position:relative}.array-item textarea,.array-item input[type=text]{flex-grow:1}.remove-button{position:absolute;right:5px;top:5px;min-width:auto!important;width:2rem;height:2rem}\n"] }]
|
|
3878
4215
|
}], propDecorators: { characterCardForm: [{
|
|
3879
4216
|
type: Input,
|
|
3880
4217
|
args: [{ required: true }]
|
|
@@ -3933,6 +4270,7 @@ class DCAgentCardFormComponent {
|
|
|
3933
4270
|
version: ['1.0'],
|
|
3934
4271
|
id: [''],
|
|
3935
4272
|
title: [''],
|
|
4273
|
+
description: [''],
|
|
3936
4274
|
lang: [''],
|
|
3937
4275
|
characterCard: this.formGroupService.createCharacterCardFormGroup(),
|
|
3938
4276
|
conversationSettings: this.formGroupService.createConversationSettingFormGroup(),
|
|
@@ -3975,17 +4313,11 @@ class DCAgentCardFormComponent {
|
|
|
3975
4313
|
}
|
|
3976
4314
|
}
|
|
3977
4315
|
patchFormWithConversationData() {
|
|
3978
|
-
// Ensure conversationFlow and its sub-properties are initialized if not present
|
|
3979
4316
|
// const conversationFlowData: Partial<IConversationFlow> = this.conversation?.conversationFlow || {};
|
|
3980
4317
|
this.form.patchValue(this.conversation);
|
|
3981
4318
|
// Patch dynamicConditions FormArray after the main form is patched
|
|
3982
4319
|
const dynamicConditionsFormArray = this.form.get('conversationFlow.dynamicConditions');
|
|
3983
4320
|
dynamicConditionsFormArray.clear(); // Clear any existing default items
|
|
3984
|
-
// if (this.conversation.conversationFlow?.dynamicConditions?.length) {
|
|
3985
|
-
// this.conversation.conversationFlow.dynamicConditions.forEach((condition: DynamicCondition) => {
|
|
3986
|
-
// dynamicConditionsFormArray.push(this.createDynamicConditionFormGroup(condition));
|
|
3987
|
-
// });
|
|
3988
|
-
// }
|
|
3989
4321
|
}
|
|
3990
4322
|
handleArrayForms() {
|
|
3991
4323
|
// If not posible to patch arrays if control does not exist, that why they are created dinamycally depending on the data.
|
|
@@ -4000,6 +4332,14 @@ class DCAgentCardFormComponent {
|
|
|
4000
4332
|
const dynamicConditionsFormArray = this.form.get('conversationFlow.dynamicConditions');
|
|
4001
4333
|
this.conversation.conversationFlow.dynamicConditions.forEach((condition) => {
|
|
4002
4334
|
dynamicConditionsFormArray.push(this.formGroupService.createDynamicConditionFormGroup(condition));
|
|
4335
|
+
if (condition?.do?.length) {
|
|
4336
|
+
for (let control of dynamicConditionsFormArray.controls) {
|
|
4337
|
+
const doFormArray = control.get('do');
|
|
4338
|
+
condition.do.forEach((action) => {
|
|
4339
|
+
doFormArray.push(this.formGroupService.createDoActionFormGroup(action));
|
|
4340
|
+
});
|
|
4341
|
+
}
|
|
4342
|
+
}
|
|
4003
4343
|
});
|
|
4004
4344
|
}
|
|
4005
4345
|
}
|
|
@@ -4238,8 +4578,18 @@ class DCAgentCardFormComponent {
|
|
|
4238
4578
|
}
|
|
4239
4579
|
});
|
|
4240
4580
|
}
|
|
4581
|
+
openConversationTypeDialog() {
|
|
4582
|
+
const dialogRef = this.dialogService.open(PromptConversationTypesDialogComponent, {
|
|
4583
|
+
header: 'Select Conversation Type',
|
|
4584
|
+
width: '50vw',
|
|
4585
|
+
contentStyle: { 'max-height': '90vh', overflow: 'auto' },
|
|
4586
|
+
baseZIndex: 1000,
|
|
4587
|
+
closable: true,
|
|
4588
|
+
modal: true,
|
|
4589
|
+
});
|
|
4590
|
+
}
|
|
4241
4591
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.4", ngImport: i0, type: DCAgentCardFormComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
4242
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.4", type: DCAgentCardFormComponent, isStandalone: true, selector: "dc-agent-form", inputs: { storageSettings: { classPropertyName: "storageSettings", publicName: "storageSettings", isSignal: true, isRequired: false, transformFunction: null }, bannerImgSettings: { classPropertyName: "bannerImgSettings", publicName: "bannerImgSettings", isSignal: true, isRequired: false, transformFunction: null }, imageStorageSettings: { classPropertyName: "imageStorageSettings", publicName: "imageStorageSettings", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { onImageLoaded: "onImageLoaded", onSave: "onSave", onGoDetails: "onGoDetails", onTranslate: "onTranslate" }, providers: [DialogService], ngImport: i0, template: "<p-card>\n <div class=\"top-buttons\">\n <button pButton severity=\"info\" (click)=\"checkPrompt()\" label=\"\uD83D\uDC41\uFE0F Ver instrucciones finales \uD83D\uDCD3\"></button>\n\n <button pButton severity=\"info\" (click)=\"goToDetails()\" label=\"\uD83D\uDCAC Conversar\"></button>\n <button pButton severity=\"primary\" (click)=\"saveConversation()\" label=\"\uD83D\uDCBE Guardar cambios\"></button>\n </div>\n\n <div class=\"top-buttons\">\n <p-button severity=\"help\" (click)=\"translate()\" label=\"\uD83D\uDD04 Traducir\"></p-button>\n <p-button [loading]=\"isGenerating\" severity=\"help\" (click)=\"generateCharacter()\" label=\"Generar \uD83E\uDDBE\"></p-button>\n\n <p-button severity=\"info\" (click)=\"downloadConversation()\" label=\"\uD83D\uDCC1 Exportar \u2B07\uFE0F\"></p-button>\n <p-button severity=\"info\" (click)=\"importConversation()\" label=\"\uD83C\uDCCF Importar \u2B06\uFE0F\"></p-button>\n </div>\n\n <br />\n <br />\n <form [formGroup]=\"form\" class=\"conversation-form\">\n <div class=\"form-grid\">\n <div class=\"left-column\">\n <div style=\"display: flex; gap: 15px\">\n <div class=\"form-field\">\n <label for=\"version\">Version: {{ form.controls.version.value }} <span pTooltip=\"Version number of the conversation\">\u2139\uFE0F</span></label>\n </div>\n\n <div class=\"form-field\">\n <label for=\"id\"\n >ID: <span pTooltip=\"Unique identifier for this conversation\"> {{ form.controls.id.value }} \u2139\uFE0F</span></label\n >\n </div>\n </div>\n\n <div class=\"form-field\">\n <label for=\"title\">Title <span pTooltip=\"T\u00EDtulo de la conversaci\u00F3n\">\u2139\uFE0F</span></label>\n <input pInputText id=\"title\" type=\"text\" formControlName=\"title\" />\n @if(form.controls.title.errors?.['required'] && form.controls.title.touched){\n <div class=\"error\"> Title is required </div>\n }\n </div>\n\n <div class=\"form-field\">\n <label for=\"lang\">Language <span pTooltip=\"Select the primary language for the conversation\">\u2139\uFE0F</span></label>\n <p-select\n id=\"lang\"\n [options]=\"languageOptions\"\n formControlName=\"lang\"\n optionLabel=\"label\"\n optionValue=\"value\"\n [placeholder]=\"'Select Language'\"></p-select>\n </div>\n\n <div formGroupName=\"conversationSettings\" class=\"group\">\n <h3>Conversation Settings <span pTooltip=\"Additional information about the conversation\">\u2139\uFE0F</span></h3>\n\n <div class=\"form-field\">\n <label for=\"modelQuality\"\n >Calidad del modelo\n <span\n pTooltip=\"Mientras inteligente, es m\u00E1s lento y costoso $$, considera usar el rapido o balanceado salvo que necesitas una evaluaci\u00F3n muy compleja. \"\n >\u2139\uFE0F</span\n ></label\n >\n <p-select\n id=\"modelQuality\"\n [options]=\"modelQualityOptions\"\n formControlName=\"modelQuality\"\n optionLabel=\"label\"\n optionValue=\"value\"\n [placeholder]=\"'Select Model Quality'\">\n </p-select>\n </div>\n\n <div class=\"form-field\">\n <label for=\"textEngine\">\n Text Engine\n <span\n class=\"cursor-pointer\"\n (click)=\"textEngineDialog.toggle($event)\"\n pTooltip=\"Sistema de generaci\u00F3n de texto y audios. Client: el cliente llama al servidor en cada dialogo de voz/personaje, es optimo para historias, Server SSML: se sintetiza todo el audio en uno solo con los distintos cambios de voz/personaje, util para la reflexi\u00F3n porque es bilingue, utiliza dialogos en ingles y espa\u00F1ol en el mismo dialogo/audio\"\n >\u2139\uFE0F</span\n >\n </label>\n\n <p-select\n id=\"textEngine\"\n [options]=\"textEngineOptions\"\n formControlName=\"textEngine\"\n optionLabel=\"label\"\n optionValue=\"value\"\n [placeholder]=\"'Select Text Engine'\"></p-select>\n </div>\n\n <div class=\"form-field\">\n <label for=\"conversationType\">Conversation Type <span pTooltip=\"Choose the type of conversation interaction\">\u2139\uFE0F</span></label>\n <p-select\n id=\"conversationType\"\n [options]=\"conversationOptions\"\n formControlName=\"conversationType\"\n optionLabel=\"label\"\n optionValue=\"value\"\n [placeholder]=\"'Select Conversation Type'\"></p-select>\n </div>\n\n <div class=\"form-field\">\n <label> Auto Start <span pTooltip=\"Start conversation automatically\">\u2139\uFE0F</span> </label>\n <p-toggleSwitch formControlName=\"autoStart\"> </p-toggleSwitch>\n </div>\n\n <div formGroupName=\"tts\" class=\"group\">\n <h3>TTS Settings <span pTooltip=\"Text-to-Speech configuration options\">\u2139\uFE0F</span></h3>\n\n <div class=\"form-field\">\n <label for=\"voice\">Voice <span pTooltip=\"Select the primary voice for text-to-speech\">\u2139\uFE0F</span></label>\n\n <p-inputgroup>\n <p-inputgroup-addon>\n <p-button [rounded]=\"true\" [text]=\"true\" icon=\"pi pi-exclamation-circle\" (click)=\"openVoiceSelector(true)\" />\n </p-inputgroup-addon>\n\n <p-select\n id=\"voice\"\n [editable]=\"true\"\n [options]=\"voiceTTSOptions\"\n formControlName=\"voice\"\n optionLabel=\"name\"\n optionValue=\"id\"\n [placeholder]=\"'Select Voice'\"></p-select>\n </p-inputgroup>\n </div>\n\n <div class=\"form-field\">\n <label for=\"secondaryVoice\">Secondary Voice <span pTooltip=\"Select an alternative voice for text-to-speech\">\u2139\uFE0F</span></label>\n\n <p-inputgroup>\n <p-inputgroup-addon>\n <p-button [rounded]=\"true\" [text]=\"true\" icon=\"pi pi-info-circle\" (click)=\"openVoiceSelector(false)\" />\n </p-inputgroup-addon>\n\n <p-select\n id=\"secondaryVoice\"\n [editable]=\"true\"\n [options]=\"voiceTTSOptions\"\n formControlName=\"secondaryVoice\"\n optionLabel=\"name\"\n optionValue=\"id\"\n [placeholder]=\"'Select Secondary Voice'\"></p-select>\n </p-inputgroup>\n </div>\n\n <div class=\"form-field\">\n <label for=\"speed\">Speed <span pTooltip=\"Set the speech rate for text-to-speech conversion\">\u2139\uFE0F</span></label>\n <p-select\n id=\"speed\"\n [options]=\"audioSpeedOptions\"\n formControlName=\"speed\"\n optionLabel=\"label\"\n optionValue=\"value\"\n [placeholder]=\"'Select Speed'\"></p-select>\n </div>\n\n <div class=\"form-field\">\n <label for=\"speedRate\">Speed Rate <span pTooltip=\"Adjust the rate of speech delivery\">\u2139\uFE0F</span></label>\n <input pInputText id=\"speedRate\" type=\"number\" formControlName=\"speedRate\" step=\"0.1\" />\n </div>\n </div>\n\n <dc-model-selector [modelForm]=\"form.controls.conversationSettings.controls.model\" [shortForm]=\"true\"></dc-model-selector>\n </div>\n\n <details>\n <summary>Meta Information</summary>\n <div formGroupName=\"metaApp\" class=\"group\">\n <h3>Meta Information <span pTooltip=\"Additional information about the conversation\">\u2139\uFE0F</span></h3>\n <div class=\"form-field\">\n <label for=\"authorId\">Author ID <span pTooltip=\"Unique identifier for the conversation author\">\u2139\uFE0F</span></label>\n <input pInputText id=\"authorId\" type=\"text\" formControlName=\"authorId\" />\n </div>\n\n <div class=\"form-field\">\n <label for=\"authorEmail\">Author Email \u2139\uFE0F</label>\n <input pInputText id=\"authorEmail\" type=\"email\" formControlName=\"authorEmail\" />\n @if (form.get('metaApp.authorEmail')?.errors?.['email'] && form.get('metaApp.authorEmail')?.touched) {\n <div class=\"error\"> Please enter a valid email address </div>\n }\n </div>\n\n <div class=\"form-field\">\n <label for=\"takenCount\"\n >Taken Count <span pTooltip=\"Es el contador de cuantas veces se ha tomado esta conversaci\u00F3n, no sirve por ahora\"> \u2139\uFE0F</span></label\n >\n <input pInputText id=\"takenCount\" type=\"number\" formControlName=\"takenCount\" />\n </div>\n\n <div class=\"form-field checkbox\">\n <label>\n <p-checkbox [binary]=\"true\" formControlName=\"isPublic\" />\n Public\n </label>\n </div>\n\n <div class=\"form-field checkbox\">\n <label>\n <p-checkbox [binary]=\"true\" formControlName=\"isPublished\" />\n Published\n </label>\n </div>\n </div>\n </details>\n\n <details>\n <summary>Gestion de cuentas</summary>\n <div class=\"group\">\n <h4>Gestion de cuentas</h4>\n @if(form.controls.accounts){\n <account-platform-form [formArray]=\"form.controls.accounts\"></account-platform-form>\n }\n </div>\n </details>\n\n @if(form.controls.conversationFlow){\n <div class=\"group\">\n <dc-conversation-flow-form [formGroup]=\"form.controls.conversationFlow\"></dc-conversation-flow-form>\n </div>\n }\n </div>\n\n <div class=\"right-column\">\n <div style=\"position: relative; min-height: 60px\">\n <img [src]=\"conversation?.assets?.bannerImg?.url || 'assets/images/default_banner.webp'\" class=\"main-banner-image-card\" />\n @if(!conversation?.assets?.bannerImg?.url && agentCardId) {\n\n <dc-cropper-modal\n style=\"position: absolute; bottom: 10px; right: 10px\"\n #cropperBanner\n id=\"cropperBanner\"\n [buttonLabel]=\"conversation?.assets?.bannerImg?.url ? 'Cambiar el banner' : 'Cargar un banner'\"\n [imgStorageSettings]=\"bannerImgSettings()\"\n [currentStorage]=\"conversation?.assets?.bannerImg\"\n (onFileSelected)=\"onImageSelected($event)\"\n (imageUploaded)=\"onImageUploaded($event, 'bannerImg')\"></dc-cropper-modal>\n }\n </div>\n <div style=\"position: relative\">\n <img [src]=\"conversation?.assets?.image?.url || 'assets/images/default_2_3.webp'\" class=\"main-image-card\" />\n @if (!agentCardId) {\n <button pButton (click)=\"saveConversation()\"> Guarda el scenario para subir la imagen</button>\n } @else {\n\n <p-button\n (click)=\"generateMainImage()\"\n class=\"image-gen-btn\"\n pTooltip=\"Generar/Re generar la imagen\"\n icon=\"pi pi-sparkles\"\n [rounded]=\"true\"\n severity=\"info\" />\n\n <dc-cropper-modal\n style=\"position: absolute; bottom: 10px; left: 50%\"\n id=\"cropperCardImage\"\n #cropperCardImage\n [buttonLabel]=\"conversation?.assets?.image?.url ? 'Cambiar imagen' : 'Cargar una imagen'\"\n [imgStorageSettings]=\"imageStorageSettings()\"\n (onFileSelected)=\"onImageSelected($event)\"\n (imageUploaded)=\"onImageUploaded($event, 'image')\"></dc-cropper-modal>\n }\n </div>\n\n <div>\n <h4>Agregar stickers</h4>\n\n <dc-cropper-modal\n id=\"cropperCardImage\"\n #cropperStickers\n [buttonLabel]=\"'agregar sticker'\"\n [imgStorageSettings]=\"stickerStorageSettings\"\n (onFileSelected)=\"onImageSelected($event)\"\n (imageUploaded)=\"onImageUploaded($event, 'sticker')\"></dc-cropper-modal>\n </div>\n\n <div style=\"display: flex; flex-wrap: wrap; gap: 10px\">\n @for (sticker of conversation?.assets?.stickers; track sticker.url) {\n <div style=\"position: relative\">\n <img width=\"100\" [src]=\"sticker.url\" alt=\"\" />\n <p-button (click)=\"removeSticker(sticker)\" class=\"remove-sticker\" icon=\"pi pi-times\" [rounded]=\"true\" [text]=\"true\" severity=\"danger\" />\n </div>\n }\n </div>\n\n <!-- <input pInputText type=\"file\" accept=\"image/*\" (change)=\"onImageSelected($event)\" /> -->\n\n @if(form.controls.characterCard){\n <dc-character-card-form [characterCardForm]=\"form.controls.characterCard\" (generateMissingDataRequest)=\"generateMissingData()\">\n </dc-character-card-form>\n }\n </div>\n </div>\n </form>\n\n <p-popover #textEngineDialog header=\"Text Engine Information\">\n <div class=\"p-4\">\n <h3>Text Engine Types</h3>\n <ul>\n <li> <strong>Texto Simple</strong> La conversaci\u00F3n es como chatgpt, preguntas y responde, es la m\u00E1s b\u00E1sica</li>\n\n <li\n ><strong>Multi Mensajes</strong> Utiliza markdown (recomendable entenderlo), sirve para darle formato al texto y sea m\u00E1s agradable de leer, el sistema\n puede partir dialogos que tienen distinto formato, como normal, cursiva y negritas, asi puede generar distintas voces y estilo para el narrador y\n personaje principal</li\n >\n <li\n ><strong>MD SSML :</strong> Markdown con Lenguaje de marcaci\u00F3n de s\u00EDntesis de voz (SSML), es tambien markdown pero a diferencia de multimessage, solo\n se presenta un mensaje. y la voz se genera para toda la linea,normalmente lo uso para conversaciones bilingues.</li\n >\n </ul>\n </div>\n </p-popover>\n\n <div class=\"float-button\">\n <p-button icon=\"pi pi-save\" (click)=\"saveConversation()\" severity=\"primary\" [rounded]=\"true\" [raised]=\"true\" pTooltip=\"Guardar (Ctrl + S)\"> </p-button>\n </div>\n</p-card>\n", styles: [".textmin{min-width:36vw}.image-gen-btn{position:absolute;bottom:15px;left:35%}.main-image-card{max-width:280px;display:block;margin:0 auto;border-radius:8px}.main-banner-image-card{border-radius:8px}.remove-sticker{position:absolute;top:5px;right:5px}.conversation-form{max-width:100%;padding:20px;background-color:#fff;border-radius:8px;box-shadow:0 2px 4px #0000001a}.conversation-form .card-group{background-color:#f8f9fa;padding:20px;border-radius:6px;margin-bottom:24px}.conversation-form .card-group h3{margin:0 0 20px;color:#2c3e50;font-size:1.25rem}.conversation-form .form-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:2rem;width:100%;max-width:100%}@media (max-width: 768px){.conversation-form .form-grid{grid-template-columns:1fr}}.conversation-form .form-field{margin-bottom:1.5rem;display:flex;flex-direction:column;gap:.5rem}.conversation-form .form-field label{font-weight:500}.conversation-form .form-field textarea{resize:vertical}.conversation-form .form-field.checkbox{flex-direction:row;align-items:center;gap:.5rem}.conversation-form .form-field.checkbox input[type=checkbox]{width:auto}.conversation-form .form-field .error{color:#dc3545;font-size:.875rem;margin-top:.25rem}.conversation-form .form-field .remove-button{position:absolute;border:none;border-radius:50%;width:20px;height:20px;display:flex;align-items:center;justify-content:center;cursor:pointer;top:-10px;right:-10px}.conversation-form .left-column,.conversation-form .right-column{display:flex;flex-direction:column;gap:1rem}.conversation-form .array-field{display:flex;flex-direction:column;gap:.5rem}.conversation-form .array-field .array-item{display:flex;gap:.5rem}.conversation-form .array-field .array-item input,.conversation-form .array-field .array-item textarea{flex:1}.conversation-form .array-field .array-item button{padding:.5rem}.conversation-form .array-field button[type=button]{background-color:#28a745;color:#fff;border:none;padding:8px 12px;border-radius:4px;cursor:pointer;transition:background-color .2s}.conversation-form .array-field button[type=button]:hover{background-color:#218838}.conversation-form .group,.conversation-form .meta-group,.conversation-form .card-group{background-color:#f8f9fa;padding:1rem;border-radius:4px;margin-bottom:1.5rem}.conversation-form .group h3,.conversation-form .meta-group h3,.conversation-form .card-group h3{margin-top:0;margin-bottom:1rem}.top-buttons{display:flex;justify-content:space-between;margin-bottom:2rem;gap:1rem}.top-buttons button{flex:1}::ng-deep em{font-weight:900;color:#014a93}.float-button{position:fixed;bottom:4rem;right:2rem;z-index:1000;display:flex;gap:1px}.float-button :host ::ng-deep .p-button{width:4rem;height:4rem;border-radius:50%}\n"], dependencies: [{ kind: "ngmodule", type: ReactiveFormsModule }, { kind: "directive", type: i1.ɵNgNoValidate, selector: "form:not([ngNoForm]):not([ngNativeValidate])" }, { kind: "directive", type: i1.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.NumberValueAccessor, selector: "input[type=number][formControlName],input[type=number][formControl],input[type=number][ngModel]" }, { kind: "directive", type: i1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i1.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "directive", type: i1.FormControlName, selector: "[formControlName]", inputs: ["formControlName", "disabled", "ngModel"], outputs: ["ngModelChange"] }, { kind: "directive", type: i1.FormGroupName, selector: "[formGroupName]", inputs: ["formGroupName"] }, { kind: "component", type: CropperComponentModal, selector: "dc-cropper-modal", inputs: ["imgStorageSettings", "buttonLabel", "currentStorage"], outputs: ["imageUploaded", "onImageCropped", "onFileSelected"] }, { kind: "ngmodule", type: OverlayModule }, { kind: "ngmodule", type: PortalModule }, { kind: "ngmodule", type: ButtonModule }, { kind: "directive", type: i2$1.ButtonDirective, selector: "[pButton]", inputs: ["iconPos", "loadingIcon", "loading", "severity", "raised", "rounded", "text", "outlined", "size", "plain", "fluid", "label", "icon", "buttonProps"] }, { kind: "component", type: i2$1.Button, selector: "p-button", inputs: ["type", "iconPos", "icon", "badge", "label", "disabled", "loading", "loadingIcon", "raised", "rounded", "text", "plain", "severity", "outlined", "link", "tabindex", "size", "variant", "style", "styleClass", "badgeClass", "badgeSeverity", "ariaLabel", "autofocus", "fluid", "buttonProps"], outputs: ["onClick", "onFocus", "onBlur"] }, { kind: "ngmodule", type: TextareaModule }, { kind: "ngmodule", type: InputTextModule }, { kind: "directive", type: i3$2.InputText, selector: "[pInputText]", inputs: ["variant", "fluid", "pSize"] }, { kind: "ngmodule", type: CheckboxModule }, { kind: "component", type: i2$3.Checkbox, selector: "p-checkbox, p-checkBox, p-check-box", inputs: ["value", "name", "disabled", "binary", "ariaLabelledBy", "ariaLabel", "tabindex", "inputId", "style", "inputStyle", "styleClass", "inputClass", "indeterminate", "size", "formControl", "checkboxIcon", "readonly", "required", "autofocus", "trueValue", "falseValue", "variant"], outputs: ["onChange", "onFocus", "onBlur"] }, { kind: "ngmodule", type: ToggleButtonModule }, { kind: "ngmodule", type: FormsModule }, { kind: "ngmodule", type: TooltipModule }, { kind: "directive", type: i5$1.Tooltip, selector: "[pTooltip]", inputs: ["tooltipPosition", "tooltipEvent", "appendTo", "positionStyle", "tooltipStyleClass", "tooltipZIndex", "escape", "showDelay", "hideDelay", "life", "positionTop", "positionLeft", "autoHide", "fitContent", "hideOnEscape", "pTooltip", "tooltipDisabled", "tooltipOptions"] }, { kind: "ngmodule", type: ToggleSwitchModule }, { kind: "component", type: i6$1.ToggleSwitch, selector: "p-toggleswitch, p-toggleSwitch, p-toggle-switch", inputs: ["style", "styleClass", "tabindex", "inputId", "name", "disabled", "readonly", "trueValue", "falseValue", "ariaLabel", "ariaLabelledBy", "autofocus"], outputs: ["onChange"] }, { kind: "ngmodule", type: SelectModule }, { kind: "component", type: i5.Select, selector: "p-select", inputs: ["id", "scrollHeight", "filter", "name", "style", "panelStyle", "styleClass", "panelStyleClass", "readonly", "required", "editable", "appendTo", "tabindex", "placeholder", "loadingIcon", "filterPlaceholder", "filterLocale", "variant", "inputId", "dataKey", "filterBy", "filterFields", "autofocus", "resetFilterOnHide", "checkmark", "dropdownIcon", "loading", "optionLabel", "optionValue", "optionDisabled", "optionGroupLabel", "optionGroupChildren", "autoDisplayFirst", "group", "showClear", "emptyFilterMessage", "emptyMessage", "lazy", "virtualScroll", "virtualScrollItemSize", "virtualScrollOptions", "size", "overlayOptions", "ariaFilterLabel", "ariaLabel", "ariaLabelledBy", "filterMatchMode", "maxlength", "tooltip", "tooltipPosition", "tooltipPositionStyle", "tooltipStyleClass", "focusOnHover", "selectOnFocus", "autoOptionFocus", "autofocusFilter", "fluid", "disabled", "itemSize", "autoZIndex", "baseZIndex", "showTransitionOptions", "hideTransitionOptions", "filterValue", "options"], outputs: ["onChange", "onFilter", "onFocus", "onBlur", "onClick", "onShow", "onHide", "onClear", "onLazyLoad"] }, { kind: "ngmodule", type: DialogModule }, { kind: "ngmodule", type: DynamicDialogModule }, { kind: "ngmodule", type: PopoverModule }, { kind: "component", type: i8.Popover, selector: "p-popover", inputs: ["ariaLabel", "ariaLabelledBy", "dismissable", "style", "styleClass", "appendTo", "autoZIndex", "ariaCloseLabel", "baseZIndex", "focusOnShow", "showTransitionOptions", "hideTransitionOptions"], outputs: ["onShow", "onHide"] }, { kind: "component", type: ModelSelectorComponent, selector: "dc-model-selector", inputs: ["modelForm", "shortForm"] }, { kind: "component", type: AccountPlatformForm, selector: "account-platform-form", inputs: ["formArray"] }, { kind: "ngmodule", type: InputGroupAddonModule }, { kind: "component", type: i9.InputGroupAddon, selector: "p-inputgroup-addon, p-inputGroupAddon", inputs: ["style", "styleClass"] }, { kind: "ngmodule", type: InputGroupModule }, { kind: "component", type: i10.InputGroup, selector: "p-inputgroup, p-inputGroup, p-input-group", inputs: ["style", "styleClass"] }, { kind: "ngmodule", type: CardModule }, { kind: "component", type: i2$4.Card, selector: "p-card", inputs: ["header", "subheader", "style", "styleClass"] }, { kind: "component", type: DCConversationFlowFormComponent, selector: "dc-conversation-flow-form", inputs: ["formGroup"] }, { kind: "component", type: DcCharacterCardFormComponent, selector: "dc-character-card-form", inputs: ["characterCardForm"], outputs: ["generateMissingDataRequest"] }] }); }
|
|
4592
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.4", type: DCAgentCardFormComponent, isStandalone: true, selector: "dc-agent-form", inputs: { storageSettings: { classPropertyName: "storageSettings", publicName: "storageSettings", isSignal: true, isRequired: false, transformFunction: null }, bannerImgSettings: { classPropertyName: "bannerImgSettings", publicName: "bannerImgSettings", isSignal: true, isRequired: false, transformFunction: null }, imageStorageSettings: { classPropertyName: "imageStorageSettings", publicName: "imageStorageSettings", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { onImageLoaded: "onImageLoaded", onSave: "onSave", onGoDetails: "onGoDetails", onTranslate: "onTranslate" }, providers: [DialogService], ngImport: i0, template: "<p-card>\n <div class=\"top-buttons\">\n <button pButton severity=\"info\" (click)=\"checkPrompt()\" label=\"\uD83D\uDC41\uFE0F Ver instrucciones finales \uD83D\uDCD3\"></button>\n\n <button pButton severity=\"info\" (click)=\"goToDetails()\" label=\"\uD83D\uDCAC Conversar\"></button>\n <button pButton severity=\"primary\" (click)=\"saveConversation()\" label=\"\uD83D\uDCBE Guardar cambios\"></button>\n </div>\n\n <div class=\"top-buttons\">\n <p-button severity=\"help\" (click)=\"translate()\" label=\"\uD83D\uDD04 Traducir\"></p-button>\n <p-button [loading]=\"isGenerating\" severity=\"help\" (click)=\"generateCharacter()\" label=\"Generar \uD83E\uDDBE\"></p-button>\n\n <p-button severity=\"info\" (click)=\"downloadConversation()\" label=\"\uD83D\uDCC1 Exportar \u2B07\uFE0F\"></p-button>\n <p-button severity=\"info\" (click)=\"importConversation()\" label=\"\uD83C\uDCCF Importar \u2B06\uFE0F\"></p-button>\n </div>\n\n <br />\n <br />\n <form [formGroup]=\"form\" class=\"conversation-form\">\n <div class=\"form-grid\">\n <div class=\"left-column\">\n <div title=\"Main data\" style=\"border: 1px dashed #0c138e1f; padding: 4px; border-radius: 15px\">\n <div style=\"display: flex; gap: 15px\">\n <div class=\"form-field\">\n <label for=\"version\">Version: {{ form.controls.version.value }} <span pTooltip=\"Version number of the conversation\">\u2139\uFE0F</span></label>\n </div>\n\n <div class=\"form-field\">\n <label for=\"id\"\n >ID: <span pTooltip=\"Unique identifier for this conversation\"> {{ form.controls.id.value }} \u2139\uFE0F</span></label\n >\n </div>\n </div>\n\n <div class=\"form-field\">\n <label for=\"title\">Title <span pTooltip=\"T\u00EDtulo de la conversaci\u00F3n\">\u2139\uFE0F</span></label>\n <input pInputText id=\"title\" type=\"text\" formControlName=\"title\" />\n @if(form.controls.title.errors?.['required'] && form.controls.title.touched){\n <div class=\"error\"> Title is required </div>\n }\n </div>\n\n <div class=\"form-field\">\n <label for=\"description\">Description <span pTooltip=\"Description of the conversation\">\u2139\uFE0F</span></label>\n <input pInputText id=\"description\" type=\"text\" formControlName=\"description\" />\n @if(form.controls.description.errors?.['required'] && form.controls.description.touched){\n <div class=\"error\"> Description is required </div>\n }\n </div>\n\n <div class=\"form-field\">\n <label for=\"lang\">Language <span pTooltip=\"Select the primary language for the conversation\">\u2139\uFE0F</span></label>\n <p-select\n id=\"lang\"\n [options]=\"languageOptions\"\n formControlName=\"lang\"\n optionLabel=\"label\"\n optionValue=\"value\"\n [placeholder]=\"'Select Language'\"></p-select>\n </div>\n </div>\n\n <div formGroupName=\"conversationSettings\" class=\"group bg-sky-50\">\n <h3>Conversation Settings <span pTooltip=\"Additional information about the conversation\">\u2139\uFE0F</span></h3>\n\n <div class=\"form-field\">\n <label for=\"textEngine\">\n Text Engine\n <span\n class=\"cursor-pointer\"\n (click)=\"textEngineDialog.toggle($event)\"\n pTooltip=\"Sistema de generaci\u00F3n de texto y audios. Client: el cliente llama al servidor en cada dialogo de voz/personaje, es optimo para historias, Server SSML: se sintetiza todo el audio en uno solo con los distintos cambios de voz/personaje, util para la reflexi\u00F3n porque es bilingue, utiliza dialogos en ingles y espa\u00F1ol en el mismo dialogo/audio\"\n >\u2139\uFE0F</span\n >\n </label>\n\n <p-select\n id=\"textEngine\"\n [options]=\"textEngineOptions\"\n formControlName=\"textEngine\"\n optionLabel=\"label\"\n optionValue=\"value\"\n [placeholder]=\"'Select Text Engine'\"></p-select>\n </div>\n\n <div class=\"form-field\">\n <label class=\"cursor-pointer\" for=\"conversationType\" (click)=\"openConversationTypeDialog()\"\n >Conversation Type <span pTooltip=\"Choose the type of conversation interaction\">\u2139\uFE0F</span></label\n >\n <p-select\n id=\"conversationType\"\n [options]=\"conversationOptions\"\n formControlName=\"conversationType\"\n optionLabel=\"label\"\n optionValue=\"value\"\n [placeholder]=\"'Select Conversation Type'\"></p-select>\n </div>\n\n <div class=\"form-field\">\n <label> Auto Start <span pTooltip=\"Start conversation automatically\">\u2139\uFE0F</span> </label>\n <p-toggleSwitch formControlName=\"autoStart\"> </p-toggleSwitch>\n </div>\n\n <div formGroupName=\"tts\" class=\"group\">\n <h3>TTS Settings <span pTooltip=\"Text-to-Speech configuration options\">\u2139\uFE0F</span></h3>\n\n <div class=\"form-field\">\n <label for=\"voice\">Voice <span pTooltip=\"Select the primary voice for text-to-speech\">\u2139\uFE0F</span></label>\n\n <p-inputgroup>\n <p-inputgroup-addon>\n <p-button [rounded]=\"true\" [text]=\"true\" icon=\"pi pi-exclamation-circle\" (click)=\"openVoiceSelector(true)\" />\n </p-inputgroup-addon>\n\n <p-select\n id=\"voice\"\n [editable]=\"true\"\n [options]=\"voiceTTSOptions\"\n formControlName=\"voice\"\n optionLabel=\"name\"\n optionValue=\"id\"\n [placeholder]=\"'Select Voice'\"></p-select>\n </p-inputgroup>\n </div>\n\n <div class=\"form-field\">\n <label for=\"secondaryVoice\">Secondary Voice <span pTooltip=\"Select an alternative voice for text-to-speech\">\u2139\uFE0F</span></label>\n\n <p-inputgroup>\n <p-inputgroup-addon>\n <p-button [rounded]=\"true\" [text]=\"true\" icon=\"pi pi-info-circle\" (click)=\"openVoiceSelector(false)\" />\n </p-inputgroup-addon>\n\n <p-select\n id=\"secondaryVoice\"\n [editable]=\"true\"\n [options]=\"voiceTTSOptions\"\n formControlName=\"secondaryVoice\"\n optionLabel=\"name\"\n optionValue=\"id\"\n [placeholder]=\"'Select Secondary Voice'\"></p-select>\n </p-inputgroup>\n </div>\n\n <div class=\"form-field\">\n <label for=\"speed\">Speed <span pTooltip=\"Set the speech rate for text-to-speech conversion\">\u2139\uFE0F</span></label>\n <p-select\n id=\"speed\"\n [options]=\"audioSpeedOptions\"\n formControlName=\"speed\"\n optionLabel=\"label\"\n optionValue=\"value\"\n [placeholder]=\"'Select Speed'\"></p-select>\n </div>\n\n <div class=\"form-field\">\n <label for=\"speedRate\">Speed Rate <span pTooltip=\"Adjust the rate of speech delivery\">\u2139\uFE0F</span></label>\n <input pInputText id=\"speedRate\" type=\"number\" formControlName=\"speedRate\" step=\"0.1\" />\n </div>\n </div>\n\n <dc-model-selector [modelForm]=\"form.controls.conversationSettings.controls.model\" [shortForm]=\"true\"></dc-model-selector>\n </div>\n\n <details>\n <summary>Meta Information</summary>\n <div formGroupName=\"metaApp\" class=\"group\">\n <h3>Meta Information <span pTooltip=\"Additional information about the conversation\">\u2139\uFE0F</span></h3>\n <div class=\"form-field\">\n <label for=\"authorId\">Author ID <span pTooltip=\"Unique identifier for the conversation author\">\u2139\uFE0F</span></label>\n <input pInputText id=\"authorId\" type=\"text\" formControlName=\"authorId\" />\n </div>\n\n <div class=\"form-field\">\n <label for=\"authorEmail\">Author Email \u2139\uFE0F</label>\n <input pInputText id=\"authorEmail\" type=\"email\" formControlName=\"authorEmail\" />\n @if (form.get('metaApp.authorEmail')?.errors?.['email'] && form.get('metaApp.authorEmail')?.touched) {\n <div class=\"error\"> Please enter a valid email address </div>\n }\n </div>\n\n <div class=\"form-field\">\n <label for=\"takenCount\"\n >Taken Count <span pTooltip=\"Es el contador de cuantas veces se ha tomado esta conversaci\u00F3n, no sirve por ahora\"> \u2139\uFE0F</span></label\n >\n <input pInputText id=\"takenCount\" type=\"number\" formControlName=\"takenCount\" />\n </div>\n\n <div class=\"form-field checkbox\">\n <label>\n <p-checkbox [binary]=\"true\" formControlName=\"isPublic\" />\n Public\n </label>\n </div>\n\n <div class=\"form-field checkbox\">\n <label>\n <p-inputnumber formControlName=\"level\" [showButtons]=\"true\" [min]=\"0\" [max]=\"5\" />\n Nivel Recomendado\n </label>\n </div>\n\n <div class=\"form-field checkbox\">\n <label>\n <p-checkbox [binary]=\"true\" formControlName=\"isPublished\" />\n Published\n </label>\n </div>\n </div>\n </details>\n\n <details>\n <summary>Gestion de cuentas</summary>\n <div class=\"group\">\n <h4>Gestion de cuentas</h4>\n @if(form.controls.accounts){\n <account-platform-form [formArray]=\"form.controls.accounts\"></account-platform-form>\n }\n </div>\n </details>\n\n @if(form.controls.conversationFlow){\n <div class=\"group\">\n <dc-conversation-flow-form [formGroup]=\"form.controls.conversationFlow\"></dc-conversation-flow-form>\n </div>\n }\n </div>\n\n <div class=\"right-column\">\n <div style=\"position: relative; min-height: 60px\">\n <div style=\"border: 1px dashed #0c138e1f; padding: 4px; border-radius: 15px\">\n <img [src]=\"conversation?.assets?.bannerImg?.url || 'assets/images/default_banner.webp'\" class=\"main-banner-image-card\" />\n @if(!conversation?.assets?.bannerImg?.url && agentCardId) {\n\n <dc-cropper-modal\n style=\"position: absolute; bottom: 10px; right: 10px\"\n #cropperBanner\n id=\"cropperBanner\"\n [buttonLabel]=\"conversation?.assets?.bannerImg?.url ? 'Cambiar el banner' : 'Cargar un banner'\"\n [imgStorageSettings]=\"bannerImgSettings()\"\n [currentStorage]=\"conversation?.assets?.bannerImg\"\n (onFileSelected)=\"onImageSelected($event)\"\n (imageUploaded)=\"onImageUploaded($event, 'bannerImg')\"></dc-cropper-modal>\n }\n <div style=\"position: relative\">\n <img [src]=\"conversation?.assets?.image?.url || 'assets/images/default_2_3.webp'\" class=\"main-image-card\" />\n @if (!agentCardId) {\n <button pButton (click)=\"saveConversation()\"> Guarda el scenario para subir la imagen</button>\n } @else {\n\n <p-button\n (click)=\"generateMainImage()\"\n class=\"image-gen-btn\"\n pTooltip=\"Generar/Re generar la imagen\"\n icon=\"pi pi-sparkles\"\n [rounded]=\"true\"\n severity=\"info\" />\n\n <dc-cropper-modal\n style=\"position: absolute; bottom: 10px; left: 50%\"\n id=\"cropperCardImage\"\n #cropperCardImage\n [buttonLabel]=\"conversation?.assets?.image?.url ? 'Cambiar imagen' : 'Cargar una imagen'\"\n [imgStorageSettings]=\"imageStorageSettings()\"\n (onFileSelected)=\"onImageSelected($event)\"\n (imageUploaded)=\"onImageUploaded($event, 'image')\"></dc-cropper-modal>\n }\n </div>\n\n <h4>Agregar stickers</h4>\n\n <dc-cropper-modal\n id=\"cropperCardImage\"\n #cropperStickers\n [buttonLabel]=\"'agregar sticker'\"\n [imgStorageSettings]=\"stickerStorageSettings\"\n (onFileSelected)=\"onImageSelected($event)\"\n (imageUploaded)=\"onImageUploaded($event, 'sticker')\"></dc-cropper-modal>\n\n <div style=\"display: flex; flex-wrap: wrap; gap: 10px\">\n @for (sticker of conversation?.assets?.stickers; track sticker.url) {\n <div style=\"position: relative\">\n <img width=\"100\" [src]=\"sticker.url\" alt=\"\" />\n <p-button (click)=\"removeSticker(sticker)\" class=\"remove-sticker\" icon=\"pi pi-times\" [rounded]=\"true\" [text]=\"true\" severity=\"danger\" />\n </div>\n }\n </div>\n </div>\n </div>\n\n @if(form.controls.characterCard){\n <dc-character-card-form [characterCardForm]=\"form.controls.characterCard\" (generateMissingDataRequest)=\"generateMissingData()\">\n </dc-character-card-form>\n }\n </div>\n </div>\n </form>\n\n <p-popover #textEngineDialog header=\"Text Engine Information\">\n <div class=\"p-4\">\n <h3>Text Engine Types</h3>\n <ul>\n <li> <strong>Texto Simple</strong> La conversaci\u00F3n es como chatgpt, preguntas y responde, es la m\u00E1s b\u00E1sica</li>\n\n <li\n ><strong>Multi Mensajes</strong> Utiliza markdown (recomendable entenderlo), sirve para darle formato al texto y sea m\u00E1s agradable de leer, el sistema\n puede partir dialogos que tienen distinto formato, como normal, cursiva y negritas, asi puede generar distintas voces y estilo para el narrador y\n personaje principal</li\n >\n <li\n ><strong>MD SSML :</strong> Markdown con Lenguaje de marcaci\u00F3n de s\u00EDntesis de voz (SSML), es tambien markdown pero a diferencia de multimessage, solo\n se presenta un mensaje. y la voz se genera para toda la linea,normalmente lo uso para conversaciones bilingues.</li\n >\n </ul>\n </div>\n </p-popover>\n\n <div class=\"float-button\">\n <p-button icon=\"pi pi-save\" (click)=\"saveConversation()\" severity=\"primary\" [rounded]=\"true\" [raised]=\"true\" pTooltip=\"Guardar (Ctrl + S)\"> </p-button>\n </div>\n</p-card>\n", styles: [".textmin{min-width:36vw}.image-gen-btn{position:absolute;bottom:15px;left:35%}.main-image-card{max-width:280px;display:block;margin:0 auto;border-radius:8px}.main-banner-image-card{border-radius:8px}.remove-sticker{position:absolute;top:5px;right:5px}.conversation-form{max-width:100%;padding:20px;background-color:#fff;border-radius:8px;box-shadow:0 2px 4px #0000001a}.conversation-form .card-group{padding:20px;border-radius:6px;margin-bottom:24px}.conversation-form .card-group h3{margin:0 0 20px;color:#2c3e50;font-size:1.25rem}.conversation-form .form-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:2rem;width:100%;max-width:100%}@media (max-width: 768px){.conversation-form .form-grid{grid-template-columns:1fr}}.conversation-form .form-field{margin-bottom:1.5rem;display:flex;flex-direction:column;gap:.5rem}.conversation-form .form-field label{font-weight:500}.conversation-form .form-field textarea{resize:vertical}.conversation-form .form-field.checkbox{flex-direction:row;align-items:center;gap:.5rem}.conversation-form .form-field.checkbox input[type=checkbox]{width:auto}.conversation-form .form-field .error{color:#dc3545;font-size:.875rem;margin-top:.25rem}.conversation-form .form-field .remove-button{position:absolute;border:none;border-radius:50%;width:20px;height:20px;display:flex;align-items:center;justify-content:center;cursor:pointer;top:-10px;right:-10px}.conversation-form .left-column,.conversation-form .right-column{display:flex;flex-direction:column;gap:1rem}.conversation-form .array-field{display:flex;flex-direction:column;gap:.5rem}.conversation-form .array-field .array-item{display:flex;gap:.5rem}.conversation-form .array-field .array-item input,.conversation-form .array-field .array-item textarea{flex:1}.conversation-form .array-field .array-item button{padding:.5rem}.conversation-form .array-field button[type=button]{background-color:#28a745;color:#fff;border:none;padding:8px 12px;border-radius:4px;cursor:pointer;transition:background-color .2s}.conversation-form .array-field button[type=button]:hover{background-color:#218838}.conversation-form .group,.conversation-form .meta-group,.conversation-form .card-group{padding:1rem;border-radius:4px;margin-bottom:1.5rem}.conversation-form .group h3,.conversation-form .meta-group h3,.conversation-form .card-group h3{margin-top:0;margin-bottom:1rem}.top-buttons{display:flex;justify-content:space-between;margin-bottom:2rem;gap:1rem}.top-buttons button{flex:1}::ng-deep em{font-weight:900;color:#014a93}.float-button{position:fixed;bottom:4rem;right:2rem;z-index:1000;display:flex;gap:1px}.float-button :host ::ng-deep .p-button{width:4rem;height:4rem;border-radius:50%}\n"], dependencies: [{ kind: "ngmodule", type: ReactiveFormsModule }, { kind: "directive", type: i1.ɵNgNoValidate, selector: "form:not([ngNoForm]):not([ngNativeValidate])" }, { kind: "directive", type: i1.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.NumberValueAccessor, selector: "input[type=number][formControlName],input[type=number][formControl],input[type=number][ngModel]" }, { kind: "directive", type: i1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i1.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "directive", type: i1.FormControlName, selector: "[formControlName]", inputs: ["formControlName", "disabled", "ngModel"], outputs: ["ngModelChange"] }, { kind: "directive", type: i1.FormGroupName, selector: "[formGroupName]", inputs: ["formGroupName"] }, { kind: "component", type: CropperComponentModal, selector: "dc-cropper-modal", inputs: ["imgStorageSettings", "buttonLabel", "currentStorage"], outputs: ["imageUploaded", "onImageCropped", "onFileSelected"] }, { kind: "ngmodule", type: OverlayModule }, { kind: "ngmodule", type: PortalModule }, { kind: "ngmodule", type: ButtonModule }, { kind: "directive", type: i2.ButtonDirective, selector: "[pButton]", inputs: ["iconPos", "loadingIcon", "loading", "severity", "raised", "rounded", "text", "outlined", "size", "plain", "fluid", "label", "icon", "buttonProps"] }, { kind: "component", type: i2.Button, selector: "p-button", inputs: ["type", "iconPos", "icon", "badge", "label", "disabled", "loading", "loadingIcon", "raised", "rounded", "text", "plain", "severity", "outlined", "link", "tabindex", "size", "variant", "style", "styleClass", "badgeClass", "badgeSeverity", "ariaLabel", "autofocus", "fluid", "buttonProps"], outputs: ["onClick", "onFocus", "onBlur"] }, { kind: "ngmodule", type: TextareaModule }, { kind: "ngmodule", type: InputTextModule }, { kind: "directive", type: i3$1.InputText, selector: "[pInputText]", inputs: ["variant", "fluid", "pSize"] }, { kind: "ngmodule", type: CheckboxModule }, { kind: "component", type: i2$3.Checkbox, selector: "p-checkbox, p-checkBox, p-check-box", inputs: ["value", "name", "disabled", "binary", "ariaLabelledBy", "ariaLabel", "tabindex", "inputId", "style", "inputStyle", "styleClass", "inputClass", "indeterminate", "size", "formControl", "checkboxIcon", "readonly", "required", "autofocus", "trueValue", "falseValue", "variant"], outputs: ["onChange", "onFocus", "onBlur"] }, { kind: "ngmodule", type: ToggleButtonModule }, { kind: "ngmodule", type: FormsModule }, { kind: "ngmodule", type: TooltipModule }, { kind: "directive", type: i5$1.Tooltip, selector: "[pTooltip]", inputs: ["tooltipPosition", "tooltipEvent", "appendTo", "positionStyle", "tooltipStyleClass", "tooltipZIndex", "escape", "showDelay", "hideDelay", "life", "positionTop", "positionLeft", "autoHide", "fitContent", "hideOnEscape", "pTooltip", "tooltipDisabled", "tooltipOptions"] }, { kind: "ngmodule", type: ToggleSwitchModule }, { kind: "component", type: i6$1.ToggleSwitch, selector: "p-toggleswitch, p-toggleSwitch, p-toggle-switch", inputs: ["style", "styleClass", "tabindex", "inputId", "name", "disabled", "readonly", "trueValue", "falseValue", "ariaLabel", "ariaLabelledBy", "autofocus"], outputs: ["onChange"] }, { kind: "ngmodule", type: SelectModule }, { kind: "component", type: i5.Select, selector: "p-select", inputs: ["id", "scrollHeight", "filter", "name", "style", "panelStyle", "styleClass", "panelStyleClass", "readonly", "required", "editable", "appendTo", "tabindex", "placeholder", "loadingIcon", "filterPlaceholder", "filterLocale", "variant", "inputId", "dataKey", "filterBy", "filterFields", "autofocus", "resetFilterOnHide", "checkmark", "dropdownIcon", "loading", "optionLabel", "optionValue", "optionDisabled", "optionGroupLabel", "optionGroupChildren", "autoDisplayFirst", "group", "showClear", "emptyFilterMessage", "emptyMessage", "lazy", "virtualScroll", "virtualScrollItemSize", "virtualScrollOptions", "size", "overlayOptions", "ariaFilterLabel", "ariaLabel", "ariaLabelledBy", "filterMatchMode", "maxlength", "tooltip", "tooltipPosition", "tooltipPositionStyle", "tooltipStyleClass", "focusOnHover", "selectOnFocus", "autoOptionFocus", "autofocusFilter", "fluid", "disabled", "itemSize", "autoZIndex", "baseZIndex", "showTransitionOptions", "hideTransitionOptions", "filterValue", "options"], outputs: ["onChange", "onFilter", "onFocus", "onBlur", "onClick", "onShow", "onHide", "onClear", "onLazyLoad"] }, { kind: "ngmodule", type: DialogModule }, { kind: "ngmodule", type: DynamicDialogModule }, { kind: "ngmodule", type: PopoverModule }, { kind: "component", type: i8.Popover, selector: "p-popover", inputs: ["ariaLabel", "ariaLabelledBy", "dismissable", "style", "styleClass", "appendTo", "autoZIndex", "ariaCloseLabel", "baseZIndex", "focusOnShow", "showTransitionOptions", "hideTransitionOptions"], outputs: ["onShow", "onHide"] }, { kind: "component", type: ModelSelectorComponent, selector: "dc-model-selector", inputs: ["modelForm", "shortForm"] }, { kind: "component", type: AccountPlatformForm, selector: "account-platform-form", inputs: ["formArray"] }, { kind: "ngmodule", type: InputGroupAddonModule }, { kind: "component", type: i9.InputGroupAddon, selector: "p-inputgroup-addon, p-inputGroupAddon", inputs: ["style", "styleClass"] }, { kind: "ngmodule", type: InputGroupModule }, { kind: "component", type: i10.InputGroup, selector: "p-inputgroup, p-inputGroup, p-input-group", inputs: ["style", "styleClass"] }, { kind: "ngmodule", type: CardModule }, { kind: "component", type: i2$4.Card, selector: "p-card", inputs: ["header", "subheader", "style", "styleClass"] }, { kind: "component", type: DCConversationFlowFormComponent, selector: "dc-conversation-flow-form", inputs: ["formGroup"] }, { kind: "component", type: DcCharacterCardFormComponent, selector: "dc-character-card-form", inputs: ["characterCardForm"], outputs: ["generateMissingDataRequest"] }, { kind: "ngmodule", type: InputNumberModule }, { kind: "component", type: i12.InputNumber, selector: "p-inputNumber, p-inputnumber, p-input-number", inputs: ["showButtons", "format", "buttonLayout", "inputId", "styleClass", "style", "placeholder", "size", "maxlength", "tabindex", "title", "ariaLabelledBy", "ariaLabel", "ariaRequired", "name", "required", "autocomplete", "min", "max", "incrementButtonClass", "decrementButtonClass", "incrementButtonIcon", "decrementButtonIcon", "readonly", "step", "allowEmpty", "locale", "localeMatcher", "mode", "currency", "currencyDisplay", "useGrouping", "variant", "minFractionDigits", "maxFractionDigits", "prefix", "suffix", "inputStyle", "inputStyleClass", "showClear", "autofocus", "disabled", "fluid"], outputs: ["onInput", "onFocus", "onBlur", "onKeyDown", "onClear"] }] }); }
|
|
4243
4593
|
}
|
|
4244
4594
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.4", ngImport: i0, type: DCAgentCardFormComponent, decorators: [{
|
|
4245
4595
|
type: Component,
|
|
@@ -4256,7 +4606,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.4", ngImpor
|
|
|
4256
4606
|
FormsModule,
|
|
4257
4607
|
TooltipModule,
|
|
4258
4608
|
ToggleSwitchModule,
|
|
4259
|
-
MdToHtmlArrayPipe,
|
|
4260
4609
|
SelectModule,
|
|
4261
4610
|
DialogModule,
|
|
4262
4611
|
DynamicDialogModule,
|
|
@@ -4269,7 +4618,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.4", ngImpor
|
|
|
4269
4618
|
CardModule,
|
|
4270
4619
|
DCConversationFlowFormComponent,
|
|
4271
4620
|
DcCharacterCardFormComponent,
|
|
4272
|
-
], template: "<p-card>\n <div class=\"top-buttons\">\n <button pButton severity=\"info\" (click)=\"checkPrompt()\" label=\"\uD83D\uDC41\uFE0F Ver instrucciones finales \uD83D\uDCD3\"></button>\n\n <button pButton severity=\"info\" (click)=\"goToDetails()\" label=\"\uD83D\uDCAC Conversar\"></button>\n <button pButton severity=\"primary\" (click)=\"saveConversation()\" label=\"\uD83D\uDCBE Guardar cambios\"></button>\n </div>\n\n <div class=\"top-buttons\">\n <p-button severity=\"help\" (click)=\"translate()\" label=\"\uD83D\uDD04 Traducir\"></p-button>\n <p-button [loading]=\"isGenerating\" severity=\"help\" (click)=\"generateCharacter()\" label=\"Generar \uD83E\uDDBE\"></p-button>\n\n <p-button severity=\"info\" (click)=\"downloadConversation()\" label=\"\uD83D\uDCC1 Exportar \u2B07\uFE0F\"></p-button>\n <p-button severity=\"info\" (click)=\"importConversation()\" label=\"\uD83C\uDCCF Importar \u2B06\uFE0F\"></p-button>\n </div>\n\n <br />\n <br />\n <form [formGroup]=\"form\" class=\"conversation-form\">\n <div class=\"form-grid\">\n <div class=\"left-column\">\n <div style=\"display: flex; gap: 15px\">\n <div class=\"form-field\">\n <label for=\"version\">Version: {{ form.controls.version.value }} <span pTooltip=\"Version number of the conversation\">\u2139\uFE0F</span></label>\n </div>\n\n <div class=\"form-field\">\n <label for=\"id\"\n >ID: <span pTooltip=\"Unique identifier for this conversation\"> {{ form.controls.id.value }} \u2139\uFE0F</span></label\n >\n </div>\n </div>\n\n <div class=\"form-field\">\n <label for=\"title\">Title <span pTooltip=\"T\u00EDtulo de la conversaci\u00F3n\">\u2139\uFE0F</span></label>\n <input pInputText id=\"title\" type=\"text\" formControlName=\"title\" />\n @if(form.controls.title.errors?.['required'] && form.controls.title.touched){\n <div class=\"error\"> Title is required </div>\n }\n </div>\n\n <div class=\"form-field\">\n <label for=\"lang\">Language <span pTooltip=\"Select the primary language for the conversation\">\u2139\uFE0F</span></label>\n <p-select\n id=\"lang\"\n [options]=\"languageOptions\"\n formControlName=\"lang\"\n optionLabel=\"label\"\n optionValue=\"value\"\n [placeholder]=\"'Select Language'\"></p-select>\n </div>\n\n <div formGroupName=\"conversationSettings\" class=\"group\">\n <h3>Conversation Settings <span pTooltip=\"Additional information about the conversation\">\u2139\uFE0F</span></h3>\n\n <div class=\"form-field\">\n <label for=\"modelQuality\"\n >Calidad del modelo\n <span\n pTooltip=\"Mientras inteligente, es m\u00E1s lento y costoso $$, considera usar el rapido o balanceado salvo que necesitas una evaluaci\u00F3n muy compleja. \"\n >\u2139\uFE0F</span\n ></label\n >\n <p-select\n id=\"modelQuality\"\n [options]=\"modelQualityOptions\"\n formControlName=\"modelQuality\"\n optionLabel=\"label\"\n optionValue=\"value\"\n [placeholder]=\"'Select Model Quality'\">\n </p-select>\n </div>\n\n <div class=\"form-field\">\n <label for=\"textEngine\">\n Text Engine\n <span\n class=\"cursor-pointer\"\n (click)=\"textEngineDialog.toggle($event)\"\n pTooltip=\"Sistema de generaci\u00F3n de texto y audios. Client: el cliente llama al servidor en cada dialogo de voz/personaje, es optimo para historias, Server SSML: se sintetiza todo el audio en uno solo con los distintos cambios de voz/personaje, util para la reflexi\u00F3n porque es bilingue, utiliza dialogos en ingles y espa\u00F1ol en el mismo dialogo/audio\"\n >\u2139\uFE0F</span\n >\n </label>\n\n <p-select\n id=\"textEngine\"\n [options]=\"textEngineOptions\"\n formControlName=\"textEngine\"\n optionLabel=\"label\"\n optionValue=\"value\"\n [placeholder]=\"'Select Text Engine'\"></p-select>\n </div>\n\n <div class=\"form-field\">\n <label for=\"conversationType\">Conversation Type <span pTooltip=\"Choose the type of conversation interaction\">\u2139\uFE0F</span></label>\n <p-select\n id=\"conversationType\"\n [options]=\"conversationOptions\"\n formControlName=\"conversationType\"\n optionLabel=\"label\"\n optionValue=\"value\"\n [placeholder]=\"'Select Conversation Type'\"></p-select>\n </div>\n\n <div class=\"form-field\">\n <label> Auto Start <span pTooltip=\"Start conversation automatically\">\u2139\uFE0F</span> </label>\n <p-toggleSwitch formControlName=\"autoStart\"> </p-toggleSwitch>\n </div>\n\n <div formGroupName=\"tts\" class=\"group\">\n <h3>TTS Settings <span pTooltip=\"Text-to-Speech configuration options\">\u2139\uFE0F</span></h3>\n\n <div class=\"form-field\">\n <label for=\"voice\">Voice <span pTooltip=\"Select the primary voice for text-to-speech\">\u2139\uFE0F</span></label>\n\n <p-inputgroup>\n <p-inputgroup-addon>\n <p-button [rounded]=\"true\" [text]=\"true\" icon=\"pi pi-exclamation-circle\" (click)=\"openVoiceSelector(true)\" />\n </p-inputgroup-addon>\n\n <p-select\n id=\"voice\"\n [editable]=\"true\"\n [options]=\"voiceTTSOptions\"\n formControlName=\"voice\"\n optionLabel=\"name\"\n optionValue=\"id\"\n [placeholder]=\"'Select Voice'\"></p-select>\n </p-inputgroup>\n </div>\n\n <div class=\"form-field\">\n <label for=\"secondaryVoice\">Secondary Voice <span pTooltip=\"Select an alternative voice for text-to-speech\">\u2139\uFE0F</span></label>\n\n <p-inputgroup>\n <p-inputgroup-addon>\n <p-button [rounded]=\"true\" [text]=\"true\" icon=\"pi pi-info-circle\" (click)=\"openVoiceSelector(false)\" />\n </p-inputgroup-addon>\n\n <p-select\n id=\"secondaryVoice\"\n [editable]=\"true\"\n [options]=\"voiceTTSOptions\"\n formControlName=\"secondaryVoice\"\n optionLabel=\"name\"\n optionValue=\"id\"\n [placeholder]=\"'Select Secondary Voice'\"></p-select>\n </p-inputgroup>\n </div>\n\n <div class=\"form-field\">\n <label for=\"speed\">Speed <span pTooltip=\"Set the speech rate for text-to-speech conversion\">\u2139\uFE0F</span></label>\n <p-select\n id=\"speed\"\n [options]=\"audioSpeedOptions\"\n formControlName=\"speed\"\n optionLabel=\"label\"\n optionValue=\"value\"\n [placeholder]=\"'Select Speed'\"></p-select>\n </div>\n\n <div class=\"form-field\">\n <label for=\"speedRate\">Speed Rate <span pTooltip=\"Adjust the rate of speech delivery\">\u2139\uFE0F</span></label>\n <input pInputText id=\"speedRate\" type=\"number\" formControlName=\"speedRate\" step=\"0.1\" />\n </div>\n </div>\n\n <dc-model-selector [modelForm]=\"form.controls.conversationSettings.controls.model\" [shortForm]=\"true\"></dc-model-selector>\n </div>\n\n <details>\n <summary>Meta Information</summary>\n <div formGroupName=\"metaApp\" class=\"group\">\n <h3>Meta Information <span pTooltip=\"Additional information about the conversation\">\u2139\uFE0F</span></h3>\n <div class=\"form-field\">\n <label for=\"authorId\">Author ID <span pTooltip=\"Unique identifier for the conversation author\">\u2139\uFE0F</span></label>\n <input pInputText id=\"authorId\" type=\"text\" formControlName=\"authorId\" />\n </div>\n\n <div class=\"form-field\">\n <label for=\"authorEmail\">Author Email \u2139\uFE0F</label>\n <input pInputText id=\"authorEmail\" type=\"email\" formControlName=\"authorEmail\" />\n @if (form.get('metaApp.authorEmail')?.errors?.['email'] && form.get('metaApp.authorEmail')?.touched) {\n <div class=\"error\"> Please enter a valid email address </div>\n }\n </div>\n\n <div class=\"form-field\">\n <label for=\"takenCount\"\n >Taken Count <span pTooltip=\"Es el contador de cuantas veces se ha tomado esta conversaci\u00F3n, no sirve por ahora\"> \u2139\uFE0F</span></label\n >\n <input pInputText id=\"takenCount\" type=\"number\" formControlName=\"takenCount\" />\n </div>\n\n <div class=\"form-field checkbox\">\n <label>\n <p-checkbox [binary]=\"true\" formControlName=\"isPublic\" />\n Public\n </label>\n </div>\n\n <div class=\"form-field checkbox\">\n <label>\n <p-checkbox [binary]=\"true\" formControlName=\"isPublished\" />\n Published\n </label>\n </div>\n </div>\n </details>\n\n <details>\n <summary>Gestion de cuentas</summary>\n <div class=\"group\">\n <h4>Gestion de cuentas</h4>\n @if(form.controls.accounts){\n <account-platform-form [formArray]=\"form.controls.accounts\"></account-platform-form>\n }\n </div>\n </details>\n\n @if(form.controls.conversationFlow){\n <div class=\"group\">\n <dc-conversation-flow-form [formGroup]=\"form.controls.conversationFlow\"></dc-conversation-flow-form>\n </div>\n }\n </div>\n\n <div class=\"right-column\">\n <div style=\"position: relative; min-height: 60px\">\n <img [src]=\"conversation?.assets?.bannerImg?.url || 'assets/images/default_banner.webp'\" class=\"main-banner-image-card\" />\n @if(!conversation?.assets?.bannerImg?.url && agentCardId) {\n\n <dc-cropper-modal\n style=\"position: absolute; bottom: 10px; right: 10px\"\n #cropperBanner\n id=\"cropperBanner\"\n [buttonLabel]=\"conversation?.assets?.bannerImg?.url ? 'Cambiar el banner' : 'Cargar un banner'\"\n [imgStorageSettings]=\"bannerImgSettings()\"\n [currentStorage]=\"conversation?.assets?.bannerImg\"\n (onFileSelected)=\"onImageSelected($event)\"\n (imageUploaded)=\"onImageUploaded($event, 'bannerImg')\"></dc-cropper-modal>\n }\n </div>\n <div style=\"position: relative\">\n <img [src]=\"conversation?.assets?.image?.url || 'assets/images/default_2_3.webp'\" class=\"main-image-card\" />\n @if (!agentCardId) {\n <button pButton (click)=\"saveConversation()\"> Guarda el scenario para subir la imagen</button>\n } @else {\n\n <p-button\n (click)=\"generateMainImage()\"\n class=\"image-gen-btn\"\n pTooltip=\"Generar/Re generar la imagen\"\n icon=\"pi pi-sparkles\"\n [rounded]=\"true\"\n severity=\"info\" />\n\n <dc-cropper-modal\n style=\"position: absolute; bottom: 10px; left: 50%\"\n id=\"cropperCardImage\"\n #cropperCardImage\n [buttonLabel]=\"conversation?.assets?.image?.url ? 'Cambiar imagen' : 'Cargar una imagen'\"\n [imgStorageSettings]=\"imageStorageSettings()\"\n (onFileSelected)=\"onImageSelected($event)\"\n (imageUploaded)=\"onImageUploaded($event, 'image')\"></dc-cropper-modal>\n }\n </div>\n\n <div>\n <h4>Agregar stickers</h4>\n\n <dc-cropper-modal\n id=\"cropperCardImage\"\n #cropperStickers\n [buttonLabel]=\"'agregar sticker'\"\n [imgStorageSettings]=\"stickerStorageSettings\"\n (onFileSelected)=\"onImageSelected($event)\"\n (imageUploaded)=\"onImageUploaded($event, 'sticker')\"></dc-cropper-modal>\n </div>\n\n <div style=\"display: flex; flex-wrap: wrap; gap: 10px\">\n @for (sticker of conversation?.assets?.stickers; track sticker.url) {\n <div style=\"position: relative\">\n <img width=\"100\" [src]=\"sticker.url\" alt=\"\" />\n <p-button (click)=\"removeSticker(sticker)\" class=\"remove-sticker\" icon=\"pi pi-times\" [rounded]=\"true\" [text]=\"true\" severity=\"danger\" />\n </div>\n }\n </div>\n\n <!-- <input pInputText type=\"file\" accept=\"image/*\" (change)=\"onImageSelected($event)\" /> -->\n\n @if(form.controls.characterCard){\n <dc-character-card-form [characterCardForm]=\"form.controls.characterCard\" (generateMissingDataRequest)=\"generateMissingData()\">\n </dc-character-card-form>\n }\n </div>\n </div>\n </form>\n\n <p-popover #textEngineDialog header=\"Text Engine Information\">\n <div class=\"p-4\">\n <h3>Text Engine Types</h3>\n <ul>\n <li> <strong>Texto Simple</strong> La conversaci\u00F3n es como chatgpt, preguntas y responde, es la m\u00E1s b\u00E1sica</li>\n\n <li\n ><strong>Multi Mensajes</strong> Utiliza markdown (recomendable entenderlo), sirve para darle formato al texto y sea m\u00E1s agradable de leer, el sistema\n puede partir dialogos que tienen distinto formato, como normal, cursiva y negritas, asi puede generar distintas voces y estilo para el narrador y\n personaje principal</li\n >\n <li\n ><strong>MD SSML :</strong> Markdown con Lenguaje de marcaci\u00F3n de s\u00EDntesis de voz (SSML), es tambien markdown pero a diferencia de multimessage, solo\n se presenta un mensaje. y la voz se genera para toda la linea,normalmente lo uso para conversaciones bilingues.</li\n >\n </ul>\n </div>\n </p-popover>\n\n <div class=\"float-button\">\n <p-button icon=\"pi pi-save\" (click)=\"saveConversation()\" severity=\"primary\" [rounded]=\"true\" [raised]=\"true\" pTooltip=\"Guardar (Ctrl + S)\"> </p-button>\n </div>\n</p-card>\n", styles: [".textmin{min-width:36vw}.image-gen-btn{position:absolute;bottom:15px;left:35%}.main-image-card{max-width:280px;display:block;margin:0 auto;border-radius:8px}.main-banner-image-card{border-radius:8px}.remove-sticker{position:absolute;top:5px;right:5px}.conversation-form{max-width:100%;padding:20px;background-color:#fff;border-radius:8px;box-shadow:0 2px 4px #0000001a}.conversation-form .card-group{background-color:#f8f9fa;padding:20px;border-radius:6px;margin-bottom:24px}.conversation-form .card-group h3{margin:0 0 20px;color:#2c3e50;font-size:1.25rem}.conversation-form .form-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:2rem;width:100%;max-width:100%}@media (max-width: 768px){.conversation-form .form-grid{grid-template-columns:1fr}}.conversation-form .form-field{margin-bottom:1.5rem;display:flex;flex-direction:column;gap:.5rem}.conversation-form .form-field label{font-weight:500}.conversation-form .form-field textarea{resize:vertical}.conversation-form .form-field.checkbox{flex-direction:row;align-items:center;gap:.5rem}.conversation-form .form-field.checkbox input[type=checkbox]{width:auto}.conversation-form .form-field .error{color:#dc3545;font-size:.875rem;margin-top:.25rem}.conversation-form .form-field .remove-button{position:absolute;border:none;border-radius:50%;width:20px;height:20px;display:flex;align-items:center;justify-content:center;cursor:pointer;top:-10px;right:-10px}.conversation-form .left-column,.conversation-form .right-column{display:flex;flex-direction:column;gap:1rem}.conversation-form .array-field{display:flex;flex-direction:column;gap:.5rem}.conversation-form .array-field .array-item{display:flex;gap:.5rem}.conversation-form .array-field .array-item input,.conversation-form .array-field .array-item textarea{flex:1}.conversation-form .array-field .array-item button{padding:.5rem}.conversation-form .array-field button[type=button]{background-color:#28a745;color:#fff;border:none;padding:8px 12px;border-radius:4px;cursor:pointer;transition:background-color .2s}.conversation-form .array-field button[type=button]:hover{background-color:#218838}.conversation-form .group,.conversation-form .meta-group,.conversation-form .card-group{background-color:#f8f9fa;padding:1rem;border-radius:4px;margin-bottom:1.5rem}.conversation-form .group h3,.conversation-form .meta-group h3,.conversation-form .card-group h3{margin-top:0;margin-bottom:1rem}.top-buttons{display:flex;justify-content:space-between;margin-bottom:2rem;gap:1rem}.top-buttons button{flex:1}::ng-deep em{font-weight:900;color:#014a93}.float-button{position:fixed;bottom:4rem;right:2rem;z-index:1000;display:flex;gap:1px}.float-button :host ::ng-deep .p-button{width:4rem;height:4rem;border-radius:50%}\n"] }]
|
|
4621
|
+
InputNumberModule,
|
|
4622
|
+
], template: "<p-card>\n <div class=\"top-buttons\">\n <button pButton severity=\"info\" (click)=\"checkPrompt()\" label=\"\uD83D\uDC41\uFE0F Ver instrucciones finales \uD83D\uDCD3\"></button>\n\n <button pButton severity=\"info\" (click)=\"goToDetails()\" label=\"\uD83D\uDCAC Conversar\"></button>\n <button pButton severity=\"primary\" (click)=\"saveConversation()\" label=\"\uD83D\uDCBE Guardar cambios\"></button>\n </div>\n\n <div class=\"top-buttons\">\n <p-button severity=\"help\" (click)=\"translate()\" label=\"\uD83D\uDD04 Traducir\"></p-button>\n <p-button [loading]=\"isGenerating\" severity=\"help\" (click)=\"generateCharacter()\" label=\"Generar \uD83E\uDDBE\"></p-button>\n\n <p-button severity=\"info\" (click)=\"downloadConversation()\" label=\"\uD83D\uDCC1 Exportar \u2B07\uFE0F\"></p-button>\n <p-button severity=\"info\" (click)=\"importConversation()\" label=\"\uD83C\uDCCF Importar \u2B06\uFE0F\"></p-button>\n </div>\n\n <br />\n <br />\n <form [formGroup]=\"form\" class=\"conversation-form\">\n <div class=\"form-grid\">\n <div class=\"left-column\">\n <div title=\"Main data\" style=\"border: 1px dashed #0c138e1f; padding: 4px; border-radius: 15px\">\n <div style=\"display: flex; gap: 15px\">\n <div class=\"form-field\">\n <label for=\"version\">Version: {{ form.controls.version.value }} <span pTooltip=\"Version number of the conversation\">\u2139\uFE0F</span></label>\n </div>\n\n <div class=\"form-field\">\n <label for=\"id\"\n >ID: <span pTooltip=\"Unique identifier for this conversation\"> {{ form.controls.id.value }} \u2139\uFE0F</span></label\n >\n </div>\n </div>\n\n <div class=\"form-field\">\n <label for=\"title\">Title <span pTooltip=\"T\u00EDtulo de la conversaci\u00F3n\">\u2139\uFE0F</span></label>\n <input pInputText id=\"title\" type=\"text\" formControlName=\"title\" />\n @if(form.controls.title.errors?.['required'] && form.controls.title.touched){\n <div class=\"error\"> Title is required </div>\n }\n </div>\n\n <div class=\"form-field\">\n <label for=\"description\">Description <span pTooltip=\"Description of the conversation\">\u2139\uFE0F</span></label>\n <input pInputText id=\"description\" type=\"text\" formControlName=\"description\" />\n @if(form.controls.description.errors?.['required'] && form.controls.description.touched){\n <div class=\"error\"> Description is required </div>\n }\n </div>\n\n <div class=\"form-field\">\n <label for=\"lang\">Language <span pTooltip=\"Select the primary language for the conversation\">\u2139\uFE0F</span></label>\n <p-select\n id=\"lang\"\n [options]=\"languageOptions\"\n formControlName=\"lang\"\n optionLabel=\"label\"\n optionValue=\"value\"\n [placeholder]=\"'Select Language'\"></p-select>\n </div>\n </div>\n\n <div formGroupName=\"conversationSettings\" class=\"group bg-sky-50\">\n <h3>Conversation Settings <span pTooltip=\"Additional information about the conversation\">\u2139\uFE0F</span></h3>\n\n <div class=\"form-field\">\n <label for=\"textEngine\">\n Text Engine\n <span\n class=\"cursor-pointer\"\n (click)=\"textEngineDialog.toggle($event)\"\n pTooltip=\"Sistema de generaci\u00F3n de texto y audios. Client: el cliente llama al servidor en cada dialogo de voz/personaje, es optimo para historias, Server SSML: se sintetiza todo el audio en uno solo con los distintos cambios de voz/personaje, util para la reflexi\u00F3n porque es bilingue, utiliza dialogos en ingles y espa\u00F1ol en el mismo dialogo/audio\"\n >\u2139\uFE0F</span\n >\n </label>\n\n <p-select\n id=\"textEngine\"\n [options]=\"textEngineOptions\"\n formControlName=\"textEngine\"\n optionLabel=\"label\"\n optionValue=\"value\"\n [placeholder]=\"'Select Text Engine'\"></p-select>\n </div>\n\n <div class=\"form-field\">\n <label class=\"cursor-pointer\" for=\"conversationType\" (click)=\"openConversationTypeDialog()\"\n >Conversation Type <span pTooltip=\"Choose the type of conversation interaction\">\u2139\uFE0F</span></label\n >\n <p-select\n id=\"conversationType\"\n [options]=\"conversationOptions\"\n formControlName=\"conversationType\"\n optionLabel=\"label\"\n optionValue=\"value\"\n [placeholder]=\"'Select Conversation Type'\"></p-select>\n </div>\n\n <div class=\"form-field\">\n <label> Auto Start <span pTooltip=\"Start conversation automatically\">\u2139\uFE0F</span> </label>\n <p-toggleSwitch formControlName=\"autoStart\"> </p-toggleSwitch>\n </div>\n\n <div formGroupName=\"tts\" class=\"group\">\n <h3>TTS Settings <span pTooltip=\"Text-to-Speech configuration options\">\u2139\uFE0F</span></h3>\n\n <div class=\"form-field\">\n <label for=\"voice\">Voice <span pTooltip=\"Select the primary voice for text-to-speech\">\u2139\uFE0F</span></label>\n\n <p-inputgroup>\n <p-inputgroup-addon>\n <p-button [rounded]=\"true\" [text]=\"true\" icon=\"pi pi-exclamation-circle\" (click)=\"openVoiceSelector(true)\" />\n </p-inputgroup-addon>\n\n <p-select\n id=\"voice\"\n [editable]=\"true\"\n [options]=\"voiceTTSOptions\"\n formControlName=\"voice\"\n optionLabel=\"name\"\n optionValue=\"id\"\n [placeholder]=\"'Select Voice'\"></p-select>\n </p-inputgroup>\n </div>\n\n <div class=\"form-field\">\n <label for=\"secondaryVoice\">Secondary Voice <span pTooltip=\"Select an alternative voice for text-to-speech\">\u2139\uFE0F</span></label>\n\n <p-inputgroup>\n <p-inputgroup-addon>\n <p-button [rounded]=\"true\" [text]=\"true\" icon=\"pi pi-info-circle\" (click)=\"openVoiceSelector(false)\" />\n </p-inputgroup-addon>\n\n <p-select\n id=\"secondaryVoice\"\n [editable]=\"true\"\n [options]=\"voiceTTSOptions\"\n formControlName=\"secondaryVoice\"\n optionLabel=\"name\"\n optionValue=\"id\"\n [placeholder]=\"'Select Secondary Voice'\"></p-select>\n </p-inputgroup>\n </div>\n\n <div class=\"form-field\">\n <label for=\"speed\">Speed <span pTooltip=\"Set the speech rate for text-to-speech conversion\">\u2139\uFE0F</span></label>\n <p-select\n id=\"speed\"\n [options]=\"audioSpeedOptions\"\n formControlName=\"speed\"\n optionLabel=\"label\"\n optionValue=\"value\"\n [placeholder]=\"'Select Speed'\"></p-select>\n </div>\n\n <div class=\"form-field\">\n <label for=\"speedRate\">Speed Rate <span pTooltip=\"Adjust the rate of speech delivery\">\u2139\uFE0F</span></label>\n <input pInputText id=\"speedRate\" type=\"number\" formControlName=\"speedRate\" step=\"0.1\" />\n </div>\n </div>\n\n <dc-model-selector [modelForm]=\"form.controls.conversationSettings.controls.model\" [shortForm]=\"true\"></dc-model-selector>\n </div>\n\n <details>\n <summary>Meta Information</summary>\n <div formGroupName=\"metaApp\" class=\"group\">\n <h3>Meta Information <span pTooltip=\"Additional information about the conversation\">\u2139\uFE0F</span></h3>\n <div class=\"form-field\">\n <label for=\"authorId\">Author ID <span pTooltip=\"Unique identifier for the conversation author\">\u2139\uFE0F</span></label>\n <input pInputText id=\"authorId\" type=\"text\" formControlName=\"authorId\" />\n </div>\n\n <div class=\"form-field\">\n <label for=\"authorEmail\">Author Email \u2139\uFE0F</label>\n <input pInputText id=\"authorEmail\" type=\"email\" formControlName=\"authorEmail\" />\n @if (form.get('metaApp.authorEmail')?.errors?.['email'] && form.get('metaApp.authorEmail')?.touched) {\n <div class=\"error\"> Please enter a valid email address </div>\n }\n </div>\n\n <div class=\"form-field\">\n <label for=\"takenCount\"\n >Taken Count <span pTooltip=\"Es el contador de cuantas veces se ha tomado esta conversaci\u00F3n, no sirve por ahora\"> \u2139\uFE0F</span></label\n >\n <input pInputText id=\"takenCount\" type=\"number\" formControlName=\"takenCount\" />\n </div>\n\n <div class=\"form-field checkbox\">\n <label>\n <p-checkbox [binary]=\"true\" formControlName=\"isPublic\" />\n Public\n </label>\n </div>\n\n <div class=\"form-field checkbox\">\n <label>\n <p-inputnumber formControlName=\"level\" [showButtons]=\"true\" [min]=\"0\" [max]=\"5\" />\n Nivel Recomendado\n </label>\n </div>\n\n <div class=\"form-field checkbox\">\n <label>\n <p-checkbox [binary]=\"true\" formControlName=\"isPublished\" />\n Published\n </label>\n </div>\n </div>\n </details>\n\n <details>\n <summary>Gestion de cuentas</summary>\n <div class=\"group\">\n <h4>Gestion de cuentas</h4>\n @if(form.controls.accounts){\n <account-platform-form [formArray]=\"form.controls.accounts\"></account-platform-form>\n }\n </div>\n </details>\n\n @if(form.controls.conversationFlow){\n <div class=\"group\">\n <dc-conversation-flow-form [formGroup]=\"form.controls.conversationFlow\"></dc-conversation-flow-form>\n </div>\n }\n </div>\n\n <div class=\"right-column\">\n <div style=\"position: relative; min-height: 60px\">\n <div style=\"border: 1px dashed #0c138e1f; padding: 4px; border-radius: 15px\">\n <img [src]=\"conversation?.assets?.bannerImg?.url || 'assets/images/default_banner.webp'\" class=\"main-banner-image-card\" />\n @if(!conversation?.assets?.bannerImg?.url && agentCardId) {\n\n <dc-cropper-modal\n style=\"position: absolute; bottom: 10px; right: 10px\"\n #cropperBanner\n id=\"cropperBanner\"\n [buttonLabel]=\"conversation?.assets?.bannerImg?.url ? 'Cambiar el banner' : 'Cargar un banner'\"\n [imgStorageSettings]=\"bannerImgSettings()\"\n [currentStorage]=\"conversation?.assets?.bannerImg\"\n (onFileSelected)=\"onImageSelected($event)\"\n (imageUploaded)=\"onImageUploaded($event, 'bannerImg')\"></dc-cropper-modal>\n }\n <div style=\"position: relative\">\n <img [src]=\"conversation?.assets?.image?.url || 'assets/images/default_2_3.webp'\" class=\"main-image-card\" />\n @if (!agentCardId) {\n <button pButton (click)=\"saveConversation()\"> Guarda el scenario para subir la imagen</button>\n } @else {\n\n <p-button\n (click)=\"generateMainImage()\"\n class=\"image-gen-btn\"\n pTooltip=\"Generar/Re generar la imagen\"\n icon=\"pi pi-sparkles\"\n [rounded]=\"true\"\n severity=\"info\" />\n\n <dc-cropper-modal\n style=\"position: absolute; bottom: 10px; left: 50%\"\n id=\"cropperCardImage\"\n #cropperCardImage\n [buttonLabel]=\"conversation?.assets?.image?.url ? 'Cambiar imagen' : 'Cargar una imagen'\"\n [imgStorageSettings]=\"imageStorageSettings()\"\n (onFileSelected)=\"onImageSelected($event)\"\n (imageUploaded)=\"onImageUploaded($event, 'image')\"></dc-cropper-modal>\n }\n </div>\n\n <h4>Agregar stickers</h4>\n\n <dc-cropper-modal\n id=\"cropperCardImage\"\n #cropperStickers\n [buttonLabel]=\"'agregar sticker'\"\n [imgStorageSettings]=\"stickerStorageSettings\"\n (onFileSelected)=\"onImageSelected($event)\"\n (imageUploaded)=\"onImageUploaded($event, 'sticker')\"></dc-cropper-modal>\n\n <div style=\"display: flex; flex-wrap: wrap; gap: 10px\">\n @for (sticker of conversation?.assets?.stickers; track sticker.url) {\n <div style=\"position: relative\">\n <img width=\"100\" [src]=\"sticker.url\" alt=\"\" />\n <p-button (click)=\"removeSticker(sticker)\" class=\"remove-sticker\" icon=\"pi pi-times\" [rounded]=\"true\" [text]=\"true\" severity=\"danger\" />\n </div>\n }\n </div>\n </div>\n </div>\n\n @if(form.controls.characterCard){\n <dc-character-card-form [characterCardForm]=\"form.controls.characterCard\" (generateMissingDataRequest)=\"generateMissingData()\">\n </dc-character-card-form>\n }\n </div>\n </div>\n </form>\n\n <p-popover #textEngineDialog header=\"Text Engine Information\">\n <div class=\"p-4\">\n <h3>Text Engine Types</h3>\n <ul>\n <li> <strong>Texto Simple</strong> La conversaci\u00F3n es como chatgpt, preguntas y responde, es la m\u00E1s b\u00E1sica</li>\n\n <li\n ><strong>Multi Mensajes</strong> Utiliza markdown (recomendable entenderlo), sirve para darle formato al texto y sea m\u00E1s agradable de leer, el sistema\n puede partir dialogos que tienen distinto formato, como normal, cursiva y negritas, asi puede generar distintas voces y estilo para el narrador y\n personaje principal</li\n >\n <li\n ><strong>MD SSML :</strong> Markdown con Lenguaje de marcaci\u00F3n de s\u00EDntesis de voz (SSML), es tambien markdown pero a diferencia de multimessage, solo\n se presenta un mensaje. y la voz se genera para toda la linea,normalmente lo uso para conversaciones bilingues.</li\n >\n </ul>\n </div>\n </p-popover>\n\n <div class=\"float-button\">\n <p-button icon=\"pi pi-save\" (click)=\"saveConversation()\" severity=\"primary\" [rounded]=\"true\" [raised]=\"true\" pTooltip=\"Guardar (Ctrl + S)\"> </p-button>\n </div>\n</p-card>\n", styles: [".textmin{min-width:36vw}.image-gen-btn{position:absolute;bottom:15px;left:35%}.main-image-card{max-width:280px;display:block;margin:0 auto;border-radius:8px}.main-banner-image-card{border-radius:8px}.remove-sticker{position:absolute;top:5px;right:5px}.conversation-form{max-width:100%;padding:20px;background-color:#fff;border-radius:8px;box-shadow:0 2px 4px #0000001a}.conversation-form .card-group{padding:20px;border-radius:6px;margin-bottom:24px}.conversation-form .card-group h3{margin:0 0 20px;color:#2c3e50;font-size:1.25rem}.conversation-form .form-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:2rem;width:100%;max-width:100%}@media (max-width: 768px){.conversation-form .form-grid{grid-template-columns:1fr}}.conversation-form .form-field{margin-bottom:1.5rem;display:flex;flex-direction:column;gap:.5rem}.conversation-form .form-field label{font-weight:500}.conversation-form .form-field textarea{resize:vertical}.conversation-form .form-field.checkbox{flex-direction:row;align-items:center;gap:.5rem}.conversation-form .form-field.checkbox input[type=checkbox]{width:auto}.conversation-form .form-field .error{color:#dc3545;font-size:.875rem;margin-top:.25rem}.conversation-form .form-field .remove-button{position:absolute;border:none;border-radius:50%;width:20px;height:20px;display:flex;align-items:center;justify-content:center;cursor:pointer;top:-10px;right:-10px}.conversation-form .left-column,.conversation-form .right-column{display:flex;flex-direction:column;gap:1rem}.conversation-form .array-field{display:flex;flex-direction:column;gap:.5rem}.conversation-form .array-field .array-item{display:flex;gap:.5rem}.conversation-form .array-field .array-item input,.conversation-form .array-field .array-item textarea{flex:1}.conversation-form .array-field .array-item button{padding:.5rem}.conversation-form .array-field button[type=button]{background-color:#28a745;color:#fff;border:none;padding:8px 12px;border-radius:4px;cursor:pointer;transition:background-color .2s}.conversation-form .array-field button[type=button]:hover{background-color:#218838}.conversation-form .group,.conversation-form .meta-group,.conversation-form .card-group{padding:1rem;border-radius:4px;margin-bottom:1.5rem}.conversation-form .group h3,.conversation-form .meta-group h3,.conversation-form .card-group h3{margin-top:0;margin-bottom:1rem}.top-buttons{display:flex;justify-content:space-between;margin-bottom:2rem;gap:1rem}.top-buttons button{flex:1}::ng-deep em{font-weight:900;color:#014a93}.float-button{position:fixed;bottom:4rem;right:2rem;z-index:1000;display:flex;gap:1px}.float-button :host ::ng-deep .p-button{width:4rem;height:4rem;border-radius:50%}\n"] }]
|
|
4273
4623
|
}] });
|
|
4274
4624
|
|
|
4275
4625
|
class DCConversationCardUIComponent {
|
|
@@ -4298,7 +4648,7 @@ class DCConversationCardUIComponent {
|
|
|
4298
4648
|
this.onCardAction.emit({ event: 'delete', card: this.card() });
|
|
4299
4649
|
}
|
|
4300
4650
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.4", ngImport: i0, type: DCConversationCardUIComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
4301
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.4", type: DCConversationCardUIComponent, isStandalone: true, selector: "dc-agent-card-default-ui", inputs: { card: { classPropertyName: "card", publicName: "card", isSignal: true, isRequired: false, transformFunction: null }, showOptions: { classPropertyName: "showOptions", publicName: "showOptions", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { onCardAction: "onCardAction" }, ngImport: i0, template: "<p-card class=\"card-image\">\n @if(showOptions()) {\n <div style=\"position: absolute; top: 5px; right: 5px; z-index: 1000\">\n <p-speeddial\n [model]=\"speedDialModel\"\n [radius]=\"70\"\n type=\"quarter-circle\"\n direction=\"down-left\"\n [buttonProps]=\"{ severity: 'primary', rounded: true, outlined: true, raised: true }\" />\n </div>\n }\n\n <img [src]=\"card()?.assets?.image?.url || 'assets/images/default_conversation_card.webp'\" alt=\"\" />\n\n <div (click)=\"onDetails()\" class=\"content\">\n <p class=\"text-xl font-bold text-shadow-lg/30\">{{ card().title }}</p>\n\n <!-- <h5 class=\"title\">\n <span [innerHTML]=\"card().characterCard?.data.description | truncate : 100\"></span>\n </h5> -->\n\n <p style=\"margin-top: 40px\">\n <span class=\"title text-shadow-lg/30\" [innerHTML]=\"card().characterCard?.data.creator_notes | truncate : 200\"></span>\n </p>\n\n @if(card().taken){\n\n <div style=\"position: absolute; bottom: 10px; left: 10px\">\n <p-tag icon=\"pi pi-check-circle\" severity=\"secondary\" value=\"Tomada\" [rounded]=\"true\" />\n </div>\n }\n <p-button\n (click)=\"onDetails()\"\n [style]=\"{ position: 'absolute', bottom: '10px', right: '10px' }\"\n icon=\"pi pi-comment\"\n [rounded]=\"true\"\n severity=\"info\"\n [outlined]=\"true\"\n [raised]=\"true\" />\n </div>\n</p-card>\n", styles: [":host{display:block}:host ::ng-deep .p-card{height:100%}:host ::ng-deep .p-card-body{height:100%;padding:0!important}.card-image{width:280px;height:380px;position:relative;align-items:center;display:block;padding:-10px}.card-image img{position:absolute;z-index:3;width:100%;height:100%;opacity:.75;object-fit:cover;transition:opacity .5s}.content{position:absolute;inset:0;z-index:4;padding:1rem;color:#fff;background:linear-gradient(to bottom,#0003,#0000001a);height:100%;display:flex;flex-direction:column;justify-content:space-between}.content:hover{background:linear-gradient(to bottom,color-mix(in srgb,var(--p-primary-color) 20%,transparent),color-mix(in srgb,black 10%,transparent));cursor:pointer}\n"], dependencies: [{ kind: "ngmodule", type: PopoverModule }, { kind: "pipe", type: TruncatePipe, name: "truncate" }, { kind: "ngmodule", type: ButtonModule }, { kind: "component", type: i2
|
|
4651
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.4", type: DCConversationCardUIComponent, isStandalone: true, selector: "dc-agent-card-default-ui", inputs: { card: { classPropertyName: "card", publicName: "card", isSignal: true, isRequired: false, transformFunction: null }, showOptions: { classPropertyName: "showOptions", publicName: "showOptions", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { onCardAction: "onCardAction" }, ngImport: i0, template: "<p-card class=\"card-image\">\n @if(showOptions()) {\n <div style=\"position: absolute; top: 5px; right: 5px; z-index: 1000\">\n <p-speeddial\n [model]=\"speedDialModel\"\n [radius]=\"70\"\n type=\"quarter-circle\"\n direction=\"down-left\"\n [buttonProps]=\"{ severity: 'primary', rounded: true, outlined: true, raised: true }\" />\n </div>\n }\n\n <img [src]=\"card()?.assets?.image?.url || 'assets/images/default_conversation_card.webp'\" alt=\"\" />\n\n <div (click)=\"onDetails()\" class=\"content\">\n <p class=\"text-xl font-bold text-shadow-lg/30\">{{ card().title }}</p>\n\n <!-- <h5 class=\"title\">\n <span [innerHTML]=\"card().characterCard?.data.description | truncate : 100\"></span>\n </h5> -->\n\n <p style=\"margin-top: 40px\">\n <span class=\"title text-shadow-lg/30\" [innerHTML]=\"card().characterCard?.data.creator_notes | truncate : 200\"></span>\n </p>\n\n @if(card().taken){\n\n <div style=\"position: absolute; bottom: 10px; left: 10px\">\n <p-tag icon=\"pi pi-check-circle\" severity=\"secondary\" value=\"Tomada\" [rounded]=\"true\" />\n </div>\n }\n <p-button\n (click)=\"onDetails()\"\n [style]=\"{ position: 'absolute', bottom: '10px', right: '10px' }\"\n icon=\"pi pi-comment\"\n [rounded]=\"true\"\n severity=\"info\"\n [outlined]=\"true\"\n [raised]=\"true\" />\n </div>\n</p-card>\n", styles: [":host{display:block}:host ::ng-deep .p-card{height:100%}:host ::ng-deep .p-card-body{height:100%;padding:0!important}.card-image{width:280px;height:380px;position:relative;align-items:center;display:block;padding:-10px}.card-image img{position:absolute;z-index:3;width:100%;height:100%;opacity:.75;object-fit:cover;transition:opacity .5s}.content{position:absolute;inset:0;z-index:4;padding:1rem;color:#fff;background:linear-gradient(to bottom,#0003,#0000001a);height:100%;display:flex;flex-direction:column;justify-content:space-between}.content:hover{background:linear-gradient(to bottom,color-mix(in srgb,var(--p-primary-color) 20%,transparent),color-mix(in srgb,black 10%,transparent));cursor:pointer}\n"], dependencies: [{ kind: "ngmodule", type: PopoverModule }, { kind: "pipe", type: TruncatePipe, name: "truncate" }, { kind: "ngmodule", type: ButtonModule }, { kind: "component", type: i2.Button, selector: "p-button", inputs: ["type", "iconPos", "icon", "badge", "label", "disabled", "loading", "loadingIcon", "raised", "rounded", "text", "plain", "severity", "outlined", "link", "tabindex", "size", "variant", "style", "styleClass", "badgeClass", "badgeSeverity", "ariaLabel", "autofocus", "fluid", "buttonProps"], outputs: ["onClick", "onFocus", "onBlur"] }, { kind: "ngmodule", type: SpeedDialModule }, { kind: "component", type: i2$5.SpeedDial, selector: "p-speeddial, p-speedDial, p-speed-dial", inputs: ["id", "model", "visible", "style", "className", "direction", "transitionDelay", "type", "radius", "mask", "disabled", "hideOnClickOutside", "buttonStyle", "buttonClassName", "maskStyle", "maskClassName", "showIcon", "hideIcon", "rotateAnimation", "ariaLabel", "ariaLabelledBy", "tooltipOptions", "buttonProps"], outputs: ["onVisibleChange", "visibleChange", "onClick", "onShow", "onHide"] }, { kind: "ngmodule", type: CardModule }, { kind: "component", type: i2$4.Card, selector: "p-card", inputs: ["header", "subheader", "style", "styleClass"] }, { kind: "ngmodule", type: TagModule }, { kind: "component", type: i4$1.Tag, selector: "p-tag", inputs: ["style", "styleClass", "severity", "value", "icon", "rounded"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
4302
4652
|
}
|
|
4303
4653
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.4", ngImport: i0, type: DCConversationCardUIComponent, decorators: [{
|
|
4304
4654
|
type: Component,
|
|
@@ -4517,6 +4867,7 @@ class DcAgentCardDetailsComponent {
|
|
|
4517
4867
|
this.agentCardService = inject(CONVERSATION_AI_TOKEN);
|
|
4518
4868
|
this.route = inject(ActivatedRoute);
|
|
4519
4869
|
this.cdr = inject(ChangeDetectorRef);
|
|
4870
|
+
this.toastService = inject(TOAST_ALERTS_TOKEN);
|
|
4520
4871
|
this.agentCardId = '';
|
|
4521
4872
|
this.onStartConversation = output();
|
|
4522
4873
|
this.showInfoLayer = false;
|
|
@@ -4529,6 +4880,13 @@ class DcAgentCardDetailsComponent {
|
|
|
4529
4880
|
console.log(this.agentCardId);
|
|
4530
4881
|
}
|
|
4531
4882
|
this.agentCard = await this.agentCardService.findConversationCardByID(this.agentCardId);
|
|
4883
|
+
if (!this.agentCard) {
|
|
4884
|
+
this.toastService.error({
|
|
4885
|
+
title: 'Conversation card not found',
|
|
4886
|
+
subtitle: 'Probablemente tienes el id incorrecto, o estas en una sección errónea.',
|
|
4887
|
+
});
|
|
4888
|
+
return;
|
|
4889
|
+
}
|
|
4532
4890
|
if (!this.agentCard.conversationSettings) {
|
|
4533
4891
|
console.warn('⚠️ Conversation settings not found ⚠️ probably is an old version of the card.');
|
|
4534
4892
|
this.agentCard.conversationSettings = {};
|
|
@@ -4544,7 +4902,7 @@ class DcAgentCardDetailsComponent {
|
|
|
4544
4902
|
this.cdr.markForCheck();
|
|
4545
4903
|
}
|
|
4546
4904
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.4", ngImport: i0, type: DcAgentCardDetailsComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
4547
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.4", type: DcAgentCardDetailsComponent, isStandalone: true, selector: "dc-agent-card-details", inputs: { agentCardId: "agentCardId" }, outputs: { onStartConversation: "onStartConversation" }, ngImport: i0, template: "<div style=\"display: flex; justify-content: center; align-items: center\">\n <p-card>\n <div class=\"card-container\">\n <img class=\"card-image\" [src]=\"agentCard?.assets?.image?.url || 'assets/images/default_conversation_card.webp'\" alt=\"\" />\n\n <div class=\"info-button\" (click)=\"toggleInfoLayer()\">\n <p-button icon=\"pi pi-arrow-down-left\" [rounded]=\"true\" [raised]=\"true\" severity=\"primary\" [outlined]=\"true\" />\n </div>\n\n <div style=\"position: absolute; bottom: 20px; right: 50%; transform: translateX(50%); z-index: 3\">\n <p-button size=\"large\" label=\"Iniciar Conversaci\u00F3n\" [rounded]=\"true\" (click)=\"startConversation()\" />\n </div>\n\n <div class=\"info-layer\" [class.active]=\"showInfoLayer\">\n <div class=\"info-content\">\n <h1\n ><strong>{{ agentCard?.title }}</strong></h1\n >\n <p>{{ agentCard?.characterCard.data?.name }}</p>\n\n @if (agentCard?.characterCard.data?.scenario) {\n <div class=\"scenario\">\n <h4>Scenario</h4>\n <p>{{ agentCard?.characterCard.data.scenario | parseCard : agentCard }}</p>\n </div>\n }\n </div>\n </div>\n </div>\n </p-card>\n</div>\n", styles: ["::ng-deep .p-card{width:420px;height:700px}::ng-deep .p-card .p-card-body{width:100%;height:100%}.card-image{height:100%;width:100%;object-fit:cover;object-position:center;position:absolute;top:0;left:0;transition:filter .3s ease}.info-button{position:absolute;top:15px;right:15px;z-index:3}.info-button:hover{transform:scale(1.1)}.info-layer{height:100%;width:100%;position:absolute;top:0;left:0;display:flex;justify-content:center;align-items:center;z-index:2;-webkit-backdrop-filter:blur(3px);backdrop-filter:blur(3px);background-color:#ed122833;color:#fff;opacity:1;clip-path:circle(0% at top right);transition:clip-path .5s cubic-bezier(.25,1,.5,1);pointer-events:none}.info-layer.active{clip-path:circle(150% at top right);pointer-events:auto}.info-content{padding:15px;text-align:center;max-width:90%}.info-content h1{margin-top:0;font-size:18px;margin-bottom:10px}.info-content p{font-size:12px;margin:0}::ng-deep .info-button .p-button{background-color:#ffffff47}\n"], dependencies: [{ kind: "ngmodule", type: ButtonModule }, { kind: "component", type: i2
|
|
4905
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.4", type: DcAgentCardDetailsComponent, isStandalone: true, selector: "dc-agent-card-details", inputs: { agentCardId: "agentCardId" }, outputs: { onStartConversation: "onStartConversation" }, ngImport: i0, template: "<div style=\"display: flex; justify-content: center; align-items: center\">\n <p-card>\n <div class=\"card-container\">\n <img class=\"card-image\" [src]=\"agentCard?.assets?.image?.url || 'assets/images/default_conversation_card.webp'\" alt=\"\" />\n\n <div class=\"info-button\" (click)=\"toggleInfoLayer()\">\n <p-button icon=\"pi pi-arrow-down-left\" [rounded]=\"true\" [raised]=\"true\" severity=\"primary\" [outlined]=\"true\" />\n </div>\n\n <div style=\"position: absolute; bottom: 20px; right: 50%; transform: translateX(50%); z-index: 3\">\n <p-button size=\"large\" label=\"Iniciar Conversaci\u00F3n\" [rounded]=\"true\" (click)=\"startConversation()\" />\n </div>\n\n <div class=\"info-layer\" [class.active]=\"showInfoLayer\">\n <div class=\"info-content\">\n <h1\n ><strong>{{ agentCard?.title }}</strong></h1\n >\n <p>{{ agentCard?.characterCard.data?.name }}</p>\n\n @if (agentCard?.characterCard.data?.scenario) {\n <div class=\"scenario\">\n <h4>Scenario</h4>\n <p>{{ agentCard?.characterCard.data.scenario | parseCard : agentCard }}</p>\n </div>\n }\n </div>\n </div>\n </div>\n </p-card>\n</div>\n", styles: ["::ng-deep .p-card{width:420px;height:700px}::ng-deep .p-card .p-card-body{width:100%;height:100%}.card-image{height:100%;width:100%;object-fit:cover;object-position:center;position:absolute;top:0;left:0;transition:filter .3s ease}.info-button{position:absolute;top:15px;right:15px;z-index:3}.info-button:hover{transform:scale(1.1)}.info-layer{height:100%;width:100%;position:absolute;top:0;left:0;display:flex;justify-content:center;align-items:center;z-index:2;-webkit-backdrop-filter:blur(3px);backdrop-filter:blur(3px);background-color:#ed122833;color:#fff;opacity:1;clip-path:circle(0% at top right);transition:clip-path .5s cubic-bezier(.25,1,.5,1);pointer-events:none}.info-layer.active{clip-path:circle(150% at top right);pointer-events:auto}.info-content{padding:15px;text-align:center;max-width:90%}.info-content h1{margin-top:0;font-size:18px;margin-bottom:10px}.info-content p{font-size:12px;margin:0}::ng-deep .info-button .p-button{background-color:#ffffff47}\n"], dependencies: [{ kind: "ngmodule", type: ButtonModule }, { kind: "component", type: i2.Button, selector: "p-button", inputs: ["type", "iconPos", "icon", "badge", "label", "disabled", "loading", "loadingIcon", "raised", "rounded", "text", "plain", "severity", "outlined", "link", "tabindex", "size", "variant", "style", "styleClass", "badgeClass", "badgeSeverity", "ariaLabel", "autofocus", "fluid", "buttonProps"], outputs: ["onClick", "onFocus", "onBlur"] }, { kind: "ngmodule", type: CardModule }, { kind: "component", type: i2$4.Card, selector: "p-card", inputs: ["header", "subheader", "style", "styleClass"] }, { kind: "pipe", type: ParseCardPipe, name: "parseCard" }] }); }
|
|
4548
4906
|
}
|
|
4549
4907
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.4", ngImport: i0, type: DcAgentCardDetailsComponent, decorators: [{
|
|
4550
4908
|
type: Component,
|
|
@@ -4553,20 +4911,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.4", ngImpor
|
|
|
4553
4911
|
type: Input
|
|
4554
4912
|
}] } });
|
|
4555
4913
|
|
|
4556
|
-
function extractJsonFromResponse(content) {
|
|
4557
|
-
// Match everything between the first { and last } OR first [ and last ]
|
|
4558
|
-
const jsonMatch = content.match(/(\{[\s\S]*?\}|\[[\s\S]*?\])/);
|
|
4559
|
-
if (!jsonMatch)
|
|
4560
|
-
return null;
|
|
4561
|
-
try {
|
|
4562
|
-
return JSON.parse(jsonMatch[0]);
|
|
4563
|
-
}
|
|
4564
|
-
catch (error) {
|
|
4565
|
-
console.error('Error parsing JSON:', error);
|
|
4566
|
-
return null;
|
|
4567
|
-
}
|
|
4568
|
-
}
|
|
4569
|
-
|
|
4570
4914
|
/*
|
|
4571
4915
|
* Public API Surface of ngx-agent-cards
|
|
4572
4916
|
*/
|
|
@@ -4576,5 +4920,5 @@ function extractJsonFromResponse(content) {
|
|
|
4576
4920
|
* Generated bundle index. Do not edit.
|
|
4577
4921
|
*/
|
|
4578
4922
|
|
|
4579
|
-
export { AgentCardListComponent, AgentCardProgressStatus, AgentCardsAbstractService, AgentUserProgressService, AudioService, AudioSpeed, CONVERSATION_AI_TOKEN, ChatEventType, ChatMessage, ChatRole, ContextType, ConversationDTO, ConversationEvents, ConversationMessagesDTO, ConversationType, ConversationTypeOptions, DCAgentCardFormComponent, DCChatComponent, DCConversationCardUIComponent, DCConversationPromptBuilderService, DcAgentCardDetailsComponent, EAccountsPlatform, EntityThen, EntityWhat, EntityWhatOptions, EntityWhen, EntityWhenOptions, EvalResultStringDefinition, LangCodeDescriptionEs, MessageContent, MessageOrchestratorComponent, ModelSelectorComponent, PopupService, TextEngineOptions, TextEngines, TextHighlighterComponent, USER_DATA_EXCHANGE, UserDataExchangeAbstractService, VoiceTTSOption, VoiceTTSOptions, WordTimestamps, buildObjectTTSRequest, characterCardStringDataDefinition, convertToHTML, createAIModelFormGroup, defaultconvUserSettings, extractAudioAndTranscription, extractJsonFromResponse, markdownBasicToHTML, markdownToHTML$1 as markdownToHTML, markdownToHTML2, markdownToHtml, matchTranscription, provideChatAIService, provideUserDataExchange, removeAllEmojis, removeEmojis, removeEmojisAndSpecialCharacters, removeSpecialCharacters };
|
|
4923
|
+
export { AgentCardListComponent, AgentCardProgressStatus, AgentCardsAbstractService, AgentUserProgressService, AudioService, AudioSpeed, CONVERSATION_AI_TOKEN, ChatEventType, ChatMessage, ChatRole, ContextType, ConversationDTO, ConversationEvents, ConversationMessagesDTO, ConversationType, ConversationTypeOptions, DCAgentCardFormComponent, DCChatComponent, DCConversationCardUIComponent, DCConversationPromptBuilderService, DCConversationUserChatSettingsComponent, DcAgentCardDetailsComponent, DoActionTypeOptions, DynamicFlowService, EAccountsPlatform, EDoActionType, EntityThen, EntityWhat, EntityWhatOptions, EntityWhen, EntityWhenOptions, EvalResultStringDefinition, LangCodeDescriptionEs, MessageContent, MessageOrchestratorComponent, ModelSelectorComponent, PopupService, SystemPromptType, TextEngineOptions, TextEngines, TextHighlighterComponent, USER_DATA_EXCHANGE, UserDataExchangeAbstractService, VoiceTTSOption, VoiceTTSOptions, WordTimestamps, buildObjectTTSRequest, characterCardStringDataDefinition, convertToHTML, createAIModelFormGroup, defaultconvUserSettings, extractAudioAndTranscription, extractJsonFromResponse, markdownBasicToHTML, markdownToHTML$1 as markdownToHTML, markdownToHTML2, markdownToHtml, matchTranscription, provideChatAIService, provideUserDataExchange, removeAllEmojis, removeEmojis, removeEmojisAndSpecialCharacters, removeSpecialCharacters };
|
|
4580
4924
|
//# sourceMappingURL=dataclouder-ngx-agent-cards.mjs.map
|