@dataclouder/ngx-agent-cards 0.1.15 → 0.1.16
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 +485 -473
- package/fesm2022/dataclouder-ngx-agent-cards.mjs.map +1 -1
- package/lib/components/chat-container/chat-footer/chat-footer.component.d.ts +5 -17
- package/lib/components/chat-container/chat-messages-list/chat-message/chat-message.component.d.ts +1 -0
- package/lib/components/chat-container/chat-settings/dc-conversation-userchat-settings.component.d.ts +2 -1
- package/lib/components/dc-agent-form/agent-task-form/agent-task-form.component.d.ts +8 -13
- package/lib/components/dc-agent-form/dc-agent-card-form.component.d.ts +18 -7
- package/lib/components/dc-agent-form/form-group.service.d.ts +27 -5
- package/lib/components/dc-agent-form/form-group.utils.d.ts +2 -1
- package/lib/components/provider-selector/provider-selector.component.d.ts +27 -9
- package/lib/models/agent.models.d.ts +6 -15
- package/lib/services/conversation.service.d.ts +15 -6
- package/lib/services/default-agent-service.d.ts +4 -8
- package/lib/services/evaluation.service.d.ts +12 -11
- package/package.json +1 -1
- package/lib/lib.md +0 -0
- package/lib/models/models.md +0 -0
- package/ngx-agent-cards.md +0 -0
|
@@ -2,7 +2,7 @@ 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
3
|
import * as i1$1 from '@angular/common';
|
|
4
4
|
import { DOCUMENT, CommonModule, DatePipe, DecimalPipe, NgComponentOutlet } from '@angular/common';
|
|
5
|
-
import { HttpCoreService, AudioSpeed as AudioSpeed$1, TOAST_ALERTS_TOKEN, AudioSpeedReverse, PaginationBase, DCFilterBarComponent, QuickTableComponent } from '@dataclouder/ngx-core';
|
|
5
|
+
import { HttpCoreService, AudioSpeed as AudioSpeed$1, TOAST_ALERTS_TOKEN, EModelQuality, AudioSpeedReverse, ModelQualityOptions, PaginationBase, DCFilterBarComponent, QuickTableComponent } from '@dataclouder/ngx-core';
|
|
6
6
|
import { DynamicDialogRef, DialogService, DynamicDialogConfig, DynamicDialogModule } from 'primeng/dynamicdialog';
|
|
7
7
|
import * as i1$3 from 'primeng/dialog';
|
|
8
8
|
import { DialogModule } from 'primeng/dialog';
|
|
@@ -25,21 +25,21 @@ 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
|
|
28
|
+
import * as i3$1 from 'primeng/radiobutton';
|
|
29
29
|
import { RadioButtonModule } from 'primeng/radiobutton';
|
|
30
30
|
import { RatingModule } from 'primeng/rating';
|
|
31
|
-
import * as i4 from 'primeng/table';
|
|
32
31
|
import { TableModule } from 'primeng/table';
|
|
33
32
|
import { BadgeModule } from 'primeng/badge';
|
|
34
|
-
import * as i5 from 'primeng/tooltip';
|
|
33
|
+
import * as i5$1 from 'primeng/tooltip';
|
|
35
34
|
import { TooltipModule } from 'primeng/tooltip';
|
|
36
|
-
import * as
|
|
37
|
-
import
|
|
35
|
+
import * as i2$2 from 'primeng/dropdown';
|
|
36
|
+
import { DropdownModule } from 'primeng/dropdown';
|
|
37
|
+
import * as i5 from 'primeng/select';
|
|
38
38
|
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$2 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';
|
|
@@ -51,10 +51,8 @@ import * as i8 from 'primeng/popover';
|
|
|
51
51
|
import { PopoverModule } from 'primeng/popover';
|
|
52
52
|
import * as i2$4 from 'primeng/card';
|
|
53
53
|
import { CardModule } from 'primeng/card';
|
|
54
|
-
import * as i3$2 from 'primeng/dropdown';
|
|
55
|
-
import { DropdownModule } from 'primeng/dropdown';
|
|
56
54
|
import { ChipModule } from 'primeng/chip';
|
|
57
|
-
import * as i3$
|
|
55
|
+
import * as i3$3 from 'primeng/listbox';
|
|
58
56
|
import { ListboxModule } from 'primeng/listbox';
|
|
59
57
|
import * as i9 from 'primeng/inputgroupaddon';
|
|
60
58
|
import { InputGroupAddonModule } from 'primeng/inputgroupaddon';
|
|
@@ -64,7 +62,7 @@ import * as i1$4 from 'primeng/paginator';
|
|
|
64
62
|
import { PaginatorModule } from 'primeng/paginator';
|
|
65
63
|
import * as i2$5 from 'primeng/speeddial';
|
|
66
64
|
import { SpeedDialModule } from 'primeng/speeddial';
|
|
67
|
-
import * as i4
|
|
65
|
+
import * as i4 from 'primeng/tag';
|
|
68
66
|
import { TagModule } from 'primeng/tag';
|
|
69
67
|
|
|
70
68
|
const characterCardStringDataDefinition = `
|
|
@@ -115,19 +113,6 @@ interface SimpleEvalResult {
|
|
|
115
113
|
score: number; // Score of the user's response 0 to 3
|
|
116
114
|
feedback: string; // Feedback of the user's understanding of the conversation
|
|
117
115
|
}`;
|
|
118
|
-
var EModelQuality$1;
|
|
119
|
-
(function (EModelQuality) {
|
|
120
|
-
EModelQuality["FAST"] = "fast";
|
|
121
|
-
EModelQuality["BALANCED"] = "balanced";
|
|
122
|
-
EModelQuality["SMART"] = "smart";
|
|
123
|
-
EModelQuality["SMART_THINKING"] = "smart-thinking";
|
|
124
|
-
})(EModelQuality$1 || (EModelQuality$1 = {}));
|
|
125
|
-
const ModelQualityOptions = [
|
|
126
|
-
{ label: 'Fast', value: EModelQuality$1.FAST },
|
|
127
|
-
{ label: 'Balanced', value: EModelQuality$1.BALANCED },
|
|
128
|
-
{ label: 'Smart', value: EModelQuality$1.SMART },
|
|
129
|
-
{ label: 'Smart Thinking', value: EModelQuality$1.SMART_THINKING },
|
|
130
|
-
];
|
|
131
116
|
var EAccountsPlatform;
|
|
132
117
|
(function (EAccountsPlatform) {
|
|
133
118
|
EAccountsPlatform["Tiktok"] = "tiktok";
|
|
@@ -1396,20 +1381,341 @@ function buildObjectTTSRequest(message, settings = {}) {
|
|
|
1396
1381
|
};
|
|
1397
1382
|
}
|
|
1398
1383
|
|
|
1399
|
-
|
|
1384
|
+
const Endpoints = {
|
|
1385
|
+
// Existing
|
|
1386
|
+
GenerateImage: 'api/agent-cards-generate/generate-image-card', // For completeAgentCard, generateImageForCard, generateMainImage
|
|
1387
|
+
AgentChat: 'api/agent-cards/chat', // For callChatCompletion, callInstruction
|
|
1388
|
+
// New
|
|
1389
|
+
Conversation: 'api/agent-cards/conversation', // For findById, getAll, save (POST/PUT), delete
|
|
1390
|
+
ConversationQuery: 'api/agent-cards/conversation/query', // For filterConversationCards, findAgentCardByTitle
|
|
1391
|
+
UserCards: 'api/agent-cards/user-cards', // For findFilteredAgentCards
|
|
1392
|
+
VertexTTS: 'api/vertex/tts/synthesize',
|
|
1393
|
+
ListModels: 'api/agent-cards/models', // For getListModels
|
|
1394
|
+
TranslateConversation: 'api/agent-cards/translate', // For translateConversation
|
|
1395
|
+
TranscribeAudio: 'api/audio/transcribe/whisper', // For getAudioTranscriptions
|
|
1396
|
+
// UserChatSettings: 'api/users/chat-settings', // Example for get/saveConversationUserChatSettings if not throwing error
|
|
1397
|
+
};
|
|
1398
|
+
// ♦️ Finish this will be the default so i dont need to create a new one everytime
|
|
1399
|
+
class DefaultAgentCardsService {
|
|
1400
|
+
constructor() {
|
|
1401
|
+
this.httpService = inject(HttpCoreService);
|
|
1402
|
+
}
|
|
1403
|
+
generateMainImage(idCard) {
|
|
1404
|
+
return this.httpService.get(`${Endpoints.GenerateImage}/${idCard}`, 'primary');
|
|
1405
|
+
}
|
|
1406
|
+
completeAgentCard(idCard) {
|
|
1407
|
+
// TODO: i need a default method to do this.
|
|
1408
|
+
return this.httpService.get(`${Endpoints.GenerateImage}/${idCard}`, 'primary');
|
|
1409
|
+
}
|
|
1410
|
+
async callChatCompletion(conversation) {
|
|
1411
|
+
let messages = conversation.messages.map((m) => ({ content: m.content, role: m.role }));
|
|
1412
|
+
messages = messages.filter((m) => m.role != ChatRole.AssistantHelper);
|
|
1413
|
+
const conversationFiltered = { ...conversation, messages };
|
|
1414
|
+
if (conversation.returnJson) {
|
|
1415
|
+
return await this.httpService.post(`${Endpoints.AgentChat}?returnJson=true`, conversationFiltered, 'primary');
|
|
1416
|
+
}
|
|
1417
|
+
else {
|
|
1418
|
+
return await this.httpService.post(`${Endpoints.AgentChat}`, conversationFiltered, 'primary');
|
|
1419
|
+
}
|
|
1420
|
+
}
|
|
1421
|
+
async findConversationCardByID(id) {
|
|
1422
|
+
return this.httpService.get(`${Endpoints.Conversation}/${id}`, 'primary');
|
|
1423
|
+
}
|
|
1424
|
+
async filterConversationCards(filters) {
|
|
1425
|
+
return this.httpService.post(`${Endpoints.ConversationQuery}`, filters, 'primary');
|
|
1426
|
+
}
|
|
1427
|
+
async getAllConversationCards() {
|
|
1428
|
+
return this.httpService.get(`${Endpoints.Conversation}`, 'primary');
|
|
1429
|
+
}
|
|
1430
|
+
async findFilteredAgentCards(paginator) {
|
|
1431
|
+
// Note: Original service in agent-cards.service.ts applies user-specific filters
|
|
1432
|
+
// using UserService. This default implementation omits that logic as UserService is not available here.
|
|
1433
|
+
return this.httpService.post(`${Endpoints.UserCards}`, paginator, 'primary');
|
|
1434
|
+
}
|
|
1435
|
+
async findAgentCardByTitle(title) {
|
|
1436
|
+
const filters = { filters: { title } };
|
|
1437
|
+
const response = await this.httpService.post(`${Endpoints.ConversationQuery}`, filters, 'primary');
|
|
1438
|
+
return response.rows[0];
|
|
1439
|
+
}
|
|
1440
|
+
async saveConversationCard(conversation) {
|
|
1441
|
+
const id = conversation.id || conversation._id;
|
|
1442
|
+
if (id) {
|
|
1443
|
+
return this.httpService.put(`${Endpoints.Conversation}/${id}`, conversation, 'primary');
|
|
1444
|
+
}
|
|
1445
|
+
else {
|
|
1446
|
+
// Note: Original service in agent-cards.service.ts sets default language using UserService.
|
|
1447
|
+
// This default implementation omits that logic.
|
|
1448
|
+
return this.httpService.post(`${Endpoints.Conversation}`, conversation, 'primary');
|
|
1449
|
+
}
|
|
1450
|
+
}
|
|
1451
|
+
async deleteConversationCard(id) {
|
|
1452
|
+
// Assuming the backend returns the deleted card, or this matches an expected API contract.
|
|
1453
|
+
// HttpCoreService.delete by default returns Promise<DeletedData>.
|
|
1454
|
+
return this.httpService.delete(`${Endpoints.Conversation}/${id}`, 'primary');
|
|
1455
|
+
}
|
|
1456
|
+
async getTextAudioFile(tts) {
|
|
1457
|
+
// Note: Original service in agent-cards.service.ts used 'node' as host.
|
|
1458
|
+
// HttpCoreService manages hosts via its configuration or per-call parameter. Using 'primary'.
|
|
1459
|
+
const httpResponse = await this.httpService.postFileAndGetBlob(`${Endpoints.VertexTTS}`, tts, 'primary');
|
|
1460
|
+
const audioData = { blobUrl: '', transcription: null };
|
|
1461
|
+
const transcriptionHeader = httpResponse.headers.get('transcription');
|
|
1462
|
+
if (transcriptionHeader) {
|
|
1463
|
+
try {
|
|
1464
|
+
audioData.transcription = JSON.parse(transcriptionHeader);
|
|
1465
|
+
}
|
|
1466
|
+
catch (e) {
|
|
1467
|
+
console.error('Failed to parse transcription header:', e, transcriptionHeader);
|
|
1468
|
+
// Optionally handle or log this error more robustly
|
|
1469
|
+
}
|
|
1470
|
+
}
|
|
1471
|
+
if (httpResponse.body) {
|
|
1472
|
+
audioData.blobUrl = window.URL.createObjectURL(httpResponse.body);
|
|
1473
|
+
}
|
|
1474
|
+
return audioData;
|
|
1475
|
+
}
|
|
1476
|
+
async getConversationUserChatSettings() {
|
|
1477
|
+
// Original implementation in agent-cards.service.ts relies on UserService.
|
|
1478
|
+
// DefaultAgentCardsService does not have UserService injected.
|
|
1479
|
+
// This method needs to be adapted, e.g., by fetching settings from a generic endpoint
|
|
1480
|
+
// or by injecting a similar service.
|
|
1481
|
+
throw new Error('Method getConversationUserChatSettings cannot be implemented in DefaultAgentCardsService without UserService or an alternative settings source.');
|
|
1482
|
+
}
|
|
1483
|
+
async getListModels(provider) {
|
|
1484
|
+
// Note: Original service in agent-cards.service.ts used 'node' as host. Using 'primary'.
|
|
1485
|
+
return this.httpService.get(`${Endpoints.ListModels}?provider=${provider}`, 'primary');
|
|
1486
|
+
}
|
|
1487
|
+
async translateConversation(currentLang, targetLang, id) {
|
|
1488
|
+
// Note: Original service in agent-cards.service.ts used 'python' as host. Using 'primary'.
|
|
1489
|
+
// Parameter name in abstract class is 'id', base service used 'idCard'. Using 'id'.
|
|
1490
|
+
return this.httpService.post(`${Endpoints.TranslateConversation}`, { currentLang, targetLang, idCard: id }, // Sending as idCard as per base service's DTO
|
|
1491
|
+
'primary');
|
|
1492
|
+
}
|
|
1493
|
+
async getAudioTranscriptions(audio, options) {
|
|
1494
|
+
// Note: Original service in agent-cards.service.ts used 'node' as host. Using 'primary'.
|
|
1495
|
+
// 'options' parameter corresponds to 'metadata' in the original service.
|
|
1496
|
+
return this.httpService.uploadFile(`${Endpoints.TranscribeAudio}`, audio, options, 'primary');
|
|
1497
|
+
}
|
|
1498
|
+
async callInstruction(prompt, model) {
|
|
1499
|
+
const messages = [{ content: prompt, role: ChatRole.User }];
|
|
1500
|
+
const conversationDto = { messages, model };
|
|
1501
|
+
// Note: Original service in agent-cards.service.ts used 'python' as host. Using 'primary'.
|
|
1502
|
+
return this.httpService.post(`${Endpoints.AgentChat}`, conversationDto, 'primary');
|
|
1503
|
+
}
|
|
1504
|
+
async saveConversationUserChatSettings(settings) {
|
|
1505
|
+
// Original implementation in agent-cards.service.ts relies on UserService and ToastService.
|
|
1506
|
+
// DefaultAgentCardsService does not have these services injected.
|
|
1507
|
+
// This method needs to be adapted, e.g., by POSTing settings to a generic endpoint.
|
|
1508
|
+
throw new Error('Method saveConversationUserChatSettings cannot be implemented in DefaultAgentCardsService without UserService/ToastService or an alternative.');
|
|
1509
|
+
}
|
|
1510
|
+
generateImageForCard(idCard) {
|
|
1511
|
+
return this.httpService.get(`${Endpoints.GenerateImage}/${idCard}`, 'primary');
|
|
1512
|
+
}
|
|
1513
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.4", ngImport: i0, type: DefaultAgentCardsService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
1514
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.2.4", ngImport: i0, type: DefaultAgentCardsService, providedIn: 'root' }); }
|
|
1515
|
+
}
|
|
1516
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.4", ngImport: i0, type: DefaultAgentCardsService, decorators: [{
|
|
1517
|
+
type: Injectable,
|
|
1518
|
+
args: [{
|
|
1519
|
+
providedIn: 'root',
|
|
1520
|
+
}]
|
|
1521
|
+
}] });
|
|
1522
|
+
|
|
1523
|
+
class EvaluationService {
|
|
1400
1524
|
constructor() {
|
|
1401
1525
|
// Services
|
|
1402
|
-
this.
|
|
1526
|
+
this.defaultAgentCardService = inject(DefaultAgentCardsService);
|
|
1527
|
+
this.toastService = inject(TOAST_ALERTS_TOKEN);
|
|
1528
|
+
// Signals
|
|
1529
|
+
this.scoreSignal = signal(0); // Only Score
|
|
1530
|
+
this.evaluationResultSignal = signal(null); // Not sure if ill give some use
|
|
1531
|
+
}
|
|
1532
|
+
async evaluateGoal(goalTask, messages) {
|
|
1533
|
+
if (!goalTask.task) {
|
|
1534
|
+
goalTask.task = 'Evaluate this conversation the goal is keep the conversation on topic consistency.';
|
|
1535
|
+
}
|
|
1536
|
+
const evaluator = {
|
|
1537
|
+
task: goalTask.task,
|
|
1538
|
+
expectedResponseType: 'Response should be in next JSON format: {"score": number, "text": string}, score is a number between 0 and 3, text is concrete feedback in less than 25 words.',
|
|
1539
|
+
model: goalTask.model || { quality: EModelQuality.FAST },
|
|
1540
|
+
};
|
|
1541
|
+
const evaluationResult = await this.evaluateConversation(messages, evaluator, ContextType.AllConversation);
|
|
1542
|
+
this.updateScore(evaluationResult.score || 0);
|
|
1543
|
+
console.log(' ♦️ Goal Evaluation Result:', evaluationResult, this.scoreSignal());
|
|
1544
|
+
// Evaluation can return evything check i can standarize this.
|
|
1545
|
+
this.toastService.info({
|
|
1546
|
+
title: 'Score ' + evaluationResult?.text,
|
|
1547
|
+
subtitle: `Added ${evaluationResult?.score} points`,
|
|
1548
|
+
});
|
|
1549
|
+
return evaluationResult;
|
|
1550
|
+
}
|
|
1551
|
+
async evaluateConversation(messages, task, context = ContextType.AllConversation) {
|
|
1552
|
+
// Filter conversation to only include user and assistant messages
|
|
1553
|
+
const conversationMessages = messages.filter((message) => [ChatRole.User, ChatRole.Assistant].includes(message.role));
|
|
1554
|
+
// Format conversation for evaluation
|
|
1555
|
+
const conversationMessagesString = this.getConversationString(conversationMessages, context);
|
|
1556
|
+
// Create evaluation prompt
|
|
1557
|
+
let instructions = `
|
|
1558
|
+
Please replay to this task:
|
|
1559
|
+
${task.task}
|
|
1560
|
+
This is the conversation history:
|
|
1561
|
+
<Context>
|
|
1562
|
+
${conversationMessagesString}
|
|
1563
|
+
<End Context>
|
|
1564
|
+
`;
|
|
1565
|
+
if (task.expectedResponseType) {
|
|
1566
|
+
instructions += `\nExpected response type: ${task.expectedResponseType}`;
|
|
1567
|
+
}
|
|
1568
|
+
else {
|
|
1569
|
+
instructions += `\nExpected response type: {"score": number, "text": string}`;
|
|
1570
|
+
}
|
|
1571
|
+
// Send evaluation request
|
|
1572
|
+
const evaluationMessages = [{ content: instructions, role: ChatRole.User }];
|
|
1573
|
+
// Not sure what strategy use, if works types should be definied in definitions, generarally response will be score, and feedback.
|
|
1574
|
+
const response = await this.defaultAgentCardService.callChatCompletion({
|
|
1575
|
+
messages: evaluationMessages,
|
|
1576
|
+
returnJson: true,
|
|
1577
|
+
model: task.model || { quality: EModelQuality.FAST },
|
|
1578
|
+
});
|
|
1579
|
+
// Extract JSON from response
|
|
1580
|
+
const jsonData = response.content;
|
|
1581
|
+
this.evaluationResultSignal.set(jsonData);
|
|
1582
|
+
return jsonData;
|
|
1583
|
+
}
|
|
1584
|
+
getConversationString(messages, contextType) {
|
|
1585
|
+
const contextMessages = this.getContextMessages(messages, contextType);
|
|
1586
|
+
return contextMessages.map((message) => `${message.role}: ${message.content}`).join('\n');
|
|
1587
|
+
}
|
|
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
|
+
/**
|
|
1655
|
+
* Diference with evaluateConversation is task is already processed here.
|
|
1656
|
+
* Evaluates a conversation context based on a specific task and attaches the result to a designated message.
|
|
1657
|
+
* @param agentTask The task definition for the evaluation.
|
|
1658
|
+
* @param messageToUpdate The specific ChatMessage object (user or assistant) to attach the evaluation results to.
|
|
1659
|
+
* @param contextType Determines which part of the conversation history to send as context (default: AllConversation).
|
|
1660
|
+
* @returns The JSON result of the evaluation.
|
|
1661
|
+
*/
|
|
1662
|
+
async evaluateWithTask(agentTask) {
|
|
1663
|
+
// You Already Generate Task with all data needed..
|
|
1664
|
+
const requestMessages = [{ role: ChatRole.User, content: agentTask.task }];
|
|
1665
|
+
try {
|
|
1666
|
+
const response = await this.defaultAgentCardService.callChatCompletion({ messages: requestMessages, model: agentTask.model });
|
|
1667
|
+
// let jsonData = extractJsonFromResponse(response.content);
|
|
1668
|
+
let jsonData = response.content;
|
|
1669
|
+
if (typeof jsonData === 'string') {
|
|
1670
|
+
return { text: jsonData };
|
|
1671
|
+
}
|
|
1672
|
+
return jsonData;
|
|
1673
|
+
}
|
|
1674
|
+
catch (error) {
|
|
1675
|
+
console.error('Error during evaluateWithTask:', error);
|
|
1676
|
+
return null;
|
|
1677
|
+
}
|
|
1678
|
+
}
|
|
1679
|
+
updateScore(additionalScore) {
|
|
1680
|
+
this.scoreSignal.update((currentScore) => {
|
|
1681
|
+
const newScore = currentScore + additionalScore * 10;
|
|
1682
|
+
return newScore > 100 ? 100 : newScore;
|
|
1683
|
+
});
|
|
1684
|
+
}
|
|
1685
|
+
resetScore() {
|
|
1686
|
+
this.scoreSignal.set(0);
|
|
1687
|
+
}
|
|
1688
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.4", ngImport: i0, type: EvaluationService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
1689
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.2.4", ngImport: i0, type: EvaluationService, providedIn: 'root' }); }
|
|
1690
|
+
}
|
|
1691
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.4", ngImport: i0, type: EvaluationService, decorators: [{
|
|
1692
|
+
type: Injectable,
|
|
1693
|
+
args: [{
|
|
1694
|
+
providedIn: 'root',
|
|
1695
|
+
}]
|
|
1696
|
+
}] });
|
|
1697
|
+
|
|
1698
|
+
const EvaluationStructureString = `
|
|
1699
|
+
{
|
|
1700
|
+
"text": "",
|
|
1701
|
+
"score": 0,
|
|
1702
|
+
}
|
|
1703
|
+
`;
|
|
1704
|
+
class ConversationService {
|
|
1705
|
+
constructor() {
|
|
1706
|
+
this.defaultAgentCardService = inject(DefaultAgentCardsService);
|
|
1403
1707
|
this.messageProcessingService = inject(MessageProcessingService);
|
|
1404
1708
|
this.conversationBuilder = inject(DCConversationPromptBuilderService);
|
|
1405
1709
|
this.userDataExchange = inject(USER_DATA_EXCHANGE);
|
|
1710
|
+
this.evaluationService = inject(EvaluationService);
|
|
1406
1711
|
// State Signals
|
|
1407
1712
|
this.messagesSignal = signal([]);
|
|
1408
1713
|
this.isThinkingSignal = signal(false);
|
|
1409
1714
|
this.conversationSettingsSignal = signal(null);
|
|
1715
|
+
this.conversationFlowSignal = signal(null);
|
|
1410
1716
|
this.isDestroyedSignal = signal(false);
|
|
1411
1717
|
this.micStatusSignal = signal('ready');
|
|
1412
|
-
this.currentAudioStatus = signal(null);
|
|
1718
|
+
this.currentAudioStatus = signal(null); // Orchestrator notifies about audio state
|
|
1413
1719
|
this.wordClickedSignal = signal(null); // Signal for clicked word
|
|
1414
1720
|
// Var State
|
|
1415
1721
|
this.avatarImages = {
|
|
@@ -1478,21 +1784,25 @@ class ConversationService {
|
|
|
1478
1784
|
conversationSettings.model = userSettings.model;
|
|
1479
1785
|
}
|
|
1480
1786
|
}
|
|
1481
|
-
setupConversationWithAgentCard(agentCard, parseDict = null) {
|
|
1482
|
-
//
|
|
1483
|
-
this.avatarImages.assistantImg = agentCard?.assets?.image?.url || this.avatarImages.assistantImg;
|
|
1787
|
+
setupConversationWithAgentCard(agentCard, parseDict = null, conversationFlow = null) {
|
|
1788
|
+
// Basically extract settings and flow from agent card, and overrider with user seetings is needed.
|
|
1789
|
+
this.avatarImages.assistantImg = agentCard?.assets?.image?.url || this.avatarImages.assistantImg; // Set user AI avatar image
|
|
1484
1790
|
const conversationSettings = this.conversationBuilder.buildConversationSettings(agentCard, parseDict);
|
|
1485
1791
|
// Here i need some rules to see when i will override and what.
|
|
1486
1792
|
this.overrideSettingsByUserSettings(conversationSettings);
|
|
1487
1793
|
this.conversationSettingsSignal.set(conversationSettings);
|
|
1794
|
+
// this.conversationFlowSignal.set(this.conversationBuilder.buildConversationFlow(agentCard, parseDict));
|
|
1795
|
+
if (conversationFlow) {
|
|
1796
|
+
this.conversationFlowSignal.set(conversationFlow);
|
|
1797
|
+
}
|
|
1488
1798
|
}
|
|
1489
|
-
async initConversationWithSettings(conversationSettings) {
|
|
1799
|
+
async initConversationWithSettings(conversationSettings, conversationFlow) {
|
|
1490
1800
|
this.overrideSettingsByUserSettings(conversationSettings);
|
|
1491
1801
|
this.conversationSettingsSignal.set(conversationSettings);
|
|
1802
|
+
this.conversationFlowSignal.set(conversationFlow);
|
|
1492
1803
|
await this.initConversation();
|
|
1493
1804
|
}
|
|
1494
1805
|
async initConversation() {
|
|
1495
|
-
// Set user avatar images
|
|
1496
1806
|
this.avatarImages.userImg = this.userDataExchange.getUserDataExchange().imgUrl;
|
|
1497
1807
|
const conversationSettings = this.conversationSettingsSignal();
|
|
1498
1808
|
for (const i in conversationSettings.messages) {
|
|
@@ -1510,6 +1820,7 @@ class ConversationService {
|
|
|
1510
1820
|
if (messageIndex !== -1) {
|
|
1511
1821
|
conversationSettings.messages[messageIndex] = processedMessage;
|
|
1512
1822
|
}
|
|
1823
|
+
this.runAssistantTrigger(firstAssistantMsg);
|
|
1513
1824
|
}
|
|
1514
1825
|
else if (conversationSettings?.autoStart) {
|
|
1515
1826
|
// Auto-start conversation if configured
|
|
@@ -1517,8 +1828,8 @@ class ConversationService {
|
|
|
1517
1828
|
}
|
|
1518
1829
|
}
|
|
1519
1830
|
// Initialize conversation
|
|
1520
|
-
async initConversationWithAgentCard(agentCard, parseDict = null) {
|
|
1521
|
-
this.setupConversationWithAgentCard(agentCard, parseDict);
|
|
1831
|
+
async initConversationWithAgentCard(agentCard, parseDict = null, conversationFlow = null) {
|
|
1832
|
+
this.setupConversationWithAgentCard(agentCard, parseDict, conversationFlow);
|
|
1522
1833
|
await this.initConversation();
|
|
1523
1834
|
}
|
|
1524
1835
|
/**
|
|
@@ -1529,15 +1840,14 @@ class ConversationService {
|
|
|
1529
1840
|
* @param updateId Optional ID if this message should update an existing one (e.g., transcription added).
|
|
1530
1841
|
* @returns A promise resolving to an object containing the user message ID and the assistant message ID (or null if an error occurred).
|
|
1531
1842
|
*/
|
|
1532
|
-
async
|
|
1843
|
+
async prepareUserMsnAndSend(message, updateId = null) {
|
|
1533
1844
|
if (this.isThinkingSignal()) {
|
|
1534
1845
|
console.warn('AI is already thinking, message dropped.');
|
|
1535
1846
|
return null; // Indicate message was not sent due to AI being busy
|
|
1536
1847
|
}
|
|
1537
1848
|
let userMessageId;
|
|
1538
|
-
// Add or update the user message
|
|
1539
1849
|
if (updateId) {
|
|
1540
|
-
//
|
|
1850
|
+
// if you pass updateId means message exists and you want to update it.
|
|
1541
1851
|
const messageToUpdate = { ...message, messageId: updateId };
|
|
1542
1852
|
const updated = this.updateMessage(updateId, messageToUpdate);
|
|
1543
1853
|
if (!updated) {
|
|
@@ -1548,7 +1858,7 @@ class ConversationService {
|
|
|
1548
1858
|
userMessageId = updateId;
|
|
1549
1859
|
}
|
|
1550
1860
|
else {
|
|
1551
|
-
// Process and add the new message
|
|
1861
|
+
// Means is new meessage, Process and add the new message
|
|
1552
1862
|
const processedMessage = this.messageProcessingService.processMessage(message, this.conversationSettingsSignal(), this.avatarImages);
|
|
1553
1863
|
// Ensure ID exists (processMessage should handle this, but fallback just in case)
|
|
1554
1864
|
processedMessage.messageId = processedMessage.messageId || nanoid();
|
|
@@ -1558,19 +1868,20 @@ class ConversationService {
|
|
|
1558
1868
|
// Set thinking state and get AI response
|
|
1559
1869
|
this.isThinkingSignal.set(true);
|
|
1560
1870
|
let assistantMessageId = null;
|
|
1871
|
+
// Trigger are asyn Run triggers in background
|
|
1872
|
+
this.runUserFlowEvaluations({ messageId: userMessageId, role: ChatRole.User });
|
|
1561
1873
|
try {
|
|
1562
1874
|
assistantMessageId = await this.sendCurrentConversation();
|
|
1563
1875
|
}
|
|
1564
1876
|
catch (error) {
|
|
1565
1877
|
console.error('Error sending conversation to AI:', error);
|
|
1566
|
-
// Handle error appropriately, maybe set a specific state or message
|
|
1878
|
+
// TODO: Handle error appropriately, maybe set a specific state or message
|
|
1567
1879
|
}
|
|
1568
1880
|
finally {
|
|
1569
1881
|
this.isThinkingSignal.set(false);
|
|
1570
1882
|
}
|
|
1571
1883
|
return { userMessageId, assistantMessageId };
|
|
1572
1884
|
}
|
|
1573
|
-
// Process assistant message
|
|
1574
1885
|
// Send current conversation to AI
|
|
1575
1886
|
async sendCurrentConversation() {
|
|
1576
1887
|
if (this.isDestroyedSignal()) {
|
|
@@ -1596,16 +1907,16 @@ class ConversationService {
|
|
|
1596
1907
|
modelQuality: conversationSettings.modelQuality,
|
|
1597
1908
|
};
|
|
1598
1909
|
this.isThinkingSignal.set(true);
|
|
1599
|
-
const response = await this.
|
|
1910
|
+
const response = await this.defaultAgentCardService.callChatCompletion(conversation);
|
|
1600
1911
|
if (!response) {
|
|
1601
1912
|
console.error('No message returned from AI, is your service working?');
|
|
1602
1913
|
throw new Error('No message returned from AI');
|
|
1603
1914
|
}
|
|
1604
1915
|
// Process response
|
|
1605
|
-
const newMessage = this.messageProcessingService.processMessage(response, conversationSettings, this.avatarImages);
|
|
1606
|
-
// Add to messages
|
|
1916
|
+
const newMessage = this.messageProcessingService.processMessage({ content: response.content, role: ChatRole.Assistant }, conversationSettings, this.avatarImages);
|
|
1607
1917
|
this.addMessage(newMessage);
|
|
1608
1918
|
this.isThinkingSignal.set(false);
|
|
1919
|
+
this.runAssistantTrigger(newMessage); // Not waiting should be parallel.
|
|
1609
1920
|
return newMessage.messageId;
|
|
1610
1921
|
}
|
|
1611
1922
|
// Reset conversation
|
|
@@ -1616,7 +1927,31 @@ class ConversationService {
|
|
|
1616
1927
|
async getTTSFile(message) {
|
|
1617
1928
|
const userChatSettings = await this.userDataExchange.getUserChatSettings();
|
|
1618
1929
|
const ttsRequest = buildObjectTTSRequest(message, userChatSettings);
|
|
1619
|
-
return this.
|
|
1930
|
+
return this.defaultAgentCardService.getTextAudioFile(ttsRequest);
|
|
1931
|
+
}
|
|
1932
|
+
async runAssistantTrigger(message) {
|
|
1933
|
+
const trigger = this.conversationFlowSignal().triggerTasks.onAssistantMessage;
|
|
1934
|
+
if (trigger) {
|
|
1935
|
+
trigger.task += ' Here is the text: ' + (message.text || message.content);
|
|
1936
|
+
const result = await this.evaluationService.evaluateWithTask(trigger);
|
|
1937
|
+
console.log('Assistant trigger evaluation result:', result);
|
|
1938
|
+
message.evaluation = result;
|
|
1939
|
+
this.updateMessage(message.messageId, message);
|
|
1940
|
+
}
|
|
1941
|
+
}
|
|
1942
|
+
async runUserFlowEvaluations(message) {
|
|
1943
|
+
const goal = this.conversationFlowSignal().goal;
|
|
1944
|
+
const trigger = this.conversationFlowSignal().triggerTasks.onUserMessage;
|
|
1945
|
+
// 1) Run Goal Evaluation
|
|
1946
|
+
this.evaluationService.evaluateGoal(goal, this.messagesSignal());
|
|
1947
|
+
// 2) Run User Trigger Evaluation
|
|
1948
|
+
if (trigger) {
|
|
1949
|
+
this.evaluationService.evaluateConversation(this.messagesSignal(), trigger, ContextType.LastUserAndPreviousAssistant).then((evaluation) => {
|
|
1950
|
+
message.evaluation = evaluation;
|
|
1951
|
+
this.updateMessage(message.messageId, message);
|
|
1952
|
+
console.log('Trigger evaluation result:', evaluation);
|
|
1953
|
+
});
|
|
1954
|
+
}
|
|
1620
1955
|
}
|
|
1621
1956
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.4", ngImport: i0, type: ConversationService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
1622
1957
|
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.2.4", ngImport: i0, type: ConversationService, providedIn: 'root' }); }
|
|
@@ -1628,237 +1963,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.4", ngImpor
|
|
|
1628
1963
|
}]
|
|
1629
1964
|
}] });
|
|
1630
1965
|
|
|
1631
|
-
function extractJsonFromResponse(content) {
|
|
1632
|
-
// Match everything between the first { and last } OR first [ and last ]
|
|
1633
|
-
const jsonMatch = content.match(/(\{[\s\S]*?\}|\[[\s\S]*?\])/);
|
|
1634
|
-
if (!jsonMatch)
|
|
1635
|
-
return null;
|
|
1636
|
-
try {
|
|
1637
|
-
return JSON.parse(jsonMatch[0]);
|
|
1638
|
-
}
|
|
1639
|
-
catch (error) {
|
|
1640
|
-
console.error('Error parsing JSON:', error);
|
|
1641
|
-
return null;
|
|
1642
|
-
}
|
|
1643
|
-
}
|
|
1644
|
-
|
|
1645
|
-
class EvaluationService {
|
|
1646
|
-
constructor() {
|
|
1647
|
-
// Services
|
|
1648
|
-
this.agentCardService = inject(CONVERSATION_AI_TOKEN);
|
|
1649
|
-
this.toastService = inject(TOAST_ALERTS_TOKEN);
|
|
1650
|
-
this.conversationService = inject(ConversationService); // Inject ConversationService
|
|
1651
|
-
// Signals
|
|
1652
|
-
this.scoreSignal = signal(0);
|
|
1653
|
-
this.evaluationResultSignal = signal(null);
|
|
1654
|
-
}
|
|
1655
|
-
// Get score as a signal
|
|
1656
|
-
getScore() {
|
|
1657
|
-
return this.scoreSignal;
|
|
1658
|
-
}
|
|
1659
|
-
setScore(score) {
|
|
1660
|
-
this.scoreSignal.set(score);
|
|
1661
|
-
}
|
|
1662
|
-
// Get evaluation result as a signal
|
|
1663
|
-
getEvaluationResult() {
|
|
1664
|
-
return this.evaluationResultSignal;
|
|
1665
|
-
}
|
|
1666
|
-
// Evaluate conversation
|
|
1667
|
-
async evaluateConversation(messages, evaluator) {
|
|
1668
|
-
// Filter conversation to only include user and assistant messages
|
|
1669
|
-
const conversationMessages = messages.filter((message) => [ChatRole.User, ChatRole.Assistant].includes(message.role));
|
|
1670
|
-
// Check if there are any user messages to evaluate
|
|
1671
|
-
const userMessages = conversationMessages.filter((message) => message.role === ChatRole.User);
|
|
1672
|
-
if (userMessages.length <= 0) {
|
|
1673
|
-
console.log('No messages to evaluate', conversationMessages);
|
|
1674
|
-
return;
|
|
1675
|
-
}
|
|
1676
|
-
const lastUserMessage = userMessages[userMessages.length - 1]; // Get the last user message for update
|
|
1677
|
-
// Format conversation for evaluation
|
|
1678
|
-
const conversationMessagesString = conversationMessages.map((message) => `${message.role}: ${message.content}`).join('\n');
|
|
1679
|
-
// Create evaluation prompt
|
|
1680
|
-
const instructions = `
|
|
1681
|
-
Please replay to this task:
|
|
1682
|
-
${evaluator.task}
|
|
1683
|
-
This is the conversation history:
|
|
1684
|
-
${conversationMessagesString}
|
|
1685
|
-
and give the response in next JSON format.
|
|
1686
|
-
${evaluator.expectedResponseType}
|
|
1687
|
-
`;
|
|
1688
|
-
// TODO: evaluations gemini flashcard
|
|
1689
|
-
// Send evaluation request
|
|
1690
|
-
const evaluationMessages = [{ content: instructions, role: ChatRole.User }];
|
|
1691
|
-
// Not sure what strategy use, if works types should be definied in definitions, generarally response will be score, and feedback.
|
|
1692
|
-
const response = await this.agentCardService.callChatCompletion({ messages: evaluationMessages });
|
|
1693
|
-
// Extract JSON from response
|
|
1694
|
-
const jsonData = extractJsonFromResponse(response.content);
|
|
1695
|
-
this.evaluationResultSignal.set(jsonData);
|
|
1696
|
-
this.toastService.info({
|
|
1697
|
-
title: 'Score ' + jsonData.score,
|
|
1698
|
-
subtitle: `Added ${jsonData.feedback} points`,
|
|
1699
|
-
});
|
|
1700
|
-
// Update score if available
|
|
1701
|
-
if (jsonData.score) {
|
|
1702
|
-
if (jsonData.score <= 3) {
|
|
1703
|
-
this.updateScore(jsonData.score * 10);
|
|
1704
|
-
}
|
|
1705
|
-
}
|
|
1706
|
-
// Update the specific user message with the evaluation result
|
|
1707
|
-
if (lastUserMessage?.messageId && jsonData) {
|
|
1708
|
-
this.conversationService.updateMessage(lastUserMessage.messageId, {
|
|
1709
|
-
evaluation: jsonData, // Add evaluation data to the message
|
|
1710
|
-
});
|
|
1711
|
-
}
|
|
1712
|
-
return jsonData;
|
|
1713
|
-
}
|
|
1714
|
-
// Helper function to get context messages based on type
|
|
1715
|
-
getContextMessages(messages, contextType) {
|
|
1716
|
-
const conversationMessages = messages.filter((message) => [ChatRole.User, ChatRole.Assistant].includes(message.role));
|
|
1717
|
-
if (conversationMessages.length === 0) {
|
|
1718
|
-
return [];
|
|
1719
|
-
}
|
|
1720
|
-
switch (contextType) {
|
|
1721
|
-
case ContextType.LastAssistantMessage: {
|
|
1722
|
-
const lastAssistant = conversationMessages
|
|
1723
|
-
.slice()
|
|
1724
|
-
.reverse()
|
|
1725
|
-
.find((m) => m.role === ChatRole.Assistant);
|
|
1726
|
-
return lastAssistant ? [lastAssistant] : [];
|
|
1727
|
-
}
|
|
1728
|
-
case ContextType.LastUserMessage: {
|
|
1729
|
-
const lastUser = conversationMessages
|
|
1730
|
-
.slice()
|
|
1731
|
-
.reverse()
|
|
1732
|
-
.find((m) => m.role === ChatRole.User);
|
|
1733
|
-
return lastUser ? [lastUser] : [];
|
|
1734
|
-
}
|
|
1735
|
-
case ContextType.LastDialog: {
|
|
1736
|
-
const lastUser = conversationMessages
|
|
1737
|
-
.slice()
|
|
1738
|
-
.reverse()
|
|
1739
|
-
.find((m) => m.role === ChatRole.User);
|
|
1740
|
-
const lastAssistant = conversationMessages
|
|
1741
|
-
.slice()
|
|
1742
|
-
.reverse()
|
|
1743
|
-
.find((m) => m.role === ChatRole.Assistant);
|
|
1744
|
-
const dialog = [];
|
|
1745
|
-
if (lastAssistant)
|
|
1746
|
-
dialog.push(lastAssistant);
|
|
1747
|
-
if (lastUser)
|
|
1748
|
-
dialog.push(lastUser);
|
|
1749
|
-
// Sort by timestamp if available, otherwise keep order [Assistant, User] if both exist
|
|
1750
|
-
// Assuming messageId or a timestamp property exists and is comparable
|
|
1751
|
-
// dialog.sort((a, b) => (a.timestamp || 0) - (b.timestamp || 0)); // Example sorting
|
|
1752
|
-
return dialog;
|
|
1753
|
-
}
|
|
1754
|
-
case ContextType.Last2Dialogs: {
|
|
1755
|
-
// I think i have an error with this.
|
|
1756
|
-
const users = conversationMessages.filter((m) => m.role === ChatRole.User);
|
|
1757
|
-
const assistants = conversationMessages.filter((m) => m.role === ChatRole.Assistant);
|
|
1758
|
-
const lastTwoUsers = users.slice(-2);
|
|
1759
|
-
const lastTwoAssistants = assistants.slice(-2);
|
|
1760
|
-
const dialogs = [...lastTwoAssistants, ...lastTwoUsers];
|
|
1761
|
-
// Sort by timestamp if available
|
|
1762
|
-
// dialogs.sort((a, b) => (a.timestamp || 0) - (b.timestamp || 0)); // Example sorting
|
|
1763
|
-
return dialogs;
|
|
1764
|
-
}
|
|
1765
|
-
case ContextType.LastUserAndPreviousAssistant: {
|
|
1766
|
-
const lastUserIndex = conversationMessages.map((m) => m.role).lastIndexOf(ChatRole.User);
|
|
1767
|
-
// Not exactrly getting the last assistant will depend if conversation is one and one.
|
|
1768
|
-
if (lastUserIndex <= 0) {
|
|
1769
|
-
return [];
|
|
1770
|
-
}
|
|
1771
|
-
const messages = conversationMessages.slice(lastUserIndex - 1, lastUserIndex + 1);
|
|
1772
|
-
console.log('LastUserAndPreviousAssistant', messages);
|
|
1773
|
-
return messages;
|
|
1774
|
-
}
|
|
1775
|
-
case ContextType.AllConversation:
|
|
1776
|
-
default:
|
|
1777
|
-
return conversationMessages;
|
|
1778
|
-
}
|
|
1779
|
-
}
|
|
1780
|
-
/**
|
|
1781
|
-
* Evaluates a conversation context based on a specific task and attaches the result to a designated message.
|
|
1782
|
-
* @param agentTask The task definition for the evaluation.
|
|
1783
|
-
* @param messageToUpdate The specific ChatMessage object (user or assistant) to attach the evaluation results to.
|
|
1784
|
-
* @param contextType Determines which part of the conversation history to send as context (default: AllConversation).
|
|
1785
|
-
* @returns The JSON result of the evaluation.
|
|
1786
|
-
*/
|
|
1787
|
-
async evaluateWithTask(agentTask, messageToUpdate, // Message to attach the evaluation to
|
|
1788
|
-
contextType = ContextType.AllConversation) {
|
|
1789
|
-
// Fetch the current conversation messages from the service
|
|
1790
|
-
const messages = this.conversationService.getMessagesSignal()();
|
|
1791
|
-
const requestMessages = [];
|
|
1792
|
-
const systemPrompt = agentTask.systemPrompt || 'You are a helpful assistant.'; // Default fallback
|
|
1793
|
-
requestMessages.push({ role: ChatRole.System, content: systemPrompt });
|
|
1794
|
-
let taskContent = agentTask.task;
|
|
1795
|
-
if (agentTask.expectedResponseType) {
|
|
1796
|
-
taskContent += `\n\nPlease provide the response strictly in the following JSON format:\n${agentTask.expectedResponseType}`;
|
|
1797
|
-
}
|
|
1798
|
-
if (contextType === ContextType.CurrentMessageContent) {
|
|
1799
|
-
taskContent += `\n\nHere is text: ${messageToUpdate.content}`;
|
|
1800
|
-
}
|
|
1801
|
-
else {
|
|
1802
|
-
// Get context messages based on the specified type
|
|
1803
|
-
const contextMessages = this.getContextMessages(messages, contextType);
|
|
1804
|
-
if (contextMessages.length > 0) {
|
|
1805
|
-
const conversationHistoryString = contextMessages
|
|
1806
|
-
.map((message) => `${message.role}: ${message.content}`) // Format messages
|
|
1807
|
-
.join('\n');
|
|
1808
|
-
taskContent += `\n\nHere is the relevant conversation history:\n${conversationHistoryString}`;
|
|
1809
|
-
}
|
|
1810
|
-
}
|
|
1811
|
-
// No longer need to find the last user message here, it's passed in as messageToUpdate
|
|
1812
|
-
requestMessages.push({ role: ChatRole.User, content: taskContent });
|
|
1813
|
-
try {
|
|
1814
|
-
const response = await this.agentCardService.callChatCompletion({ messages: requestMessages, model: agentTask.model });
|
|
1815
|
-
let jsonData = extractJsonFromResponse(response.content);
|
|
1816
|
-
if (jsonData === null) {
|
|
1817
|
-
jsonData = { score: 1, feedback: 'Good job!' };
|
|
1818
|
-
}
|
|
1819
|
-
this.evaluationResultSignal.set(jsonData);
|
|
1820
|
-
// Update score if available
|
|
1821
|
-
if (jsonData.score) {
|
|
1822
|
-
// Adjust the multiplier or condition if needed for task-based evaluation
|
|
1823
|
-
if (jsonData.score <= 3) {
|
|
1824
|
-
this.updateScore(jsonData.score * 10);
|
|
1825
|
-
}
|
|
1826
|
-
}
|
|
1827
|
-
// Update the specific message provided by the caller with the result
|
|
1828
|
-
if (messageToUpdate?.messageId && jsonData) {
|
|
1829
|
-
this.conversationService.updateMessage(messageToUpdate.messageId, { evaluation: jsonData });
|
|
1830
|
-
}
|
|
1831
|
-
return jsonData;
|
|
1832
|
-
}
|
|
1833
|
-
catch (error) {
|
|
1834
|
-
console.error('Error during evaluateWithTask:', error);
|
|
1835
|
-
this.toastService.error({
|
|
1836
|
-
title: 'Task Evaluation Failed',
|
|
1837
|
-
subtitle: error?.message || 'An unexpected error occurred while evaluating the task.',
|
|
1838
|
-
});
|
|
1839
|
-
// Depending on requirements, re-throw the error or return a specific error object
|
|
1840
|
-
throw error;
|
|
1841
|
-
}
|
|
1842
|
-
}
|
|
1843
|
-
updateScore(additionalScore) {
|
|
1844
|
-
this.scoreSignal.update((currentScore) => {
|
|
1845
|
-
const newScore = currentScore + additionalScore;
|
|
1846
|
-
return newScore > 100 ? 100 : newScore;
|
|
1847
|
-
});
|
|
1848
|
-
}
|
|
1849
|
-
resetScore() {
|
|
1850
|
-
this.scoreSignal.set(0);
|
|
1851
|
-
}
|
|
1852
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.4", ngImport: i0, type: EvaluationService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
1853
|
-
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.2.4", ngImport: i0, type: EvaluationService, providedIn: 'root' }); }
|
|
1854
|
-
}
|
|
1855
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.4", ngImport: i0, type: EvaluationService, decorators: [{
|
|
1856
|
-
type: Injectable,
|
|
1857
|
-
args: [{
|
|
1858
|
-
providedIn: 'root',
|
|
1859
|
-
}]
|
|
1860
|
-
}] });
|
|
1861
|
-
|
|
1862
1966
|
class ChatFooterComponent {
|
|
1863
1967
|
constructor() {
|
|
1864
1968
|
// Services
|
|
@@ -1867,9 +1971,7 @@ class ChatFooterComponent {
|
|
|
1867
1971
|
this.agentCardService = inject(CONVERSATION_AI_TOKEN);
|
|
1868
1972
|
// Inputs
|
|
1869
1973
|
this.isAIThinking = input(false);
|
|
1870
|
-
this.
|
|
1871
|
-
this.taskOnAssistantMessage = input();
|
|
1872
|
-
this.triggerTasks = input();
|
|
1974
|
+
this.flow = input();
|
|
1873
1975
|
this.micSettings = input({ useWhisper: true, lang: 'en' });
|
|
1874
1976
|
// Outputs
|
|
1875
1977
|
this.sendMessage = output();
|
|
@@ -1881,10 +1983,9 @@ class ChatFooterComponent {
|
|
|
1881
1983
|
// Signal to control mic resumption
|
|
1882
1984
|
this.shouldResumeMic = signal(false);
|
|
1883
1985
|
this.chatInputControl = new FormControl();
|
|
1884
|
-
this.userDataExchangeService = inject(USER_DATA_EXCHANGE);
|
|
1885
1986
|
this.lastUserMessageId = null;
|
|
1886
1987
|
// Get score from evaluation service
|
|
1887
|
-
this.score = this.evaluationService.
|
|
1988
|
+
this.score = this.evaluationService.scoreSignal;
|
|
1888
1989
|
// Watch for audio completion and set the shouldResumeMic signal
|
|
1889
1990
|
effect(() => {
|
|
1890
1991
|
const audioStatus = this.conversationService.currentAudioStatus();
|
|
@@ -1901,12 +2002,12 @@ class ChatFooterComponent {
|
|
|
1901
2002
|
}
|
|
1902
2003
|
ngOnInit() {
|
|
1903
2004
|
// throw new Error('Method not implemented.');
|
|
1904
|
-
const messages = this.conversationService.getMessagesSignal()();
|
|
1905
|
-
const firstAssistantMessage = messages.find((msn) => msn.role === ChatRole.Assistant);
|
|
1906
|
-
if (firstAssistantMessage) {
|
|
1907
|
-
|
|
1908
|
-
|
|
1909
|
-
}
|
|
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
|
+
// }
|
|
1910
2011
|
}
|
|
1911
2012
|
/**
|
|
1912
2013
|
* Method used by the template to determine if the mic should continue listening
|
|
@@ -1929,61 +2030,17 @@ class ChatFooterComponent {
|
|
|
1929
2030
|
micFinished(eventBlob) {
|
|
1930
2031
|
// this.micFinishedEvent.emit(eventBlob);
|
|
1931
2032
|
}
|
|
1932
|
-
// how to handle status audio finished? this.conversationService.currentAudioStatus.
|
|
1933
2033
|
/**
|
|
1934
2034
|
* Sends the user message
|
|
1935
2035
|
*/
|
|
1936
|
-
async
|
|
2036
|
+
async prepareUserMsnAndSend() {
|
|
1937
2037
|
if (this.isAIThinking() || !this.chatInputControl.value) {
|
|
1938
2038
|
return;
|
|
1939
2039
|
}
|
|
1940
2040
|
const text = this.chatInputControl.value;
|
|
1941
2041
|
const message = { content: text, role: ChatRole.User };
|
|
1942
2042
|
this.chatInputControl.setValue('');
|
|
1943
|
-
|
|
1944
|
-
const messages = this.conversationService.getMessagesSignal()();
|
|
1945
|
-
if (result.assistantMessageId) {
|
|
1946
|
-
const assistantMessage = messages.find((m) => m.messageId === result.assistantMessageId);
|
|
1947
|
-
this.processBackgroundTask(assistantMessage, ConversationEvents.OnAssistantMessage);
|
|
1948
|
-
}
|
|
1949
|
-
if (result?.userMessageId) {
|
|
1950
|
-
// Evaluate the message only if it was successfully sent and we have the user message ID
|
|
1951
|
-
// Find the message using the userMessageId from the result object
|
|
1952
|
-
const messageToEvaluate = messages.find((m) => m.messageId === result.userMessageId);
|
|
1953
|
-
if (messageToEvaluate) {
|
|
1954
|
-
this.processBackgroundTask(messageToEvaluate, ConversationEvents.OnUserMessage);
|
|
1955
|
-
}
|
|
1956
|
-
else {
|
|
1957
|
-
// Log the correct ID in the error message
|
|
1958
|
-
console.error(`Could not find message with ID ${result.userMessageId} to evaluate.`);
|
|
1959
|
-
}
|
|
1960
|
-
}
|
|
1961
|
-
else {
|
|
1962
|
-
console.warn('Message sending failed or returned no ID, skipping evaluation.');
|
|
1963
|
-
}
|
|
1964
|
-
}
|
|
1965
|
-
/**
|
|
1966
|
-
* Evaluate conversation using evaluator agent
|
|
1967
|
-
*/
|
|
1968
|
-
/**
|
|
1969
|
-
* Evaluate a specific message using the evaluator agent task.
|
|
1970
|
-
* @param messageToEvaluate The ChatMessage (typically the user's last message) to evaluate.
|
|
1971
|
-
*/
|
|
1972
|
-
async processBackgroundTask(messageToEvaluate, type) {
|
|
1973
|
-
const settings = this.userDataExchangeService.getUserChatSettings();
|
|
1974
|
-
// Process background tasks
|
|
1975
|
-
if (type === ConversationEvents.OnUserMessage) {
|
|
1976
|
-
const task = this.triggerTasks()[type];
|
|
1977
|
-
if (task && settings?.userMessageTask) {
|
|
1978
|
-
await this.evaluationService.evaluateWithTask(task, messageToEvaluate, ContextType.LastUserAndPreviousAssistant);
|
|
1979
|
-
}
|
|
1980
|
-
}
|
|
1981
|
-
else if (type === ConversationEvents.OnAssistantMessage) {
|
|
1982
|
-
const task = this.triggerTasks()[type];
|
|
1983
|
-
if (task && settings?.assistantMessageTask) {
|
|
1984
|
-
await this.evaluationService.evaluateWithTask(task, messageToEvaluate, ContextType.CurrentMessageContent);
|
|
1985
|
-
}
|
|
1986
|
-
}
|
|
2043
|
+
this.conversationService.prepareUserMsnAndSend(message);
|
|
1987
2044
|
}
|
|
1988
2045
|
handleAudioRecorded(event) {
|
|
1989
2046
|
console.log(event);
|
|
@@ -2027,18 +2084,16 @@ class ChatFooterComponent {
|
|
|
2027
2084
|
isLoading: false,
|
|
2028
2085
|
};
|
|
2029
2086
|
// The evaluation will happen automatically in the conversation service
|
|
2030
|
-
await this.conversationService.
|
|
2087
|
+
await this.conversationService.prepareUserMsnAndSend(updatedMessage, this.lastUserMessageId);
|
|
2031
2088
|
this.lastUserMessageId = null;
|
|
2032
2089
|
}
|
|
2033
2090
|
finally {
|
|
2034
2091
|
this.isGettingTranscription = false;
|
|
2035
|
-
// console.log(this.isAIThinking());
|
|
2036
|
-
//
|
|
2037
2092
|
}
|
|
2038
2093
|
}
|
|
2039
|
-
setScore(score) {
|
|
2040
|
-
|
|
2041
|
-
}
|
|
2094
|
+
// public setScore(score: number): void {
|
|
2095
|
+
// this.evaluationService.setScore(100);
|
|
2096
|
+
// }
|
|
2042
2097
|
/**
|
|
2043
2098
|
* Stops the microphone recording if the component is available.
|
|
2044
2099
|
*/
|
|
@@ -2048,11 +2103,11 @@ class ChatFooterComponent {
|
|
|
2048
2103
|
}
|
|
2049
2104
|
}
|
|
2050
2105
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.4", ngImport: i0, type: ChatFooterComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
2051
|
-
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 },
|
|
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()\" />\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.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: ["continueListening"], outputs: ["statusChanged", "audioRecorded", "error"] }] }); }
|
|
2052
2107
|
}
|
|
2053
2108
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.4", ngImport: i0, type: ChatFooterComponent, decorators: [{
|
|
2054
2109
|
type: Component,
|
|
2055
|
-
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()\" />\n\n <textarea pTextarea [formControl]=\"chatInputControl\" (keyup.enter)=\"
|
|
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()\" />\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"] }]
|
|
2056
2111
|
}], ctorParameters: () => [], propDecorators: { micComponent: [{
|
|
2057
2112
|
type: ViewChild,
|
|
2058
2113
|
args: [MicVadComponent]
|
|
@@ -2615,6 +2670,7 @@ class ChatMessageComponent {
|
|
|
2615
2670
|
this.multiMessages = computed(() => this.chatMessage()?.multiMessages || []);
|
|
2616
2671
|
this.messageTranslation = computed(() => this.chatMessage()?.translation);
|
|
2617
2672
|
this.isUserMessage = computed(() => this.chatMessage()?.role === ChatRole.User);
|
|
2673
|
+
this.isAssistantMessage = computed(() => this.chatMessage()?.role === ChatRole.Assistant);
|
|
2618
2674
|
this.evaluationEmoji = computed(() => {
|
|
2619
2675
|
const score = this.chatMessage()?.evaluation?.['score'];
|
|
2620
2676
|
if (score === null || score === undefined) {
|
|
@@ -2644,17 +2700,17 @@ class ChatMessageComponent {
|
|
|
2644
2700
|
}
|
|
2645
2701
|
showEvaluation() {
|
|
2646
2702
|
console.log('showEvaluation', this.chatMessage().evaluation);
|
|
2647
|
-
alert(this.chatMessage().evaluation?.['
|
|
2703
|
+
alert(this.chatMessage().evaluation?.['text'] || 'No feedback available');
|
|
2648
2704
|
}
|
|
2649
2705
|
printData() {
|
|
2650
2706
|
console.log(this.chatMessage());
|
|
2651
2707
|
}
|
|
2652
2708
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.4", ngImport: i0, type: ChatMessageComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
2653
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.4", type: ChatMessageComponent, isStandalone: true, selector: "dc-chat-message", inputs: { chatMessage: { classPropertyName: "chatMessage", publicName: "chatMessage", isSignal: true, isRequired: true, transformFunction: null }, chatUserSettings: { classPropertyName: "chatUserSettings", publicName: "chatUserSettings", isSignal: true, isRequired: false, transformFunction: null } }, ngImport: i0, template: "<div class=\"message-wrapper\" [ngClass]=\"{ 'user-message': isUserMessage(), 'assistant-message': !isUserMessage() }\">\n <div class=\"message-container\">\n <!-- Avatar for assistant messages -->\n\n @if (!isUserMessage()) {\n <div class=\"avatar-container\">\n <div class=\"avatar\" (click)=\"printData()\">\n <img [src]=\"chatMessage().imgUrl\" alt=\"AI\" class=\"avatar-image\" />\n </div>\n </div>\n }\n\n <!-- Message content -->\n <div class=\"message-bubble\">\n @if (hasMultiMessages()) {\n <dc-message-orchestrator [messages]=\"multiMessages()\" [messageRole]=\"chatMessage().role\"></dc-message-orchestrator>\n } @else {\n <dc-message-orchestrator [messages]=\"[audioMessage()]\" [messageRole]=\"chatMessage().role\"></dc-message-orchestrator>\n }\n\n <!-- Translation if available -->\n @if (chatMessage().evaluation?.['
|
|
2709
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.4", type: ChatMessageComponent, isStandalone: true, selector: "dc-chat-message", inputs: { chatMessage: { classPropertyName: "chatMessage", publicName: "chatMessage", isSignal: true, isRequired: true, transformFunction: null }, chatUserSettings: { classPropertyName: "chatUserSettings", publicName: "chatUserSettings", isSignal: true, isRequired: false, transformFunction: null } }, ngImport: i0, template: "<div class=\"message-wrapper\" [ngClass]=\"{ 'user-message': isUserMessage(), 'assistant-message': !isUserMessage() }\">\n <div class=\"message-container\">\n <!-- Avatar for assistant messages -->\n\n @if (!isUserMessage()) {\n <div class=\"avatar-container\">\n <div class=\"avatar\" (click)=\"printData()\">\n <img [src]=\"chatMessage().imgUrl\" alt=\"AI\" class=\"avatar-image\" />\n </div>\n </div>\n }\n\n <!-- Message content -->\n <div class=\"message-bubble\">\n @if (hasMultiMessages()) {\n <dc-message-orchestrator [messages]=\"multiMessages()\" [messageRole]=\"chatMessage().role\"></dc-message-orchestrator>\n } @else {\n <dc-message-orchestrator [messages]=\"[audioMessage()]\" [messageRole]=\"chatMessage().role\"></dc-message-orchestrator>\n }\n\n <!-- Translation if available -->\n @if (isAssistantMessage() && chatMessage().evaluation?.['text']) {\n <div class=\"translation\">\n <hr class=\"divider\" />\n {{ chatMessage().evaluation?.['text'] }}\n </div>\n } @if (isUserMessage() && chatMessage().evaluation) {\n <div class=\"translation\" style=\"color: white\">\n <hr class=\"divider\" />\n {{ chatMessage().evaluation?.['text'] }}\n </div>\n\n <div style=\"position: absolute; bottom: -10px; left: 20px\">\n <span>{{ evaluationEmoji() }}</span>\n <span class=\"pointer\" (click)=\"showEvaluation()\"> \uD83E\uDDD0 </span>\n </div>\n\n }\n </div>\n\n <!-- Avatar for user messages -->\n @if (isUserMessage()) {\n <div class=\"avatar-container\" (click)=\"printData()\">\n <div class=\"avatar user-avatar\">\n <img [src]=\"chatMessage()?.imgUrl || '/assets/defaults/avatar_user.jpg'\" alt=\"User\" class=\"avatar-image\" />\n </div>\n </div>\n }\n\n <br />\n </div>\n</div>\n", styles: [":host{display:block;margin-bottom:16px}.message-wrapper{display:flex;width:100%;margin-bottom:12px}.message-container{display:flex;max-width:85%;line-height:1.5}.user-message{justify-content:flex-end}.user-message .message-container{flex-direction:row}.user-message .message-bubble{background-color:#0d5878;color:#fff;border-radius:18px 18px 0;margin-left:8px;position:relative;min-width:150px}.assistant-message{justify-content:flex-start}.assistant-message .message-container{flex-direction:row}.assistant-message .message-bubble{background-color:#f0f0f0;color:#333;border-radius:18px 18px 18px 0;margin-left:8px}.message-bubble{padding:12px 16px;box-shadow:0 1px 2px #0000001a;max-width:calc(100% - 50px);min-width:0}.avatar-container{display:flex;align-items:flex-end}.avatar{width:36px;height:36px;border-radius:50%;background-color:#0d5878;display:flex;align-items:center;justify-content:center;color:#fff;font-weight:700;font-size:14px;overflow:hidden}.avatar-image{width:100%;height:100%;object-fit:cover}.user-avatar{background-color:#ffa77e}::ng-deep .em{color:inherit;font-style:italic}::ng-deep .strong{font-weight:700;color:inherit}::ng-deep .em_strong{font-weight:700;font-style:italic;color:inherit}.translation{margin-top:8px;font-size:small;line-height:1.6;color:#393744;font-style:italic}.divider{margin:.5rem 40px;border-top:1px solid #ffa77e}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i1$1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "component", type: MessageOrchestratorComponent, selector: "dc-message-orchestrator", inputs: ["messages", "messageRole"], outputs: ["playAudio", "audioCompleted"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
2654
2710
|
}
|
|
2655
2711
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.4", ngImport: i0, type: ChatMessageComponent, decorators: [{
|
|
2656
2712
|
type: Component,
|
|
2657
|
-
args: [{ selector: 'dc-chat-message', standalone: true, imports: [CommonModule, MessageOrchestratorComponent], changeDetection: ChangeDetectionStrategy.OnPush, template: "<div class=\"message-wrapper\" [ngClass]=\"{ 'user-message': isUserMessage(), 'assistant-message': !isUserMessage() }\">\n <div class=\"message-container\">\n <!-- Avatar for assistant messages -->\n\n @if (!isUserMessage()) {\n <div class=\"avatar-container\">\n <div class=\"avatar\" (click)=\"printData()\">\n <img [src]=\"chatMessage().imgUrl\" alt=\"AI\" class=\"avatar-image\" />\n </div>\n </div>\n }\n\n <!-- Message content -->\n <div class=\"message-bubble\">\n @if (hasMultiMessages()) {\n <dc-message-orchestrator [messages]=\"multiMessages()\" [messageRole]=\"chatMessage().role\"></dc-message-orchestrator>\n } @else {\n <dc-message-orchestrator [messages]=\"[audioMessage()]\" [messageRole]=\"chatMessage().role\"></dc-message-orchestrator>\n }\n\n <!-- Translation if available -->\n @if (chatMessage().evaluation?.['
|
|
2713
|
+
args: [{ selector: 'dc-chat-message', standalone: true, imports: [CommonModule, MessageOrchestratorComponent], changeDetection: ChangeDetectionStrategy.OnPush, template: "<div class=\"message-wrapper\" [ngClass]=\"{ 'user-message': isUserMessage(), 'assistant-message': !isUserMessage() }\">\n <div class=\"message-container\">\n <!-- Avatar for assistant messages -->\n\n @if (!isUserMessage()) {\n <div class=\"avatar-container\">\n <div class=\"avatar\" (click)=\"printData()\">\n <img [src]=\"chatMessage().imgUrl\" alt=\"AI\" class=\"avatar-image\" />\n </div>\n </div>\n }\n\n <!-- Message content -->\n <div class=\"message-bubble\">\n @if (hasMultiMessages()) {\n <dc-message-orchestrator [messages]=\"multiMessages()\" [messageRole]=\"chatMessage().role\"></dc-message-orchestrator>\n } @else {\n <dc-message-orchestrator [messages]=\"[audioMessage()]\" [messageRole]=\"chatMessage().role\"></dc-message-orchestrator>\n }\n\n <!-- Translation if available -->\n @if (isAssistantMessage() && chatMessage().evaluation?.['text']) {\n <div class=\"translation\">\n <hr class=\"divider\" />\n {{ chatMessage().evaluation?.['text'] }}\n </div>\n } @if (isUserMessage() && chatMessage().evaluation) {\n <div class=\"translation\" style=\"color: white\">\n <hr class=\"divider\" />\n {{ chatMessage().evaluation?.['text'] }}\n </div>\n\n <div style=\"position: absolute; bottom: -10px; left: 20px\">\n <span>{{ evaluationEmoji() }}</span>\n <span class=\"pointer\" (click)=\"showEvaluation()\"> \uD83E\uDDD0 </span>\n </div>\n\n }\n </div>\n\n <!-- Avatar for user messages -->\n @if (isUserMessage()) {\n <div class=\"avatar-container\" (click)=\"printData()\">\n <div class=\"avatar user-avatar\">\n <img [src]=\"chatMessage()?.imgUrl || '/assets/defaults/avatar_user.jpg'\" alt=\"User\" class=\"avatar-image\" />\n </div>\n </div>\n }\n\n <br />\n </div>\n</div>\n", styles: [":host{display:block;margin-bottom:16px}.message-wrapper{display:flex;width:100%;margin-bottom:12px}.message-container{display:flex;max-width:85%;line-height:1.5}.user-message{justify-content:flex-end}.user-message .message-container{flex-direction:row}.user-message .message-bubble{background-color:#0d5878;color:#fff;border-radius:18px 18px 0;margin-left:8px;position:relative;min-width:150px}.assistant-message{justify-content:flex-start}.assistant-message .message-container{flex-direction:row}.assistant-message .message-bubble{background-color:#f0f0f0;color:#333;border-radius:18px 18px 18px 0;margin-left:8px}.message-bubble{padding:12px 16px;box-shadow:0 1px 2px #0000001a;max-width:calc(100% - 50px);min-width:0}.avatar-container{display:flex;align-items:flex-end}.avatar{width:36px;height:36px;border-radius:50%;background-color:#0d5878;display:flex;align-items:center;justify-content:center;color:#fff;font-weight:700;font-size:14px;overflow:hidden}.avatar-image{width:100%;height:100%;object-fit:cover}.user-avatar{background-color:#ffa77e}::ng-deep .em{color:inherit;font-style:italic}::ng-deep .strong{font-weight:700;color:inherit}::ng-deep .em_strong{font-weight:700;font-style:italic;color:inherit}.translation{margin-top:8px;font-size:small;line-height:1.6;color:#393744;font-style:italic}.divider{margin:.5rem 40px;border-top:1px solid #ffa77e}\n"] }]
|
|
2658
2714
|
}] });
|
|
2659
2715
|
|
|
2660
2716
|
class ChatMessagesListComponent {
|
|
@@ -2748,6 +2804,15 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.4", ngImpor
|
|
|
2748
2804
|
}]
|
|
2749
2805
|
}] });
|
|
2750
2806
|
|
|
2807
|
+
function createAIModelFormGroup(task) {
|
|
2808
|
+
const fb = inject(FormBuilder);
|
|
2809
|
+
return fb.group({
|
|
2810
|
+
quality: [task?.model?.quality || EModelQuality.FAST],
|
|
2811
|
+
modelName: [task?.model?.modelName || ''],
|
|
2812
|
+
provider: [task?.model?.provider || 'google'],
|
|
2813
|
+
id: [task?.model?.id || ''],
|
|
2814
|
+
});
|
|
2815
|
+
}
|
|
2751
2816
|
/**
|
|
2752
2817
|
* A component that provides AI model provider selection functionality.
|
|
2753
2818
|
* This component allows users to select an AI provider and displays available models
|
|
@@ -2756,27 +2821,41 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.4", ngImpor
|
|
|
2756
2821
|
*
|
|
2757
2822
|
* @example
|
|
2758
2823
|
* ```html
|
|
2759
|
-
* <dc-
|
|
2824
|
+
* <dc-model-selector
|
|
2760
2825
|
* [parentForm]="yourFormGroup">
|
|
2761
|
-
* </dc-
|
|
2826
|
+
* </dc-model-selector>
|
|
2762
2827
|
* ```
|
|
2763
2828
|
*/
|
|
2764
|
-
class
|
|
2829
|
+
class ModelSelectorComponent {
|
|
2765
2830
|
constructor() {
|
|
2766
2831
|
this.conversationCardAIService = inject(CONVERSATION_AI_TOKEN);
|
|
2767
2832
|
this.cdr = inject(ChangeDetectorRef);
|
|
2833
|
+
/** Parent form group that contains provider and model selection controls */
|
|
2834
|
+
this.modelForm = createAIModelFormGroup();
|
|
2835
|
+
this.shortForm = false;
|
|
2768
2836
|
/** Flag indicating whether the models are currently being loaded */
|
|
2769
2837
|
this.isLoadingModels = true;
|
|
2770
2838
|
/** Array of available models for the selected provider */
|
|
2771
2839
|
this.modelnames = [];
|
|
2840
|
+
this.providersOptions = [
|
|
2841
|
+
{ label: 'Groq', value: 'groq' },
|
|
2842
|
+
{ label: 'Open AI', value: 'openai' },
|
|
2843
|
+
{ label: 'Google', value: 'google' },
|
|
2844
|
+
{ label: 'Open Router', value: 'openrouter' },
|
|
2845
|
+
{ label: 'Ollama', value: 'ollama' },
|
|
2846
|
+
];
|
|
2847
|
+
this.modelQualityOptions = Object.values(EModelQuality).map((value) => ({
|
|
2848
|
+
label: value.charAt(0).toUpperCase() + value.slice(1).replace(/_/g, ' '), // Format for display
|
|
2849
|
+
value: value,
|
|
2850
|
+
}));
|
|
2772
2851
|
}
|
|
2773
2852
|
/**
|
|
2774
2853
|
* Initializes the component by setting up subscriptions to provider changes
|
|
2775
2854
|
* and loading initial models if a provider is already selected.
|
|
2776
2855
|
*/
|
|
2777
2856
|
ngOnInit() {
|
|
2778
|
-
console.log('
|
|
2779
|
-
const providerControl = this.
|
|
2857
|
+
console.log('modelForm', this.modelForm);
|
|
2858
|
+
const providerControl = this.modelForm.get('provider');
|
|
2780
2859
|
if (providerControl) {
|
|
2781
2860
|
providerControl.valueChanges.pipe(filter((value) => !!value)).subscribe(async (value) => {
|
|
2782
2861
|
try {
|
|
@@ -2795,13 +2874,15 @@ class ProviderSelectorComponent {
|
|
|
2795
2874
|
});
|
|
2796
2875
|
}
|
|
2797
2876
|
}
|
|
2798
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.4", ngImport: i0, type:
|
|
2799
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.4", type:
|
|
2877
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.4", ngImport: i0, type: ModelSelectorComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
2878
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.4", type: ModelSelectorComponent, isStandalone: true, selector: "dc-model-selector", inputs: { modelForm: "modelForm", shortForm: "shortForm" }, ngImport: i0, template: "<div>\n <b>Selecci\u00F3n de modelo</b>\n\n <div class=\"form-field\">\n <label for=\"modelQuality\" class=\"block text-sm font-medium text-gray-700\">Model Quality</label>\n <p-dropdown\n id=\"modelQuality\"\n [options]=\"modelQualityOptions\"\n [formControl]=\"modelForm.controls.quality\"\n placeholder=\"Select a Quality\"\n optionLabel=\"label\"\n optionValue=\"value\"\n class=\"w-full\"></p-dropdown>\n </div>\n\n @if(!shortForm) {\n <div class=\"form-field\">\n <label for=\"modelQuality\" class=\"block text-sm font-medium text-gray-700\">Provider</label>\n <p-dropdown\n id=\"modelQuality\"\n [options]=\"providersOptions\"\n [formControl]=\"modelForm.controls.provider\"\n placeholder=\"Select a Quality\"\n optionLabel=\"label\"\n optionValue=\"value\"\n class=\"w-full\"></p-dropdown>\n </div>\n }\n\n <!-- <div style=\"display: flex; gap: 10px\" [formGroup]=\"modelForm\">\n <div class=\"space\">\n <p-radioButton value=\"groq\" formControlName=\"provider\"></p-radioButton>\n <label class=\"space\">Groq</label>\n </div>\n\n <div class=\"space\">\n <p-radioButton value=\"openai\" formControlName=\"provider\"></p-radioButton>\n <label>Open AI</label>\n </div>\n\n <div class=\"space\">\n <p-radioButton value=\"google\" formControlName=\"provider\"></p-radioButton>\n <label class=\"space\">Google</label>\n </div>\n\n <div class=\"space\">\n <p-radioButton value=\"openrouter\" formControlName=\"provider\"></p-radioButton>\n <label class=\"space\">Open Router</label>\n </div>\n\n <div class=\"space\">\n <p-radioButton value=\"ollama\" formControlName=\"provider\"></p-radioButton>\n <label class=\"space\">Ollama</label>\n </div>\n </div> -->\n\n <!-- <b>Modelo: </b>\n <span pTooltip=\"Modelo Seleccionado\">{{ modelForm.controls.modelName.value }}</span>\n @if (modelForm.controls.provider.value) { @if(isLoadingModels) {\n <p-skeleton height=\"200px\" width=\"100%\"></p-skeleton>\n } @else {\n <p-table [value]=\"modelnames\" stripedRows [size]=\"'small'\" [paginator]=\"true\" [rows]=\"12\" [formGroup]=\"modelForm\">\n <ng-template pTemplate=\"header\">\n <tr>\n <th></th>\n <th>Name</th>\n <th>$$Prompt M</th>\n <th>$$Completion M</th>\n <th>$$Cost 90/10 M</th>\n <th>Created</th>\n </tr>\n </ng-template>\n <ng-template pTemplate=\"body\" let-model>\n <tr [pTooltip]=\"model.description | truncate : 200\" tooltipPosition=\"top\">\n <td><p-radioButton [value]=\"model.id\" formControlName=\"modelName\"></p-radioButton></td>\n <td>{{ model.name || model.id }}</td>\n <td>${{ +model.pricing?.prompt * 1000000 | number : '1.2-2' }}</td>\n <td>${{ +model.pricing?.completion * 1000000 | number : '1.2-2' }}</td>\n <td>${{ +model.pricing?.prompt * 1000000 * 0.9 + +model.pricing?.completion * 1000000 * 0.1 | number : '1.2-2' }}</td>\n <td>{{ model.created * 1000 | date : 'dd/MM/yyyy' }}</td>\n </tr>\n </ng-template>\n </p-table>\n } }\n</div> -->\n</div>\n", styles: [":host{display:block}.space{display:flex;gap:2px}\n"], dependencies: [{ kind: "ngmodule", type: ReactiveFormsModule }, { 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: RadioButtonModule }, { kind: "ngmodule", type: TableModule }, { kind: "ngmodule", type: SkeletonModule }, { kind: "ngmodule", type: TooltipModule }, { 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"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
2800
2879
|
}
|
|
2801
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.4", ngImport: i0, type:
|
|
2880
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.4", ngImport: i0, type: ModelSelectorComponent, decorators: [{
|
|
2802
2881
|
type: Component,
|
|
2803
|
-
args: [{ selector: 'dc-
|
|
2804
|
-
}], propDecorators: {
|
|
2882
|
+
args: [{ selector: 'dc-model-selector', standalone: true, imports: [ReactiveFormsModule, RadioButtonModule, TableModule, SkeletonModule, TooltipModule, TruncatePipe, DatePipe, DecimalPipe, DropdownModule], changeDetection: ChangeDetectionStrategy.OnPush, template: "<div>\n <b>Selecci\u00F3n de modelo</b>\n\n <div class=\"form-field\">\n <label for=\"modelQuality\" class=\"block text-sm font-medium text-gray-700\">Model Quality</label>\n <p-dropdown\n id=\"modelQuality\"\n [options]=\"modelQualityOptions\"\n [formControl]=\"modelForm.controls.quality\"\n placeholder=\"Select a Quality\"\n optionLabel=\"label\"\n optionValue=\"value\"\n class=\"w-full\"></p-dropdown>\n </div>\n\n @if(!shortForm) {\n <div class=\"form-field\">\n <label for=\"modelQuality\" class=\"block text-sm font-medium text-gray-700\">Provider</label>\n <p-dropdown\n id=\"modelQuality\"\n [options]=\"providersOptions\"\n [formControl]=\"modelForm.controls.provider\"\n placeholder=\"Select a Quality\"\n optionLabel=\"label\"\n optionValue=\"value\"\n class=\"w-full\"></p-dropdown>\n </div>\n }\n\n <!-- <div style=\"display: flex; gap: 10px\" [formGroup]=\"modelForm\">\n <div class=\"space\">\n <p-radioButton value=\"groq\" formControlName=\"provider\"></p-radioButton>\n <label class=\"space\">Groq</label>\n </div>\n\n <div class=\"space\">\n <p-radioButton value=\"openai\" formControlName=\"provider\"></p-radioButton>\n <label>Open AI</label>\n </div>\n\n <div class=\"space\">\n <p-radioButton value=\"google\" formControlName=\"provider\"></p-radioButton>\n <label class=\"space\">Google</label>\n </div>\n\n <div class=\"space\">\n <p-radioButton value=\"openrouter\" formControlName=\"provider\"></p-radioButton>\n <label class=\"space\">Open Router</label>\n </div>\n\n <div class=\"space\">\n <p-radioButton value=\"ollama\" formControlName=\"provider\"></p-radioButton>\n <label class=\"space\">Ollama</label>\n </div>\n </div> -->\n\n <!-- <b>Modelo: </b>\n <span pTooltip=\"Modelo Seleccionado\">{{ modelForm.controls.modelName.value }}</span>\n @if (modelForm.controls.provider.value) { @if(isLoadingModels) {\n <p-skeleton height=\"200px\" width=\"100%\"></p-skeleton>\n } @else {\n <p-table [value]=\"modelnames\" stripedRows [size]=\"'small'\" [paginator]=\"true\" [rows]=\"12\" [formGroup]=\"modelForm\">\n <ng-template pTemplate=\"header\">\n <tr>\n <th></th>\n <th>Name</th>\n <th>$$Prompt M</th>\n <th>$$Completion M</th>\n <th>$$Cost 90/10 M</th>\n <th>Created</th>\n </tr>\n </ng-template>\n <ng-template pTemplate=\"body\" let-model>\n <tr [pTooltip]=\"model.description | truncate : 200\" tooltipPosition=\"top\">\n <td><p-radioButton [value]=\"model.id\" formControlName=\"modelName\"></p-radioButton></td>\n <td>{{ model.name || model.id }}</td>\n <td>${{ +model.pricing?.prompt * 1000000 | number : '1.2-2' }}</td>\n <td>${{ +model.pricing?.completion * 1000000 | number : '1.2-2' }}</td>\n <td>${{ +model.pricing?.prompt * 1000000 * 0.9 + +model.pricing?.completion * 1000000 * 0.1 | number : '1.2-2' }}</td>\n <td>{{ model.created * 1000 | date : 'dd/MM/yyyy' }}</td>\n </tr>\n </ng-template>\n </p-table>\n } }\n</div> -->\n</div>\n", styles: [":host{display:block}.space{display:flex;gap:2px}\n"] }]
|
|
2883
|
+
}], propDecorators: { modelForm: [{
|
|
2884
|
+
type: Input
|
|
2885
|
+
}], shortForm: [{
|
|
2805
2886
|
type: Input
|
|
2806
2887
|
}] } });
|
|
2807
2888
|
|
|
@@ -2838,11 +2919,7 @@ class DCConversationUserChatSettingsComponent {
|
|
|
2838
2919
|
userMessageTask: [false],
|
|
2839
2920
|
assistantMessageTask: [false],
|
|
2840
2921
|
voice: ['random'],
|
|
2841
|
-
model:
|
|
2842
|
-
provider: ['google'],
|
|
2843
|
-
modelName: [''],
|
|
2844
|
-
id: [''],
|
|
2845
|
-
}),
|
|
2922
|
+
model: createAIModelFormGroup(),
|
|
2846
2923
|
});
|
|
2847
2924
|
this.isAdmin = true;
|
|
2848
2925
|
}
|
|
@@ -2869,7 +2946,7 @@ class DCConversationUserChatSettingsComponent {
|
|
|
2869
2946
|
}
|
|
2870
2947
|
}
|
|
2871
2948
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.4", ngImport: i0, type: DCConversationUserChatSettingsComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
2872
|
-
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-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"], 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: i2$2.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: ProviderSelectorComponent, selector: "dc-provider-selector", inputs: ["parentForm"] }, { kind: "ngmodule", type: SelectModule }, { kind: "component", type: i5$1.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"] }] }); }
|
|
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"] }] }); }
|
|
2873
2950
|
}
|
|
2874
2951
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.4", ngImport: i0, type: DCConversationUserChatSettingsComponent, decorators: [{
|
|
2875
2952
|
type: Component,
|
|
@@ -2885,9 +2962,9 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.4", ngImpor
|
|
|
2885
2962
|
BadgeModule,
|
|
2886
2963
|
SkeletonModule,
|
|
2887
2964
|
TooltipModule,
|
|
2888
|
-
|
|
2965
|
+
ModelSelectorComponent,
|
|
2889
2966
|
SelectModule,
|
|
2890
|
-
], 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-
|
|
2967
|
+
], 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"] }]
|
|
2891
2968
|
}], propDecorators: { tooltipRef: [{
|
|
2892
2969
|
type: ViewChild,
|
|
2893
2970
|
args: ['tooltipRef']
|
|
@@ -2918,7 +2995,7 @@ class DCChatComponent {
|
|
|
2918
2995
|
this.isAdmin = true;
|
|
2919
2996
|
// Subscribe to score updates using effect
|
|
2920
2997
|
effect(() => {
|
|
2921
|
-
const score = this.evaluationService.
|
|
2998
|
+
const score = this.evaluationService.scoreSignal();
|
|
2922
2999
|
if (score >= 100) {
|
|
2923
3000
|
this.goalCompleted.emit();
|
|
2924
3001
|
}
|
|
@@ -2937,10 +3014,10 @@ class DCChatComponent {
|
|
|
2937
3014
|
async ngOnInit() {
|
|
2938
3015
|
this.conversationService.setDestroyed(false);
|
|
2939
3016
|
if (this.conversationSettings) {
|
|
2940
|
-
await this.conversationService.initConversationWithSettings(this.conversationSettings);
|
|
3017
|
+
await this.conversationService.initConversationWithSettings(this.conversationSettings, this.conversationFlow);
|
|
2941
3018
|
}
|
|
2942
3019
|
else {
|
|
2943
|
-
await this.conversationService.initConversationWithAgentCard(this.agentCard, this.parseDict());
|
|
3020
|
+
await this.conversationService.initConversationWithAgentCard(this.agentCard, this.parseDict(), this.conversationFlow);
|
|
2944
3021
|
}
|
|
2945
3022
|
this.evaluationService.resetScore();
|
|
2946
3023
|
}
|
|
@@ -2982,11 +3059,11 @@ class DCChatComponent {
|
|
|
2982
3059
|
await this.ngOnInit();
|
|
2983
3060
|
}
|
|
2984
3061
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.4", ngImport: i0, type: DCChatComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
2985
|
-
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 }, 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\" [
|
|
3062
|
+
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 }, 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 <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", "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 }); }
|
|
2986
3063
|
}
|
|
2987
3064
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.4", ngImport: i0, type: DCChatComponent, decorators: [{
|
|
2988
3065
|
type: Component,
|
|
2989
|
-
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\" [
|
|
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 <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"] }]
|
|
2990
3067
|
}], ctorParameters: () => [], propDecorators: { chatFooterComponent: [{
|
|
2991
3068
|
type: ViewChild,
|
|
2992
3069
|
args: [ChatFooterComponent]
|
|
@@ -3000,79 +3077,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.4", ngImpor
|
|
|
3000
3077
|
type: Input
|
|
3001
3078
|
}] } });
|
|
3002
3079
|
|
|
3003
|
-
const Endpoints = {
|
|
3004
|
-
GenerateImage: 'api/agent-cards-generate/generate-image-card',
|
|
3005
|
-
};
|
|
3006
|
-
// ♦️ Finish this will be the default so i dont need to create a new one everytime
|
|
3007
|
-
class DefaultAgentCardsService {
|
|
3008
|
-
constructor() {
|
|
3009
|
-
this.httpService = inject(HttpCoreService);
|
|
3010
|
-
}
|
|
3011
|
-
generateMainImage(idCard) {
|
|
3012
|
-
throw new Error('Method not implemented.');
|
|
3013
|
-
}
|
|
3014
|
-
completeAgentCard(idCard) {
|
|
3015
|
-
// TODO: i need a default method to do this.
|
|
3016
|
-
return this.httpService.get(`${Endpoints.GenerateImage}/${idCard}`, 'primary');
|
|
3017
|
-
}
|
|
3018
|
-
callChatCompletion(conversation) {
|
|
3019
|
-
throw new Error('Method not implemented.');
|
|
3020
|
-
}
|
|
3021
|
-
findConversationCardByID(id) {
|
|
3022
|
-
throw new Error('Method not implemented.');
|
|
3023
|
-
}
|
|
3024
|
-
filterConversationCards(filters) {
|
|
3025
|
-
throw new Error('Method not implemented.');
|
|
3026
|
-
}
|
|
3027
|
-
getAllConversationCards() {
|
|
3028
|
-
throw new Error('Method not implemented.');
|
|
3029
|
-
}
|
|
3030
|
-
findFilteredAgentCards(paginator) {
|
|
3031
|
-
throw new Error('Method not implemented.');
|
|
3032
|
-
}
|
|
3033
|
-
findAgentCardByTitle(title) {
|
|
3034
|
-
throw new Error('Method not implemented.');
|
|
3035
|
-
}
|
|
3036
|
-
saveConversationCard(conversation) {
|
|
3037
|
-
throw new Error('Method not implemented.');
|
|
3038
|
-
}
|
|
3039
|
-
deleteConversationCard(id) {
|
|
3040
|
-
throw new Error('Method not implemented.');
|
|
3041
|
-
}
|
|
3042
|
-
getTextAudioFile(tts) {
|
|
3043
|
-
throw new Error('Method not implemented.');
|
|
3044
|
-
}
|
|
3045
|
-
getConversationUserChatSettings() {
|
|
3046
|
-
throw new Error('Method not implemented.');
|
|
3047
|
-
}
|
|
3048
|
-
getListModels(provider) {
|
|
3049
|
-
throw new Error('Method not implemented.');
|
|
3050
|
-
}
|
|
3051
|
-
translateConversation(currentLang, targetLang, id) {
|
|
3052
|
-
throw new Error('Method not implemented.');
|
|
3053
|
-
}
|
|
3054
|
-
getAudioTranscriptions(audio, options) {
|
|
3055
|
-
throw new Error('Method not implemented.');
|
|
3056
|
-
}
|
|
3057
|
-
callInstruction(prompt, IAIModel) {
|
|
3058
|
-
throw new Error('Method not implemented.');
|
|
3059
|
-
}
|
|
3060
|
-
saveConversationUserChatSettings(conversation) {
|
|
3061
|
-
throw new Error('Method not implemented.');
|
|
3062
|
-
}
|
|
3063
|
-
generateImageForCard(idCard) {
|
|
3064
|
-
return this.httpService.get(`${Endpoints.GenerateImage}/${idCard}`, 'primary');
|
|
3065
|
-
}
|
|
3066
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.4", ngImport: i0, type: DefaultAgentCardsService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
3067
|
-
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.2.4", ngImport: i0, type: DefaultAgentCardsService, providedIn: 'root' }); }
|
|
3068
|
-
}
|
|
3069
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.4", ngImport: i0, type: DefaultAgentCardsService, decorators: [{
|
|
3070
|
-
type: Injectable,
|
|
3071
|
-
args: [{
|
|
3072
|
-
providedIn: 'root',
|
|
3073
|
-
}]
|
|
3074
|
-
}] });
|
|
3075
|
-
|
|
3076
3080
|
async function getCharacterData(file) {
|
|
3077
3081
|
if (file.name.endsWith('.png')) {
|
|
3078
3082
|
const filebuffer = await getFileBuffer(file);
|
|
@@ -3418,7 +3422,7 @@ class AccountPlatformForm {
|
|
|
3418
3422
|
}
|
|
3419
3423
|
}
|
|
3420
3424
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.4", ngImport: i0, type: AccountPlatformForm, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
3421
|
-
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:
|
|
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$2.InputText, selector: "[pInputText]", inputs: ["variant", "fluid", "pSize"] }, { kind: "ngmodule", type: ChipModule }, { kind: "ngmodule", type: TooltipModule }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
3422
3426
|
}
|
|
3423
3427
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.4", ngImport: i0, type: AccountPlatformForm, decorators: [{
|
|
3424
3428
|
type: Component,
|
|
@@ -3556,7 +3560,7 @@ class VoiceSelectorComponent {
|
|
|
3556
3560
|
this.dialogRef.close();
|
|
3557
3561
|
}
|
|
3558
3562
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.4", ngImport: i0, type: VoiceSelectorComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
3559
|
-
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$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: ListboxModule }, { kind: "component", type: i3$
|
|
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$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: ListboxModule }, { kind: "component", type: i3$3.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"] }] }); }
|
|
3560
3564
|
}
|
|
3561
3565
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.4", ngImport: i0, type: VoiceSelectorComponent, decorators: [{
|
|
3562
3566
|
type: Component,
|
|
@@ -3590,7 +3594,7 @@ class FormGroupService {
|
|
|
3590
3594
|
conversationType: [ConversationType.General],
|
|
3591
3595
|
autoStart: [true],
|
|
3592
3596
|
tts: this.fb.group({ voice: [''], secondaryVoice: [''], speed: ['1.0'], speedRate: [1.0] }),
|
|
3593
|
-
|
|
3597
|
+
model: createAIModelFormGroup(),
|
|
3594
3598
|
});
|
|
3595
3599
|
}
|
|
3596
3600
|
createAccountsFormGroup() {
|
|
@@ -3612,6 +3616,7 @@ class FormGroupService {
|
|
|
3612
3616
|
id: this.fb.control(model?.id || ''),
|
|
3613
3617
|
modelName: this.fb.control(model?.modelName || ''),
|
|
3614
3618
|
provider: this.fb.control(model?.provider || ''),
|
|
3619
|
+
quality: this.fb.control(model?.quality || EModelQuality.BALANCED),
|
|
3615
3620
|
});
|
|
3616
3621
|
}
|
|
3617
3622
|
createConversationFlowFormGroup() {
|
|
@@ -3643,7 +3648,7 @@ class FormGroupService {
|
|
|
3643
3648
|
systemPrompt: this.fb.control(task?.systemPrompt || ''),
|
|
3644
3649
|
task: this.fb.control(task?.task || ''),
|
|
3645
3650
|
expectedResponseType: this.fb.control(task?.expectedResponseType || ''),
|
|
3646
|
-
modelQuality: this.fb.control(task?.modelQuality || EModelQuality
|
|
3651
|
+
modelQuality: this.fb.control(task?.modelQuality || EModelQuality.FAST),
|
|
3647
3652
|
model: this.createModelFormGroup(task?.model),
|
|
3648
3653
|
});
|
|
3649
3654
|
}
|
|
@@ -3657,43 +3662,38 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.4", ngImpor
|
|
|
3657
3662
|
}]
|
|
3658
3663
|
}] });
|
|
3659
3664
|
|
|
3660
|
-
var EModelQuality;
|
|
3661
|
-
(function (EModelQuality) {
|
|
3662
|
-
EModelQuality["FAST"] = "fast";
|
|
3663
|
-
EModelQuality["BALANCED"] = "balanced";
|
|
3664
|
-
EModelQuality["SMART"] = "smart";
|
|
3665
|
-
EModelQuality["SMART_THINKING"] = "smart-thinking";
|
|
3666
|
-
})(EModelQuality || (EModelQuality = {}));
|
|
3667
3665
|
function createAgentTaskFormGroup(task) {
|
|
3668
3666
|
const fb = inject(FormBuilder);
|
|
3669
3667
|
return fb.group({
|
|
3670
3668
|
systemPrompt: [task?.systemPrompt || ''],
|
|
3671
3669
|
task: [task?.task || ''],
|
|
3672
3670
|
expectedResponseType: [task?.expectedResponseType || ''],
|
|
3673
|
-
|
|
3671
|
+
model: fb.group({
|
|
3672
|
+
quality: [task?.model?.quality || EModelQuality.BALANCED],
|
|
3673
|
+
modelName: [task?.model?.modelName || ''],
|
|
3674
|
+
provider: [task?.model?.provider || 'google'],
|
|
3675
|
+
}),
|
|
3674
3676
|
});
|
|
3675
3677
|
}
|
|
3676
3678
|
class AgentTaskFormComponent {
|
|
3677
3679
|
constructor() {
|
|
3678
|
-
this.fb = inject(FormBuilder);
|
|
3679
3680
|
this.formGroupService = inject(FormGroupService);
|
|
3680
3681
|
this.formGroup = this.formGroupService.createSimpleAgentTaskFormGroup();
|
|
3681
|
-
this.
|
|
3682
|
-
label: value.charAt(0).toUpperCase() + value.slice(1).replace(/_/g, ' '), // Format for display
|
|
3683
|
-
value: value,
|
|
3684
|
-
}));
|
|
3682
|
+
this.shortForm = false; // is short means AITask else SimpleAgentTask AiTaks is shorter
|
|
3685
3683
|
}
|
|
3686
3684
|
ngOnInit() {
|
|
3687
3685
|
console.log(this.formGroup);
|
|
3688
3686
|
}
|
|
3689
3687
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.4", ngImport: i0, type: AgentTaskFormComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
3690
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.4", type: AgentTaskFormComponent, isStandalone: true, selector: "agent-task-form", inputs: { formGroup: "formGroup" }, 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(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?.
|
|
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$2.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 }); }
|
|
3691
3689
|
}
|
|
3692
3690
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.4", ngImport: i0, type: AgentTaskFormComponent, decorators: [{
|
|
3693
3691
|
type: Component,
|
|
3694
|
-
args: [{ selector: 'agent-task-form', imports: [TextareaModule, InputTextModule, ReactiveFormsModule, DropdownModule], changeDetection: ChangeDetectionStrategy.OnPush, 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(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?.
|
|
3692
|
+
args: [{ selector: 'agent-task-form', imports: [TextareaModule, InputTextModule, ReactiveFormsModule, DropdownModule, ModelSelectorComponent, ModelSelectorComponent], changeDetection: ChangeDetectionStrategy.OnPush, 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"] }]
|
|
3695
3693
|
}], propDecorators: { formGroup: [{
|
|
3696
3694
|
type: Input
|
|
3695
|
+
}], shortForm: [{
|
|
3696
|
+
type: Input
|
|
3697
3697
|
}] } });
|
|
3698
3698
|
|
|
3699
3699
|
class DCConversationFlowFormComponent {
|
|
@@ -3738,11 +3738,11 @@ class DCConversationFlowFormComponent {
|
|
|
3738
3738
|
console.log(this.formGroup.value);
|
|
3739
3739
|
}
|
|
3740
3740
|
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\"></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\n <!-- <div [formGroupName]=\"eventKey\" class=\"group nested-group\">\n <h5>{{ conversationEvents[eventKey] }} <span pTooltip=\"Task for {{ conversationEvents[eventKey] }} event\">\u2139\uFE0F</span></h5>\n <div class=\"form-field\">\n <label [for]=\"eventKey + 'SystemPrompt'\">System Prompt</label>\n <textarea pTextarea [autoResize]=\"true\" [id]=\"eventKey + 'SystemPrompt'\" formControlName=\"systemPrompt\"></textarea>\n </div>\n <div class=\"form-field\">\n <label [for]=\"eventKey + 'Task'\">Task</label>\n <textarea pTextarea [autoResize]=\"true\" [id]=\"eventKey + 'Task'\" formControlName=\"task\"></textarea>\n </div>\n <div class=\"form-field\">\n <label [for]=\"eventKey + 'ExpectedResponseType'\">Expected Response Type</label>\n <input pInputText [id]=\"eventKey + 'ExpectedResponseType'\" type=\"text\" formControlName=\"expectedResponseType\" />\n </div>\n </div> -->\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 <div formArrayName=\"dynamicConditions\" class=\"group\">\n <h4>Dynamic Conditions <span pTooltip=\"Conditions that trigger tasks based on conversation state\">\u2139\uFE0F</span></h4>\n @for (conditionControl of getDynamicConditionsControls(); track conditionControl; let i = $index) {\n <div [formGroupName]=\"i\" class=\"group nested-group dynamic-condition-item\">\n <h5>Condition {{ i + 1 }}</h5>\n <div class=\"form-field\">\n <label [for]=\"'conditionWhat' + i\">What <span pTooltip=\"Identifier for this condition (optional)\">\u2139\uFE0F</span></label>\n\n <p-select\n id=\"lang\"\n [options]=\"entityWhatOptions\"\n formControlName=\"what\"\n optionLabel=\"label\"\n optionValue=\"value\"\n [placeholder]=\"'Select What'\"></p-select>\n\n <!-- <p-dropdown [options]=\"entityWhatOptions\" formControlName=\"what\" optionLabel=\"label\" optionValue=\"value\" placeholder=\"Select What\"></p-dropdown> -->\n </div>\n <div class=\"form-field\">\n <label [for]=\"'conditionWhen' + i\">When <span pTooltip=\"Field or variable to check\">\u2139\uFE0F</span></label>\n\n <p-select\n id=\"lang\"\n [options]=\"entityWhenOptions\"\n formControlName=\"when\"\n optionLabel=\"label\"\n optionValue=\"value\"\n [placeholder]=\"'Select When'\"></p-select>\n\n <!-- <p-dropdown [options]=\"entityWhenOptions\" formControlName=\"when\" optionLabel=\"label\" optionValue=\"value\" placeholder=\"Select When\"></p-dropdown> -->\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\" formControlName=\"value\" />\n </div>\n <!-- The 'then' FormControl is not directly rendered here as it's an any[] type.\n If it's meant to hold specific structured data to be rendered,\n its type and rendering logic would need to be adjusted.\n The task to execute is handled by the 'task' FormGroup below. -->\n\n <div formGroupName=\"task\" class=\"group very-nested-group\">\n <h6>Task <span pTooltip=\"Task to execute if this condition is met\">\u2139\uFE0F</span></h6>\n <agent-task-form [formGroup]=\"conditionControl.controls.task\"></agent-task-form>\n </div>\n <button pButton type=\"button\" severity=\"danger\" label=\"Remove Condition\" (click)=\"removeDynamicCondition(i)\"></button>\n </div>\n }\n <button pButton type=\"button\" severity=\"info\" label=\"Add Dynamic Condition\" (click)=\"addDynamicCondition()\"></button>\n </div>\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: "directive", type: i1.FormArrayName, selector: "[formArrayName]", inputs: ["formArrayName"] }, { 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: "ngmodule", type: InputTextModule }, { kind: "directive", type: i3$
|
|
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\n <!-- <div [formGroupName]=\"eventKey\" class=\"group nested-group\">\n <h5>{{ conversationEvents[eventKey] }} <span pTooltip=\"Task for {{ conversationEvents[eventKey] }} event\">\u2139\uFE0F</span></h5>\n <div class=\"form-field\">\n <label [for]=\"eventKey + 'SystemPrompt'\">System Prompt</label>\n <textarea pTextarea [autoResize]=\"true\" [id]=\"eventKey + 'SystemPrompt'\" formControlName=\"systemPrompt\"></textarea>\n </div>\n <div class=\"form-field\">\n <label [for]=\"eventKey + 'Task'\">Task</label>\n <textarea pTextarea [autoResize]=\"true\" [id]=\"eventKey + 'Task'\" formControlName=\"task\"></textarea>\n </div>\n <div class=\"form-field\">\n <label [for]=\"eventKey + 'ExpectedResponseType'\">Expected Response Type</label>\n <input pInputText [id]=\"eventKey + 'ExpectedResponseType'\" type=\"text\" formControlName=\"expectedResponseType\" />\n </div>\n </div> -->\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 <div formArrayName=\"dynamicConditions\" class=\"group\">\n <h4>Dynamic Conditions <span pTooltip=\"Conditions that trigger tasks based on conversation state\">\u2139\uFE0F</span></h4>\n @for (conditionControl of getDynamicConditionsControls(); track conditionControl; let i = $index) {\n <div [formGroupName]=\"i\" class=\"group nested-group dynamic-condition-item\">\n <h5>Condition {{ i + 1 }}</h5>\n <div class=\"form-field\">\n <label [for]=\"'conditionWhat' + i\">What <span pTooltip=\"Identifier for this condition (optional)\">\u2139\uFE0F</span></label>\n\n <p-select\n id=\"lang\"\n [options]=\"entityWhatOptions\"\n formControlName=\"what\"\n optionLabel=\"label\"\n optionValue=\"value\"\n [placeholder]=\"'Select What'\"></p-select>\n\n <!-- <p-dropdown [options]=\"entityWhatOptions\" formControlName=\"what\" optionLabel=\"label\" optionValue=\"value\" placeholder=\"Select What\"></p-dropdown> -->\n </div>\n <div class=\"form-field\">\n <label [for]=\"'conditionWhen' + i\">When <span pTooltip=\"Field or variable to check\">\u2139\uFE0F</span></label>\n\n <p-select\n id=\"lang\"\n [options]=\"entityWhenOptions\"\n formControlName=\"when\"\n optionLabel=\"label\"\n optionValue=\"value\"\n [placeholder]=\"'Select When'\"></p-select>\n\n <!-- <p-dropdown [options]=\"entityWhenOptions\" formControlName=\"when\" optionLabel=\"label\" optionValue=\"value\" placeholder=\"Select When\"></p-dropdown> -->\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\" formControlName=\"value\" />\n </div>\n <!-- The 'then' FormControl is not directly rendered here as it's an any[] type.\n If it's meant to hold specific structured data to be rendered,\n its type and rendering logic would need to be adjusted.\n The task to execute is handled by the 'task' FormGroup below. -->\n\n <div formGroupName=\"task\" class=\"group very-nested-group\">\n <h6>Task <span pTooltip=\"Task to execute if this condition is met\">\u2139\uFE0F</span></h6>\n <agent-task-form [formGroup]=\"conditionControl.controls.task\"></agent-task-form>\n </div>\n <button pButton type=\"button\" severity=\"danger\" label=\"Remove Condition\" (click)=\"removeDynamicCondition(i)\"></button>\n </div>\n }\n <button pButton type=\"button\" severity=\"info\" label=\"Add Dynamic Condition\" (click)=\"addDynamicCondition()\"></button>\n </div>\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: "directive", type: i1.FormArrayName, selector: "[formArrayName]", inputs: ["formArrayName"] }, { 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: "ngmodule", type: InputTextModule }, { kind: "directive", type: i3$2.InputText, selector: "[pInputText]", inputs: ["variant", "fluid", "pSize"] }, { 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: 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"] }] }); }
|
|
3742
3742
|
}
|
|
3743
3743
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.4", ngImport: i0, type: DCConversationFlowFormComponent, decorators: [{
|
|
3744
3744
|
type: Component,
|
|
3745
|
-
args: [{ selector: 'dc-conversation-flow-form', standalone: true, imports: [CommonModule, ReactiveFormsModule, ButtonModule, InputTextModule, TextareaModule, TooltipModule, AgentTaskFormComponent, SelectModule], 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\"></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\n <!-- <div [formGroupName]=\"eventKey\" class=\"group nested-group\">\n <h5>{{ conversationEvents[eventKey] }} <span pTooltip=\"Task for {{ conversationEvents[eventKey] }} event\">\u2139\uFE0F</span></h5>\n <div class=\"form-field\">\n <label [for]=\"eventKey + 'SystemPrompt'\">System Prompt</label>\n <textarea pTextarea [autoResize]=\"true\" [id]=\"eventKey + 'SystemPrompt'\" formControlName=\"systemPrompt\"></textarea>\n </div>\n <div class=\"form-field\">\n <label [for]=\"eventKey + 'Task'\">Task</label>\n <textarea pTextarea [autoResize]=\"true\" [id]=\"eventKey + 'Task'\" formControlName=\"task\"></textarea>\n </div>\n <div class=\"form-field\">\n <label [for]=\"eventKey + 'ExpectedResponseType'\">Expected Response Type</label>\n <input pInputText [id]=\"eventKey + 'ExpectedResponseType'\" type=\"text\" formControlName=\"expectedResponseType\" />\n </div>\n </div> -->\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 <div formArrayName=\"dynamicConditions\" class=\"group\">\n <h4>Dynamic Conditions <span pTooltip=\"Conditions that trigger tasks based on conversation state\">\u2139\uFE0F</span></h4>\n @for (conditionControl of getDynamicConditionsControls(); track conditionControl; let i = $index) {\n <div [formGroupName]=\"i\" class=\"group nested-group dynamic-condition-item\">\n <h5>Condition {{ i + 1 }}</h5>\n <div class=\"form-field\">\n <label [for]=\"'conditionWhat' + i\">What <span pTooltip=\"Identifier for this condition (optional)\">\u2139\uFE0F</span></label>\n\n <p-select\n id=\"lang\"\n [options]=\"entityWhatOptions\"\n formControlName=\"what\"\n optionLabel=\"label\"\n optionValue=\"value\"\n [placeholder]=\"'Select What'\"></p-select>\n\n <!-- <p-dropdown [options]=\"entityWhatOptions\" formControlName=\"what\" optionLabel=\"label\" optionValue=\"value\" placeholder=\"Select What\"></p-dropdown> -->\n </div>\n <div class=\"form-field\">\n <label [for]=\"'conditionWhen' + i\">When <span pTooltip=\"Field or variable to check\">\u2139\uFE0F</span></label>\n\n <p-select\n id=\"lang\"\n [options]=\"entityWhenOptions\"\n formControlName=\"when\"\n optionLabel=\"label\"\n optionValue=\"value\"\n [placeholder]=\"'Select When'\"></p-select>\n\n <!-- <p-dropdown [options]=\"entityWhenOptions\" formControlName=\"when\" optionLabel=\"label\" optionValue=\"value\" placeholder=\"Select When\"></p-dropdown> -->\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\" formControlName=\"value\" />\n </div>\n <!-- The 'then' FormControl is not directly rendered here as it's an any[] type.\n If it's meant to hold specific structured data to be rendered,\n its type and rendering logic would need to be adjusted.\n The task to execute is handled by the 'task' FormGroup below. -->\n\n <div formGroupName=\"task\" class=\"group very-nested-group\">\n <h6>Task <span pTooltip=\"Task to execute if this condition is met\">\u2139\uFE0F</span></h6>\n <agent-task-form [formGroup]=\"conditionControl.controls.task\"></agent-task-form>\n </div>\n <button pButton type=\"button\" severity=\"danger\" label=\"Remove Condition\" (click)=\"removeDynamicCondition(i)\"></button>\n </div>\n }\n <button pButton type=\"button\" severity=\"info\" label=\"Add Dynamic Condition\" (click)=\"addDynamicCondition()\"></button>\n </div>\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"] }]
|
|
3745
|
+
args: [{ selector: 'dc-conversation-flow-form', standalone: true, imports: [CommonModule, ReactiveFormsModule, ButtonModule, InputTextModule, TextareaModule, TooltipModule, AgentTaskFormComponent, SelectModule], 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\n <!-- <div [formGroupName]=\"eventKey\" class=\"group nested-group\">\n <h5>{{ conversationEvents[eventKey] }} <span pTooltip=\"Task for {{ conversationEvents[eventKey] }} event\">\u2139\uFE0F</span></h5>\n <div class=\"form-field\">\n <label [for]=\"eventKey + 'SystemPrompt'\">System Prompt</label>\n <textarea pTextarea [autoResize]=\"true\" [id]=\"eventKey + 'SystemPrompt'\" formControlName=\"systemPrompt\"></textarea>\n </div>\n <div class=\"form-field\">\n <label [for]=\"eventKey + 'Task'\">Task</label>\n <textarea pTextarea [autoResize]=\"true\" [id]=\"eventKey + 'Task'\" formControlName=\"task\"></textarea>\n </div>\n <div class=\"form-field\">\n <label [for]=\"eventKey + 'ExpectedResponseType'\">Expected Response Type</label>\n <input pInputText [id]=\"eventKey + 'ExpectedResponseType'\" type=\"text\" formControlName=\"expectedResponseType\" />\n </div>\n </div> -->\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 <div formArrayName=\"dynamicConditions\" class=\"group\">\n <h4>Dynamic Conditions <span pTooltip=\"Conditions that trigger tasks based on conversation state\">\u2139\uFE0F</span></h4>\n @for (conditionControl of getDynamicConditionsControls(); track conditionControl; let i = $index) {\n <div [formGroupName]=\"i\" class=\"group nested-group dynamic-condition-item\">\n <h5>Condition {{ i + 1 }}</h5>\n <div class=\"form-field\">\n <label [for]=\"'conditionWhat' + i\">What <span pTooltip=\"Identifier for this condition (optional)\">\u2139\uFE0F</span></label>\n\n <p-select\n id=\"lang\"\n [options]=\"entityWhatOptions\"\n formControlName=\"what\"\n optionLabel=\"label\"\n optionValue=\"value\"\n [placeholder]=\"'Select What'\"></p-select>\n\n <!-- <p-dropdown [options]=\"entityWhatOptions\" formControlName=\"what\" optionLabel=\"label\" optionValue=\"value\" placeholder=\"Select What\"></p-dropdown> -->\n </div>\n <div class=\"form-field\">\n <label [for]=\"'conditionWhen' + i\">When <span pTooltip=\"Field or variable to check\">\u2139\uFE0F</span></label>\n\n <p-select\n id=\"lang\"\n [options]=\"entityWhenOptions\"\n formControlName=\"when\"\n optionLabel=\"label\"\n optionValue=\"value\"\n [placeholder]=\"'Select When'\"></p-select>\n\n <!-- <p-dropdown [options]=\"entityWhenOptions\" formControlName=\"when\" optionLabel=\"label\" optionValue=\"value\" placeholder=\"Select When\"></p-dropdown> -->\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\" formControlName=\"value\" />\n </div>\n <!-- The 'then' FormControl is not directly rendered here as it's an any[] type.\n If it's meant to hold specific structured data to be rendered,\n its type and rendering logic would need to be adjusted.\n The task to execute is handled by the 'task' FormGroup below. -->\n\n <div formGroupName=\"task\" class=\"group very-nested-group\">\n <h6>Task <span pTooltip=\"Task to execute if this condition is met\">\u2139\uFE0F</span></h6>\n <agent-task-form [formGroup]=\"conditionControl.controls.task\"></agent-task-form>\n </div>\n <button pButton type=\"button\" severity=\"danger\" label=\"Remove Condition\" (click)=\"removeDynamicCondition(i)\"></button>\n </div>\n }\n <button pButton type=\"button\" severity=\"info\" label=\"Add Dynamic Condition\" (click)=\"addDynamicCondition()\"></button>\n </div>\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"] }]
|
|
3746
3746
|
}], propDecorators: { formGroup: [{
|
|
3747
3747
|
type: Input
|
|
3748
3748
|
}] } });
|
|
@@ -3838,8 +3838,8 @@ Improve the following first message:`;
|
|
|
3838
3838
|
{ role: ChatRole.User, content: characterData.first_mes },
|
|
3839
3839
|
];
|
|
3840
3840
|
try {
|
|
3841
|
-
const response = await this.agentCardService.callChatCompletion({ messages, model: { provider: 'google' } }); // Assuming default textEngine and conversationType are fine or not needed here
|
|
3842
|
-
const improvedMessage =
|
|
3841
|
+
const response = await this.agentCardService.callChatCompletion({ messages, model: { provider: 'google' }, returnJson: true }); // Assuming default textEngine and conversationType are fine or not needed here
|
|
3842
|
+
const improvedMessage = response.content; // Try to extract JSON, fallback to raw content
|
|
3843
3843
|
if (improvedMessage) {
|
|
3844
3844
|
this.characterCardForm.get('data.first_mes')?.setValue(typeof improvedMessage === 'string' ? improvedMessage : JSON.stringify(improvedMessage));
|
|
3845
3845
|
if (this.toastService) {
|
|
@@ -3870,7 +3870,7 @@ Improve the following first message:`;
|
|
|
3870
3870
|
return control;
|
|
3871
3871
|
}
|
|
3872
3872
|
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$3.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.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" }] }); }
|
|
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" }] }); }
|
|
3874
3874
|
}
|
|
3875
3875
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.4", ngImport: i0, type: DcCharacterCardFormComponent, decorators: [{
|
|
3876
3876
|
type: Component,
|
|
@@ -3937,7 +3937,6 @@ class DCAgentCardFormComponent {
|
|
|
3937
3937
|
characterCard: this.formGroupService.createCharacterCardFormGroup(),
|
|
3938
3938
|
conversationSettings: this.formGroupService.createConversationSettingFormGroup(),
|
|
3939
3939
|
metaApp: this.formGroupService.createMetaFormGroup(),
|
|
3940
|
-
model: this.formGroupService.createModelFormGroup(),
|
|
3941
3940
|
accounts: this.fb.array([]),
|
|
3942
3941
|
conversationFlow: this.formGroupService.createConversationFlowFormGroup(),
|
|
3943
3942
|
});
|
|
@@ -4186,8 +4185,10 @@ class DCAgentCardFormComponent {
|
|
|
4186
4185
|
messages,
|
|
4187
4186
|
textEngine: TextEngines.SimpleText,
|
|
4188
4187
|
conversationType: ConversationType.General,
|
|
4188
|
+
returnJson: true,
|
|
4189
4189
|
});
|
|
4190
|
-
const jsonData = extractJsonFromResponse(response.content);
|
|
4190
|
+
// const jsonData = extractJsonFromResponse(response.content);
|
|
4191
|
+
const jsonData = response.content;
|
|
4191
4192
|
if (jsonData) {
|
|
4192
4193
|
this.toastService.success({ title: 'Character generated', subtitle: 'No te olvides de guardar cambios si estas seguro' });
|
|
4193
4194
|
this.form.controls.characterCard.patchValue({ data: jsonData });
|
|
@@ -4238,7 +4239,7 @@ class DCAgentCardFormComponent {
|
|
|
4238
4239
|
});
|
|
4239
4240
|
}
|
|
4240
4241
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.4", ngImport: i0, type: DCAgentCardFormComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
4241
|
-
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 </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>Model Settings</summary>\n <div class=\"group\">\n <h4>Model Settings <span pTooltip=\"AI model configuration\">\u2139\uFE0F</span></h4>\n\n <dc-provider-selector [parentForm]=\"form.controls.model\"></dc-provider-selector>\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$3.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.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$1.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: ProviderSelectorComponent, selector: "dc-provider-selector", inputs: ["parentForm"] }, { 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"] }] }); }
|
|
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"] }] }); }
|
|
4242
4243
|
}
|
|
4243
4244
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.4", ngImport: i0, type: DCAgentCardFormComponent, decorators: [{
|
|
4244
4245
|
type: Component,
|
|
@@ -4260,7 +4261,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.4", ngImpor
|
|
|
4260
4261
|
DialogModule,
|
|
4261
4262
|
DynamicDialogModule,
|
|
4262
4263
|
PopoverModule,
|
|
4263
|
-
|
|
4264
|
+
ModelSelectorComponent,
|
|
4264
4265
|
AccountPlatformForm,
|
|
4265
4266
|
VoiceSelectorComponent,
|
|
4266
4267
|
InputGroupAddonModule,
|
|
@@ -4268,7 +4269,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.4", ngImpor
|
|
|
4268
4269
|
CardModule,
|
|
4269
4270
|
DCConversationFlowFormComponent,
|
|
4270
4271
|
DcCharacterCardFormComponent,
|
|
4271
|
-
], 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 </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>Model Settings</summary>\n <div class=\"group\">\n <h4>Model Settings <span pTooltip=\"AI model configuration\">\u2139\uFE0F</span></h4>\n\n <dc-provider-selector [parentForm]=\"form.controls.model\"></dc-provider-selector>\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"] }]
|
|
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"] }]
|
|
4272
4273
|
}] });
|
|
4273
4274
|
|
|
4274
4275
|
class DCConversationCardUIComponent {
|
|
@@ -4297,7 +4298,7 @@ class DCConversationCardUIComponent {
|
|
|
4297
4298
|
this.onCardAction.emit({ event: 'delete', card: this.card() });
|
|
4298
4299
|
}
|
|
4299
4300
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.4", ngImport: i0, type: DCConversationCardUIComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
4300
|
-
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$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: 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
|
|
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$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: 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.Tag, selector: "p-tag", inputs: ["style", "styleClass", "severity", "value", "icon", "rounded"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
4301
4302
|
}
|
|
4302
4303
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.4", ngImport: i0, type: DCConversationCardUIComponent, decorators: [{
|
|
4303
4304
|
type: Component,
|
|
@@ -4351,12 +4352,10 @@ class AgentCardListComponent extends PaginationBase {
|
|
|
4351
4352
|
this.subscribeToCardEvents();
|
|
4352
4353
|
}
|
|
4353
4354
|
subscribeToCardEvents() {
|
|
4354
|
-
debugger;
|
|
4355
4355
|
this.outlets.forEach((outlet) => {
|
|
4356
4356
|
const instance = outlet.componentInstance;
|
|
4357
4357
|
if (instance && instance.onCardAction) {
|
|
4358
4358
|
const subscription = instance.onCardAction.subscribe((action) => {
|
|
4359
|
-
debugger;
|
|
4360
4359
|
this.onCardAction({ action: action.event, item: action.card });
|
|
4361
4360
|
});
|
|
4362
4361
|
this.cardEventSubs.push(subscription);
|
|
@@ -4538,7 +4537,6 @@ class DcAgentCardDetailsComponent {
|
|
|
4538
4537
|
this.cdr.detectChanges();
|
|
4539
4538
|
}
|
|
4540
4539
|
startConversation() {
|
|
4541
|
-
console.log('⚠️ last version startConversation', this.agentCard);
|
|
4542
4540
|
this.onStartConversation.emit(this.agentCard);
|
|
4543
4541
|
}
|
|
4544
4542
|
toggleInfoLayer() {
|
|
@@ -4555,6 +4553,20 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.4", ngImpor
|
|
|
4555
4553
|
type: Input
|
|
4556
4554
|
}] } });
|
|
4557
4555
|
|
|
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
|
+
|
|
4558
4570
|
/*
|
|
4559
4571
|
* Public API Surface of ngx-agent-cards
|
|
4560
4572
|
*/
|
|
@@ -4564,5 +4576,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.4", ngImpor
|
|
|
4564
4576
|
* Generated bundle index. Do not edit.
|
|
4565
4577
|
*/
|
|
4566
4578
|
|
|
4567
|
-
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,
|
|
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 };
|
|
4568
4580
|
//# sourceMappingURL=dataclouder-ngx-agent-cards.mjs.map
|