@dataclouder/ngx-agent-cards 0.0.89 → 0.0.90
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 +87 -55
- package/fesm2022/dataclouder-ngx-agent-cards.mjs.map +1 -1
- package/lib/components/chat-container/chat-container.component.d.ts +3 -2
- package/lib/components/chat-container/chat-footer/chat-footer.component.d.ts +4 -1
- package/lib/components/chat-container/chat-messages-list/chat-messages-list.component.d.ts +6 -1
- package/lib/components/chat-settings/dc-conversation-userchat-settings.component.d.ts +2 -3
- package/lib/models/agent.models.d.ts +1 -0
- package/lib/models/conversation-ai.class.d.ts +2 -2
- package/lib/services/conversation.service.d.ts +4 -2
- package/package.json +1 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as i0 from '@angular/core';
|
|
2
|
-
import { InjectionToken, Injectable, inject, Pipe, input, output, Input, Component, signal, computed, ChangeDetectorRef, DestroyRef, effect, ChangeDetectionStrategy, ViewChild, ViewChildren } from '@angular/core';
|
|
2
|
+
import { InjectionToken, Injectable, inject, Pipe, input, output, Input, Component, signal, computed, ChangeDetectorRef, DestroyRef, effect, ChangeDetectionStrategy, ElementRef, ViewChild, ViewChildren } from '@angular/core';
|
|
3
3
|
import * as i1$1 from '@angular/common';
|
|
4
4
|
import { CommonModule, DatePipe, DecimalPipe, NgComponentOutlet } from '@angular/common';
|
|
5
5
|
import { DynamicDialogRef, DialogService, DynamicDialogConfig, DynamicDialogModule } from 'primeng/dynamicdialog';
|
|
@@ -14,7 +14,7 @@ import * as i3 from 'primeng/textarea';
|
|
|
14
14
|
import { TextareaModule } from 'primeng/textarea';
|
|
15
15
|
import * as i2$1 from 'primeng/button';
|
|
16
16
|
import { ButtonModule } from 'primeng/button';
|
|
17
|
-
import { AudioSpeed as AudioSpeed$1, TOAST_ALERTS_TOKEN, PaginationBase, DCFilterBarComponent, QuickTableComponent } from '@dataclouder/ngx-core';
|
|
17
|
+
import { AudioSpeed as AudioSpeed$1, MicVadComponent, TOAST_ALERTS_TOKEN, PaginationBase, DCFilterBarComponent, QuickTableComponent } from '@dataclouder/ngx-core';
|
|
18
18
|
import { takeUntilDestroyed } from '@angular/core/rxjs-interop';
|
|
19
19
|
import { Subject, fromEvent, filter } from 'rxjs';
|
|
20
20
|
import { takeUntil, map } from 'rxjs/operators';
|
|
@@ -534,13 +534,13 @@ class DCConversationPromptBuilderService {
|
|
|
534
534
|
}
|
|
535
535
|
// For chat conversation i need inital settings.
|
|
536
536
|
buildConversationSettings(agentCard, parseDict = null) {
|
|
537
|
-
const converstionSettings = agentCard?.conversationSettings;
|
|
537
|
+
const converstionSettings = agentCard?.conversationSettings || {};
|
|
538
538
|
converstionSettings.messages = this.buildConversationMessages(agentCard, parseDict);
|
|
539
539
|
converstionSettings.last_prompt = this.getJailBrakePrompt(agentCard);
|
|
540
540
|
return converstionSettings;
|
|
541
541
|
}
|
|
542
542
|
buildConversationMessages(agentCard, parseDict = null) {
|
|
543
|
-
const initialConversation = this.buildInitialConversation(agentCard.characterCard, agentCard
|
|
543
|
+
const initialConversation = this.buildInitialConversation(agentCard.characterCard, agentCard?.conversationSettings?.conversationType);
|
|
544
544
|
parseDict = this.getDefaultParseDict(parseDict, agentCard);
|
|
545
545
|
// Si quiero agregar todo tipo de info, el parse dict es algo que debe hacer el cliente.
|
|
546
546
|
this.parseConversation(initialConversation, parseDict);
|
|
@@ -607,7 +607,7 @@ class DCConversationPromptBuilderService {
|
|
|
607
607
|
}
|
|
608
608
|
return prompt;
|
|
609
609
|
}
|
|
610
|
-
buildInitialConversation(characterCard, conversationType) {
|
|
610
|
+
buildInitialConversation(characterCard, conversationType = ConversationType.General) {
|
|
611
611
|
let systemPromptInstructions = this.getDefaultPromptByType(conversationType);
|
|
612
612
|
if (characterCard?.data?.system_prompt) {
|
|
613
613
|
systemPromptInstructions = characterCard.data.system_prompt;
|
|
@@ -1156,18 +1156,20 @@ class ConversationService {
|
|
|
1156
1156
|
}
|
|
1157
1157
|
setupConversationWithAgentCard(agentCard) {
|
|
1158
1158
|
const conversationSettings = this.conversationBuilder.buildConversationSettings(agentCard);
|
|
1159
|
-
// set initial ids
|
|
1160
|
-
for (const i in conversationSettings.messages) {
|
|
1161
|
-
conversationSettings.messages[i].messageId = 'msg_' + i;
|
|
1162
|
-
}
|
|
1163
1159
|
this.conversationSettingsSignal.set(conversationSettings);
|
|
1164
1160
|
}
|
|
1165
|
-
|
|
1166
|
-
|
|
1167
|
-
this.
|
|
1161
|
+
async initConversationWithSettings(conversationSettings) {
|
|
1162
|
+
this.conversationSettingsSignal.set(conversationSettings);
|
|
1163
|
+
await this.initConversation();
|
|
1164
|
+
}
|
|
1165
|
+
async initConversation() {
|
|
1168
1166
|
const conversationSettings = this.conversationSettingsSignal();
|
|
1167
|
+
for (const i in conversationSettings.messages) {
|
|
1168
|
+
conversationSettings.messages[i].messageId = 'msg_' + i;
|
|
1169
|
+
}
|
|
1169
1170
|
// Find first assistant message
|
|
1170
|
-
const firstAssistantMsg = conversationSettings
|
|
1171
|
+
const firstAssistantMsg = conversationSettings?.messages.find((message) => message.role === ChatRole.Assistant);
|
|
1172
|
+
this.messagesSignal.set(conversationSettings?.messages || []);
|
|
1171
1173
|
if (firstAssistantMsg) {
|
|
1172
1174
|
// Process the first assistant message
|
|
1173
1175
|
const processedMessage = this.messageProcessingService.processMessage(firstAssistantMsg, this.conversationSettingsSignal());
|
|
@@ -1177,14 +1179,17 @@ class ConversationService {
|
|
|
1177
1179
|
if (messageIndex !== -1) {
|
|
1178
1180
|
conversationSettings.messages[messageIndex] = processedMessage;
|
|
1179
1181
|
}
|
|
1180
|
-
this.messagesSignal.set(conversationSettings.messages);
|
|
1181
|
-
// this.addMessage(processedMessage);
|
|
1182
1182
|
}
|
|
1183
|
-
else if (conversationSettings
|
|
1183
|
+
else if (conversationSettings?.autoStart) {
|
|
1184
1184
|
// Auto-start conversation if configured
|
|
1185
1185
|
await this.sendCurrentConversation();
|
|
1186
1186
|
}
|
|
1187
1187
|
}
|
|
1188
|
+
// Initialize conversation
|
|
1189
|
+
async initConversationWithAgentCard(agentCard) {
|
|
1190
|
+
this.setupConversationWithAgentCard(agentCard);
|
|
1191
|
+
await this.initConversation();
|
|
1192
|
+
}
|
|
1188
1193
|
// Send user message
|
|
1189
1194
|
async sendUserMessage(message) {
|
|
1190
1195
|
if (this.isThinkingSignal()) {
|
|
@@ -1224,9 +1229,8 @@ class ConversationService {
|
|
|
1224
1229
|
messages: conversationMessages,
|
|
1225
1230
|
conversationType: conversationSettings.conversationType,
|
|
1226
1231
|
textEngine: conversationSettings.textEngine,
|
|
1227
|
-
model: { modelName: '', provider: '' },
|
|
1232
|
+
model: conversationSettings.model || { modelName: '', provider: '' },
|
|
1228
1233
|
};
|
|
1229
|
-
console.warn('fix model name modelName take from user settings');
|
|
1230
1234
|
// Call AI service
|
|
1231
1235
|
const response = await this.agentCardService.callChatCompletion(conversation);
|
|
1232
1236
|
if (!response) {
|
|
@@ -1345,11 +1349,15 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.4", ngImpor
|
|
|
1345
1349
|
|
|
1346
1350
|
class ChatFooterComponent {
|
|
1347
1351
|
constructor() {
|
|
1352
|
+
// Services
|
|
1348
1353
|
this.conversationService = inject(ConversationService);
|
|
1349
1354
|
this.evaluationService = inject(EvaluationService);
|
|
1355
|
+
this.agentCardService = inject(CONVERSATION_AI_TOKEN);
|
|
1356
|
+
// Inputs
|
|
1350
1357
|
this.isAIThinking = input(false);
|
|
1351
1358
|
this.evaluatorAgentCard = input();
|
|
1352
1359
|
this.micSettings = input({ useWhisper: true, lang: 'en' });
|
|
1360
|
+
// Outputs
|
|
1353
1361
|
this.sendMessage = output();
|
|
1354
1362
|
this.textInputChanged = output();
|
|
1355
1363
|
// readonly micFinishedEvent = output<any>();
|
|
@@ -1387,7 +1395,7 @@ class ChatFooterComponent {
|
|
|
1387
1395
|
role: ChatRole.User,
|
|
1388
1396
|
};
|
|
1389
1397
|
// Emit the message for parent components that need it
|
|
1390
|
-
this.sendMessage.emit(message);
|
|
1398
|
+
// this.sendMessage.emit(message);
|
|
1391
1399
|
// Clear the input field
|
|
1392
1400
|
this.chatInputControl.setValue('');
|
|
1393
1401
|
// Send the user message to the conversation service
|
|
@@ -1404,32 +1412,28 @@ class ChatFooterComponent {
|
|
|
1404
1412
|
await this.evaluationService.evaluateConversation(messages, this.evaluatorAgentCard());
|
|
1405
1413
|
}
|
|
1406
1414
|
}
|
|
1415
|
+
handleAudioRecorded(event) {
|
|
1416
|
+
console.log(event);
|
|
1417
|
+
this.onMicFinished(event.blob);
|
|
1418
|
+
}
|
|
1407
1419
|
async onMicFinished(eventBlob) {
|
|
1408
1420
|
if (!(eventBlob instanceof Blob)) {
|
|
1409
1421
|
return;
|
|
1410
1422
|
}
|
|
1411
|
-
// Check if audio is too small
|
|
1412
|
-
if (eventBlob.size < 10000) {
|
|
1413
|
-
return;
|
|
1414
|
-
}
|
|
1415
1423
|
this.isUserTalking = false;
|
|
1416
1424
|
this.isGettingTranscription = true;
|
|
1417
1425
|
try {
|
|
1418
1426
|
// Get transcription from audio
|
|
1419
|
-
|
|
1420
|
-
// conversationId: this.agentCard._id,
|
|
1421
|
-
// });
|
|
1422
|
-
// Create message with transcription
|
|
1423
|
-
// const message: ChatMessage = {
|
|
1424
|
-
// content: transcription.text,
|
|
1425
|
-
// role: ChatRole.User,
|
|
1426
|
-
// transcriptionTimestamps: transcription.words,
|
|
1427
|
-
// };
|
|
1427
|
+
const transcription = await this.agentCardService.getAudioTranscriptions(eventBlob, null);
|
|
1428
1428
|
const message = {
|
|
1429
1429
|
content: '',
|
|
1430
1430
|
role: ChatRole.User,
|
|
1431
1431
|
audioUrl: URL.createObjectURL(eventBlob),
|
|
1432
1432
|
};
|
|
1433
|
+
if (transcription) {
|
|
1434
|
+
message.content = transcription.text;
|
|
1435
|
+
message.transcription = transcription;
|
|
1436
|
+
}
|
|
1433
1437
|
// Send message to conversation
|
|
1434
1438
|
// The evaluation will happen automatically in the conversation service
|
|
1435
1439
|
await this.conversationService.sendUserMessage(message);
|
|
@@ -1439,11 +1443,11 @@ class ChatFooterComponent {
|
|
|
1439
1443
|
}
|
|
1440
1444
|
}
|
|
1441
1445
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.4", ngImport: i0, type: ChatFooterComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
1442
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.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 }, evaluatorAgentCard: { classPropertyName: "evaluatorAgentCard", publicName: "evaluatorAgentCard", isSignal: true, isRequired: false, transformFunction: null }, micSettings: { classPropertyName: "micSettings", publicName: "micSettings", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { sendMessage: "sendMessage", textInputChanged: "textInputChanged" }, ngImport: i0, template: "<div class=\"progress-input\">\n <div class=\"input-container\">\n <dc-mic\n style=\"display: flex; align-items: center\"\n (onInterpretedText)=\"setInputText($event)\"\n (onFinished)=\"micFinished($event)\"\n [micSettings]=\"micSettings()\"></dc-mic
|
|
1446
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.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 }, evaluatorAgentCard: { classPropertyName: "evaluatorAgentCard", publicName: "evaluatorAgentCard", isSignal: true, isRequired: false, transformFunction: null }, micSettings: { classPropertyName: "micSettings", publicName: "micSettings", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { sendMessage: "sendMessage", textInputChanged: "textInputChanged" }, ngImport: i0, template: "<div class=\"progress-input\">\n <div class=\"input-container\">\n <app-mic-vad (audioRecorded)=\"handleAudioRecorded($event)\" />\n <!-- <dc-mic\n style=\"display: flex; align-items: center\"\n (onInterpretedText)=\"setInputText($event)\"\n (onFinished)=\"micFinished($event)\"\n [micSettings]=\"micSettings()\"></dc-mic> -->\n\n <textarea pTextarea [formControl]=\"chatInputControl\" (keyup.enter)=\"sendUserMessage()\" rows=\"1\"></textarea>\n\n <p-button (click)=\"sendUserMessage()\" [disabled]=\"isAIThinking() || !chatInputControl.value\" label=\"Enviar\" [rounded]=\"true\" />\n </div>\n\n <div>\n <p-progressbar showValue=\"false\" [value]=\"score()\" [style]=\"{ height: '6px' }\" />\n </div>\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.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: i3.Textarea, selector: "[pTextarea]", inputs: ["autoResize", "variant", "fluid", "pSize"], outputs: ["onResize"] }, { 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: "component", type: MicVadComponent, selector: "app-mic-vad", inputs: ["buttonLabel", "recordingLabel", "listeningLabel", "buttonIcon", "recordingIcon", "buttonClass"], outputs: ["recordingStarted", "recordingStopped", "speechDetected", "speechEnded", "audioRecorded", "error"] }] }); }
|
|
1443
1447
|
}
|
|
1444
1448
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.4", ngImport: i0, type: ChatFooterComponent, decorators: [{
|
|
1445
1449
|
type: Component,
|
|
1446
|
-
args: [{ selector: 'dc-chat-footer', standalone: true, imports: [ReactiveFormsModule, ProgressBarModule, DCMicComponent, TextareaModule, ButtonModule], template: "<div class=\"progress-input\">\n <div class=\"input-container\">\n <dc-mic\n style=\"display: flex; align-items: center\"\n (onInterpretedText)=\"setInputText($event)\"\n (onFinished)=\"micFinished($event)\"\n [micSettings]=\"micSettings()\"></dc-mic
|
|
1450
|
+
args: [{ selector: 'dc-chat-footer', standalone: true, imports: [ReactiveFormsModule, ProgressBarModule, DCMicComponent, TextareaModule, ButtonModule, MicVadComponent], template: "<div class=\"progress-input\">\n <div class=\"input-container\">\n <app-mic-vad (audioRecorded)=\"handleAudioRecorded($event)\" />\n <!-- <dc-mic\n style=\"display: flex; align-items: center\"\n (onInterpretedText)=\"setInputText($event)\"\n (onFinished)=\"micFinished($event)\"\n [micSettings]=\"micSettings()\"></dc-mic> -->\n\n <textarea pTextarea [formControl]=\"chatInputControl\" (keyup.enter)=\"sendUserMessage()\" rows=\"1\"></textarea>\n\n <p-button (click)=\"sendUserMessage()\" [disabled]=\"isAIThinking() || !chatInputControl.value\" label=\"Enviar\" [rounded]=\"true\" />\n </div>\n\n <div>\n <p-progressbar showValue=\"false\" [value]=\"score()\" [style]=\"{ height: '6px' }\" />\n </div>\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"] }]
|
|
1447
1451
|
}] });
|
|
1448
1452
|
|
|
1449
1453
|
const ICONS = {
|
|
@@ -1547,7 +1551,6 @@ class TextHighlighterComponent {
|
|
|
1547
1551
|
this.shouldPlayAudio = computed(() => !!this.message() && this.message()?.shouldPlayAudio);
|
|
1548
1552
|
// Computed signal for message text
|
|
1549
1553
|
this.messageText = computed(() => {
|
|
1550
|
-
console.log('Message text computed', this.message());
|
|
1551
1554
|
const msg = this.message(); // Read the input signal
|
|
1552
1555
|
return msg?.text || msg?.content || 'N/A';
|
|
1553
1556
|
});
|
|
@@ -1941,25 +1944,47 @@ class ChatMessagesListComponent {
|
|
|
1941
1944
|
this.aiIcon = 'assets/default/ai.png';
|
|
1942
1945
|
this.conversationService = inject(ConversationService);
|
|
1943
1946
|
this.inputMessages = input.required();
|
|
1947
|
+
// Inject ElementRef to access the component's host element
|
|
1948
|
+
this.elementRef = inject((ElementRef));
|
|
1944
1949
|
// Get messages and thinking state from the conversation service
|
|
1945
1950
|
this.messages = computed(() => {
|
|
1946
1951
|
// Get the actual array of messages from the signal by calling it as a function
|
|
1947
1952
|
const allMessages = this.conversationService.getMessagesSignal()();
|
|
1953
|
+
console.log('Getting messages', allMessages);
|
|
1948
1954
|
return allMessages.filter((message) => message.role !== ChatRole.System);
|
|
1949
1955
|
});
|
|
1950
1956
|
this.isThinking = this.conversationService.isThinking();
|
|
1957
|
+
// Use effect to automatically scroll to bottom when messages change
|
|
1958
|
+
effect(() => {
|
|
1959
|
+
// Access the messages to create a dependency
|
|
1960
|
+
const messages = this.messages();
|
|
1961
|
+
// Schedule the scroll after the view has been updated
|
|
1962
|
+
setTimeout(() => this.scrollToBottom(), 0);
|
|
1963
|
+
});
|
|
1964
|
+
}
|
|
1965
|
+
ngAfterViewInit() {
|
|
1966
|
+
// Initial scroll to bottom when view is initialized
|
|
1967
|
+
this.scrollToBottom();
|
|
1968
|
+
}
|
|
1969
|
+
// Scroll to the bottom of the component itself with smooth animation
|
|
1970
|
+
scrollToBottom() {
|
|
1971
|
+
const element = this.elementRef.nativeElement;
|
|
1972
|
+
element.scrollTo({
|
|
1973
|
+
top: element.scrollHeight,
|
|
1974
|
+
behavior: 'smooth'
|
|
1975
|
+
});
|
|
1951
1976
|
}
|
|
1952
1977
|
// Track messages by their content and role for efficient rendering
|
|
1953
1978
|
trackByMessage(index, message) {
|
|
1954
1979
|
return `${message.role}-${index}-${message.content.substring(0, 20)}`;
|
|
1955
1980
|
}
|
|
1956
1981
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.4", ngImport: i0, type: ChatMessagesListComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
1957
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.4", type: ChatMessagesListComponent, isStandalone: true, selector: "dc-chat-messages-list", inputs: { chatUserSettings: { classPropertyName: "chatUserSettings", publicName: "chatUserSettings", isSignal: true, isRequired: true, transformFunction: null }, inputMessages: { classPropertyName: "inputMessages", publicName: "inputMessages", isSignal: true, isRequired: true, transformFunction: null } }, ngImport: i0, template: "<div class=\"messages-container\">\n @for (message of messages(); track trackByMessage($index, message)) {\n <dc-chat-message [chatMessage]=\"message\" [chatUserSettings]=\"chatUserSettings()\"> </dc-chat-message>\n } @if (isThinking()) {\n <div class=\"thinking-container\">\n <div class=\"thinking-message\">\n <div class=\"thinking-avatar\">\n <img [src]=\"aiIcon\" alt=\"AI thinking\" class=\"avatar-img\" />\n </div>\n <div class=\"thinking-content\">\n <p-skeleton width=\"80%\" height=\"2rem\"></p-skeleton>\n <p-skeleton width=\"60%\" height=\"2rem\"></p-skeleton>\n </div>\n </div>\n </div>\n }\n</div>\n", styles: [".messages-container{display:flex;flex-direction:column;gap:1rem;padding:1rem;
|
|
1982
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.4", type: ChatMessagesListComponent, isStandalone: true, selector: "dc-chat-messages-list", inputs: { chatUserSettings: { classPropertyName: "chatUserSettings", publicName: "chatUserSettings", isSignal: true, isRequired: true, transformFunction: null }, inputMessages: { classPropertyName: "inputMessages", publicName: "inputMessages", isSignal: true, isRequired: true, transformFunction: null } }, ngImport: i0, template: "<div class=\"messages-container\">\n @for (message of messages(); track trackByMessage($index, message)) {\n <dc-chat-message [chatMessage]=\"message\" [chatUserSettings]=\"chatUserSettings()\"> </dc-chat-message>\n } @if (isThinking()) {\n <div class=\"thinking-container\">\n <div class=\"thinking-message\">\n <div class=\"thinking-avatar\">\n <img [src]=\"aiIcon\" alt=\"AI thinking\" class=\"avatar-img\" />\n </div>\n <div class=\"thinking-content\">\n <p-skeleton width=\"80%\" height=\"2rem\"></p-skeleton>\n <p-skeleton width=\"60%\" height=\"2rem\"></p-skeleton>\n </div>\n </div>\n </div>\n }\n</div>\n", styles: [".messages-container{display:flex;flex-direction:column;gap:1rem;padding:1rem;height:100%}.thinking-container{padding:.5rem 0}.thinking-message{display:flex;gap:1rem;align-items:flex-start}.thinking-avatar{width:40px;height:40px;border-radius:50%;overflow:hidden;flex-shrink:0}.avatar-img{width:100%;height:100%;object-fit:cover}.thinking-content{flex:1;display:flex;flex-direction:column;gap:.5rem}\n"], dependencies: [{ kind: "component", type: ChatMessageComponent, selector: "dc-chat-message", inputs: ["chatMessage", "chatUserSettings"] }, { kind: "ngmodule", type: SkeletonModule }, { kind: "component", type: i1$2.Skeleton, selector: "p-skeleton", inputs: ["styleClass", "style", "shape", "animation", "borderRadius", "size", "width", "height"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
1958
1983
|
}
|
|
1959
1984
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.4", ngImport: i0, type: ChatMessagesListComponent, decorators: [{
|
|
1960
1985
|
type: Component,
|
|
1961
|
-
args: [{ selector: 'dc-chat-messages-list', standalone: true, imports: [ChatMessageComponent, SkeletonModule], changeDetection: ChangeDetectionStrategy.OnPush, template: "<div class=\"messages-container\">\n @for (message of messages(); track trackByMessage($index, message)) {\n <dc-chat-message [chatMessage]=\"message\" [chatUserSettings]=\"chatUserSettings()\"> </dc-chat-message>\n } @if (isThinking()) {\n <div class=\"thinking-container\">\n <div class=\"thinking-message\">\n <div class=\"thinking-avatar\">\n <img [src]=\"aiIcon\" alt=\"AI thinking\" class=\"avatar-img\" />\n </div>\n <div class=\"thinking-content\">\n <p-skeleton width=\"80%\" height=\"2rem\"></p-skeleton>\n <p-skeleton width=\"60%\" height=\"2rem\"></p-skeleton>\n </div>\n </div>\n </div>\n }\n</div>\n", styles: [".messages-container{display:flex;flex-direction:column;gap:1rem;padding:1rem;
|
|
1962
|
-
}] });
|
|
1986
|
+
args: [{ selector: 'dc-chat-messages-list', standalone: true, imports: [ChatMessageComponent, SkeletonModule], changeDetection: ChangeDetectionStrategy.OnPush, template: "<div class=\"messages-container\">\n @for (message of messages(); track trackByMessage($index, message)) {\n <dc-chat-message [chatMessage]=\"message\" [chatUserSettings]=\"chatUserSettings()\"> </dc-chat-message>\n } @if (isThinking()) {\n <div class=\"thinking-container\">\n <div class=\"thinking-message\">\n <div class=\"thinking-avatar\">\n <img [src]=\"aiIcon\" alt=\"AI thinking\" class=\"avatar-img\" />\n </div>\n <div class=\"thinking-content\">\n <p-skeleton width=\"80%\" height=\"2rem\"></p-skeleton>\n <p-skeleton width=\"60%\" height=\"2rem\"></p-skeleton>\n </div>\n </div>\n </div>\n }\n</div>\n", styles: [".messages-container{display:flex;flex-direction:column;gap:1rem;padding:1rem;height:100%}.thinking-container{padding:.5rem 0}.thinking-message{display:flex;gap:1rem;align-items:flex-start}.thinking-avatar{width:40px;height:40px;border-radius:50%;overflow:hidden;flex-shrink:0}.avatar-img{width:100%;height:100%;object-fit:cover}.thinking-content{flex:1;display:flex;flex-direction:column;gap:.5rem}\n"] }]
|
|
1987
|
+
}], ctorParameters: () => [] });
|
|
1963
1988
|
|
|
1964
1989
|
const SpeedDescription = {
|
|
1965
1990
|
1: 'Muy Lento',
|
|
@@ -2137,26 +2162,13 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.4", ngImpor
|
|
|
2137
2162
|
BadgeModule,
|
|
2138
2163
|
SkeletonModule,
|
|
2139
2164
|
TooltipModule,
|
|
2140
|
-
ProviderSelectorComponent
|
|
2165
|
+
ProviderSelectorComponent,
|
|
2141
2166
|
], 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 }\n\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 }\n\n @if (showFeature().speed) {\n <div class=\"settings-section\">\n <p>\n Velocidad ({{ form.controls.speed.value | speedDisplay }})\n <br />\n <p-rating formControlName=\"speed\">\n <ng-template pTemplate=\"onicon\">\n <i class=\"pi pi-caret-right\"></i>\n </ng-template>\n <ng-template pTemplate=\"officon\">\n <i class=\"pi pi-circle\"></i>\n </ng-template>\n </p-rating>\n </p>\n </div>\n }\n\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 }\n\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 }\n\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 @if(isAdmin) {\n <div>\n <hr />\n <b>Admin Section</b>\n <br />\n\n <b>Modelo:</b>\n\n <dc-provider-selector [parentForm]=\"form.controls.model\"></dc-provider-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"] }]
|
|
2142
2167
|
}], ctorParameters: () => [], propDecorators: { tooltipRef: [{
|
|
2143
2168
|
type: ViewChild,
|
|
2144
2169
|
args: ['tooltipRef']
|
|
2145
2170
|
}] } });
|
|
2146
2171
|
|
|
2147
|
-
const EvalResultStringDefinition = `
|
|
2148
|
-
interface EvalResult {
|
|
2149
|
-
score: number; // Score of the user's response 0 to 3
|
|
2150
|
-
feedback: string; // Feedback of the user's understanding of the conversation
|
|
2151
|
-
}`;
|
|
2152
|
-
const DefaultEvaluatorAgentCard = {
|
|
2153
|
-
task: 'Evaluate the user understanding of the lesson',
|
|
2154
|
-
messages: [],
|
|
2155
|
-
expectedResponseType: EvalResultStringDefinition,
|
|
2156
|
-
model: { id: 'gpt-4o-mini', provider: 'openai' },
|
|
2157
|
-
sources: [],
|
|
2158
|
-
};
|
|
2159
|
-
|
|
2160
2172
|
class DCChatComponent {
|
|
2161
2173
|
constructor() {
|
|
2162
2174
|
this.conversationBuilder = inject(DCConversationPromptBuilderService);
|
|
@@ -2165,7 +2177,7 @@ class DCChatComponent {
|
|
|
2165
2177
|
this.userDataExchange = inject(USER_DATA_EXCHANGE);
|
|
2166
2178
|
this.chatUserSettings = this.userDataExchange.getUserChatSettings(); // Default to user data exchange
|
|
2167
2179
|
// TODO: those are optional think if i need them,
|
|
2168
|
-
this.evaluatorAgentCard = input(
|
|
2180
|
+
this.evaluatorAgentCard = input();
|
|
2169
2181
|
this.parseDict = input({});
|
|
2170
2182
|
this.sendMessage = output(); // notifies whatever happened inside the chat
|
|
2171
2183
|
this.micSettings = { useWhisper: true, lang: 'en' };
|
|
@@ -2176,7 +2188,12 @@ class DCChatComponent {
|
|
|
2176
2188
|
this.messages = signal([]);
|
|
2177
2189
|
}
|
|
2178
2190
|
async ngOnInit() {
|
|
2179
|
-
|
|
2191
|
+
if (this.conversationSettings) {
|
|
2192
|
+
await this.conversationService.initConversationWithSettings(this.conversationSettings);
|
|
2193
|
+
}
|
|
2194
|
+
else {
|
|
2195
|
+
await this.conversationService.initConversationWithAgentCard(this.agentCard);
|
|
2196
|
+
}
|
|
2180
2197
|
}
|
|
2181
2198
|
ngOnDestroy() {
|
|
2182
2199
|
// Mark conversation as destroyed to prevent async operations
|
|
@@ -2214,13 +2231,15 @@ class DCChatComponent {
|
|
|
2214
2231
|
await this.ngOnInit();
|
|
2215
2232
|
}
|
|
2216
2233
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.4", ngImport: i0, type: DCChatComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
2217
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "19.2.4", type: DCChatComponent, isStandalone: true, selector: "dc-chat", inputs: { chatUserSettings: { classPropertyName: "chatUserSettings", publicName: "chatUserSettings", isSignal: false, isRequired: false, transformFunction: null }, agentCard: { classPropertyName: "agentCard", publicName: "agentCard", isSignal: false, isRequired: false, transformFunction: null }, evaluatorAgentCard: { classPropertyName: "evaluatorAgentCard", publicName: "evaluatorAgentCard", isSignal: true, isRequired: false, transformFunction: null }, parseDict: { classPropertyName: "parseDict", publicName: "parseDict", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { sendMessage: "sendMessage" }, providers: [DialogService], 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\" [evaluatorAgentCard]=\"evaluatorAgentCard()\"> </dc-chat-footer>\n\n <!-- Info Dialog -->\n <p-dialog [(visible)]=\"isInfoVisible\" [modal]=\"true\" [draggable]=\"false\" [resizable]=\"false\" header=\"Conversation Info\">\n <div class=\"info-content\">\n <h3>Agent Card</h3>\n <pre>{{ agentCard | safeJson }}</pre>\n\n <h3>User Settings</h3>\n <pre>{{ chatUserSettings | safeJson }}</pre>\n </div>\n </p-dialog>\n</div>\n", styles: ["::ng-deep .p-drawer-content{padding:0!important}.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}.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", "evaluatorAgentCard", "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 }); }
|
|
2234
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.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 }, agentCard: { classPropertyName: "agentCard", publicName: "agentCard", isSignal: false, isRequired: false, transformFunction: null }, evaluatorAgentCard: { classPropertyName: "evaluatorAgentCard", publicName: "evaluatorAgentCard", isSignal: true, isRequired: false, transformFunction: null }, parseDict: { classPropertyName: "parseDict", publicName: "parseDict", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { sendMessage: "sendMessage" }, providers: [DialogService], 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\" [evaluatorAgentCard]=\"evaluatorAgentCard()\"> </dc-chat-footer>\n\n <!-- Info Dialog -->\n <p-dialog [(visible)]=\"isInfoVisible\" [modal]=\"true\" [draggable]=\"false\" [resizable]=\"false\" header=\"Conversation Info\">\n <div class=\"info-content\">\n <h3>Agent Card</h3>\n <pre>{{ agentCard | safeJson }}</pre>\n\n <h3>User Settings</h3>\n <pre>{{ chatUserSettings | safeJson }}</pre>\n </div>\n </p-dialog>\n</div>\n", styles: ["::ng-deep .p-drawer-content{padding:0!important}.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}.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", "evaluatorAgentCard", "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 }); }
|
|
2218
2235
|
}
|
|
2219
2236
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.4", ngImport: i0, type: DCChatComponent, decorators: [{
|
|
2220
2237
|
type: Component,
|
|
2221
2238
|
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\" [evaluatorAgentCard]=\"evaluatorAgentCard()\"> </dc-chat-footer>\n\n <!-- Info Dialog -->\n <p-dialog [(visible)]=\"isInfoVisible\" [modal]=\"true\" [draggable]=\"false\" [resizable]=\"false\" header=\"Conversation Info\">\n <div class=\"info-content\">\n <h3>Agent Card</h3>\n <pre>{{ agentCard | safeJson }}</pre>\n\n <h3>User Settings</h3>\n <pre>{{ chatUserSettings | safeJson }}</pre>\n </div>\n </p-dialog>\n</div>\n", styles: ["::ng-deep .p-drawer-content{padding:0!important}.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}.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"] }]
|
|
2222
2239
|
}], propDecorators: { chatUserSettings: [{
|
|
2223
2240
|
type: Input
|
|
2241
|
+
}], conversationSettings: [{
|
|
2242
|
+
type: Input
|
|
2224
2243
|
}], agentCard: [{
|
|
2225
2244
|
type: Input
|
|
2226
2245
|
}] } });
|
|
@@ -3280,6 +3299,19 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.4", ngImpor
|
|
|
3280
3299
|
type: Input
|
|
3281
3300
|
}] } });
|
|
3282
3301
|
|
|
3302
|
+
const EvalResultStringDefinition = `
|
|
3303
|
+
interface EvalResult {
|
|
3304
|
+
score: number; // Score of the user's response 0 to 3
|
|
3305
|
+
feedback: string; // Feedback of the user's understanding of the conversation
|
|
3306
|
+
}`;
|
|
3307
|
+
const DefaultEvaluatorAgentCard = {
|
|
3308
|
+
task: 'Evaluate the user understanding of the lesson',
|
|
3309
|
+
messages: [],
|
|
3310
|
+
expectedResponseType: EvalResultStringDefinition,
|
|
3311
|
+
model: { id: 'gpt-4o-mini', provider: 'openai' },
|
|
3312
|
+
sources: [],
|
|
3313
|
+
};
|
|
3314
|
+
|
|
3283
3315
|
/*
|
|
3284
3316
|
* Public API Surface of ngx-agent-cards
|
|
3285
3317
|
*/
|