@dataclouder/ngx-agent-cards 0.1.23 → 0.1.24
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 +150 -155
- package/fesm2022/dataclouder-ngx-agent-cards.mjs.map +1 -1
- package/lib/components/chat-container/chat-container.component.d.ts +1 -0
- package/lib/components/chat-container/chat-header/chat-header.component.d.ts +3 -4
- package/lib/components/dc-agent-card-lists/dc-agent-card-lists.component.d.ts +1 -1
- package/lib/models/agent.models.d.ts +1 -0
- package/lib/services/default-agent-service.d.ts +3 -3
- package/package.json +1 -1
- package/public-api.d.ts +3 -2
- /package/lib/models/{conversation-ai.class.d.ts → agent-card-abstract.model.d.ts} +0 -0
|
@@ -808,6 +808,138 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.4", ngImpor
|
|
|
808
808
|
}]
|
|
809
809
|
}] });
|
|
810
810
|
|
|
811
|
+
const Endpoints = {
|
|
812
|
+
// Existing
|
|
813
|
+
GenerateImage: 'api/agent-cards-generate/generate-image-card', // For completeAgentCard, generateImageForCard, generateMainImage
|
|
814
|
+
AgentChat: 'api/agent-cards/chat', // For callChatCompletion, callInstruction
|
|
815
|
+
UpdateAgentCard: 'api/agent-cards/partial-update', // For findById, getAll, save (POST/PUT), delete
|
|
816
|
+
// New
|
|
817
|
+
AgentCard: 'api/agent-cards/conversation', // For findById, getAll, save (POST/PUT), delete
|
|
818
|
+
AgentCardQuery: 'api/agent-cards/conversation/query', // For filterConversationCards, findAgentCardByTitle
|
|
819
|
+
UserCards: 'api/agent-cards/user-cards', // For findFilteredAgentCards
|
|
820
|
+
VertexTTS: 'api/vertex/tts/synthesize',
|
|
821
|
+
ListModels: 'api/agent-cards/models', // For getListModels
|
|
822
|
+
TranslateConversation: 'api/agent-cards/translate', // For translateConversation
|
|
823
|
+
TranscribeAudio: 'api/audio/transcribe/whisper', // For getAudioTranscriptions
|
|
824
|
+
// UserChatSettings: 'api/users/chat-settings', // Example for get/saveConversationUserChatSettings if not throwing error
|
|
825
|
+
};
|
|
826
|
+
// ♦️ Finish this will be the default so i dont need to create a new one everytime
|
|
827
|
+
class DefaultAgentCardsService {
|
|
828
|
+
constructor() {
|
|
829
|
+
this.httpService = inject(HttpCoreService);
|
|
830
|
+
}
|
|
831
|
+
partialUpdateAgentCard(agentCard) {
|
|
832
|
+
return this.httpService.put(`${Endpoints.UpdateAgentCard}`, agentCard, 'primary');
|
|
833
|
+
}
|
|
834
|
+
generateMainImage(idCard) {
|
|
835
|
+
return this.httpService.get(`${Endpoints.GenerateImage}/${idCard}`, 'primary');
|
|
836
|
+
}
|
|
837
|
+
completeAgentCard(idCard) {
|
|
838
|
+
// TODO: i need a default method to do this.
|
|
839
|
+
return this.httpService.get(`${Endpoints.GenerateImage}/${idCard}`, 'primary');
|
|
840
|
+
}
|
|
841
|
+
async callChatCompletion(conversation) {
|
|
842
|
+
let messages = conversation.messages.map((m) => ({ content: m.content, role: m.role }));
|
|
843
|
+
messages = messages.filter((m) => m.role != ChatRole.AssistantHelper);
|
|
844
|
+
const conversationFiltered = { ...conversation, messages };
|
|
845
|
+
if (conversation.returnJson) {
|
|
846
|
+
return await this.httpService.post(`${Endpoints.AgentChat}?returnJson=true`, conversationFiltered, 'primary');
|
|
847
|
+
}
|
|
848
|
+
else {
|
|
849
|
+
return await this.httpService.post(`${Endpoints.AgentChat}`, conversationFiltered, 'primary');
|
|
850
|
+
}
|
|
851
|
+
}
|
|
852
|
+
async findAgentCardByID(id) {
|
|
853
|
+
return this.httpService.get(`${Endpoints.AgentCard}/${id}`, 'primary');
|
|
854
|
+
}
|
|
855
|
+
async filterConversationCards(filters) {
|
|
856
|
+
return this.httpService.post(`${Endpoints.AgentCardQuery}`, filters, 'primary');
|
|
857
|
+
}
|
|
858
|
+
async getAllConversationCards() {
|
|
859
|
+
return this.httpService.get(`${Endpoints.AgentCard}`, 'primary');
|
|
860
|
+
}
|
|
861
|
+
async findFilteredAgentCards(paginator) {
|
|
862
|
+
return this.httpService.post(`${Endpoints.UserCards}`, paginator, 'primary');
|
|
863
|
+
}
|
|
864
|
+
async findAgentCardByTitle(title) {
|
|
865
|
+
const filters = { filters: { title } };
|
|
866
|
+
const response = await this.httpService.post(`${Endpoints.AgentCardQuery}`, filters, 'primary');
|
|
867
|
+
return response.rows[0];
|
|
868
|
+
}
|
|
869
|
+
async saveAgentCard(conversation) {
|
|
870
|
+
const id = conversation.id || conversation._id;
|
|
871
|
+
if (id) {
|
|
872
|
+
return this.httpService.put(`${Endpoints.AgentCard}/${id}`, conversation, 'primary');
|
|
873
|
+
}
|
|
874
|
+
else {
|
|
875
|
+
return this.httpService.post(`${Endpoints.AgentCard}`, conversation, 'primary');
|
|
876
|
+
}
|
|
877
|
+
}
|
|
878
|
+
async deleteAgentCard(id) {
|
|
879
|
+
// Assuming the backend returns the deleted card, or this matches an expected API contract.
|
|
880
|
+
// HttpCoreService.delete by default returns Promise<DeletedData>.
|
|
881
|
+
return this.httpService.delete(`${Endpoints.AgentCard}/${id}`, 'primary');
|
|
882
|
+
}
|
|
883
|
+
async getTextAudioFile(tts) {
|
|
884
|
+
// Note: Original service in agent-cards.service.ts used 'node' as host.
|
|
885
|
+
// HttpCoreService manages hosts via its configuration or per-call parameter. Using 'primary'.
|
|
886
|
+
const httpResponse = await this.httpService.postFileAndGetBlob(`${Endpoints.VertexTTS}`, tts, 'primary');
|
|
887
|
+
const audioData = { blobUrl: '', transcription: null };
|
|
888
|
+
const transcriptionHeader = httpResponse.headers.get('transcription');
|
|
889
|
+
if (transcriptionHeader) {
|
|
890
|
+
try {
|
|
891
|
+
audioData.transcription = JSON.parse(transcriptionHeader);
|
|
892
|
+
}
|
|
893
|
+
catch (e) {
|
|
894
|
+
console.error('Failed to parse transcription header:', e, transcriptionHeader);
|
|
895
|
+
// Optionally handle or log this error more robustly
|
|
896
|
+
}
|
|
897
|
+
}
|
|
898
|
+
if (httpResponse.body) {
|
|
899
|
+
audioData.blobUrl = window.URL.createObjectURL(httpResponse.body);
|
|
900
|
+
}
|
|
901
|
+
return audioData;
|
|
902
|
+
}
|
|
903
|
+
async getConversationUserChatSettings() {
|
|
904
|
+
throw new Error('Method getConversationUserChatSettings cannot be implemented in DefaultAgentCardsService without User or an alternative settings source.');
|
|
905
|
+
}
|
|
906
|
+
async getListModels(provider) {
|
|
907
|
+
// Note: Original service in agent-cards.service.ts used 'node' as host. Using 'primary'.
|
|
908
|
+
return this.httpService.get(`${Endpoints.ListModels}?provider=${provider}`, 'primary');
|
|
909
|
+
}
|
|
910
|
+
async translateConversation(currentLang, targetLang, id) {
|
|
911
|
+
// Note: Original service in agent-cards.service.ts used 'python' as host. Using 'primary'.
|
|
912
|
+
// Parameter name in abstract class is 'id', base service used 'idCard'. Using 'id'.
|
|
913
|
+
return this.httpService.post(`${Endpoints.TranslateConversation}`, { currentLang, targetLang, idCard: id }, // Sending as idCard as per base service's DTO
|
|
914
|
+
'primary');
|
|
915
|
+
}
|
|
916
|
+
async getAudioTranscriptions(audio, options) {
|
|
917
|
+
// Note: Original service in agent-cards.service.ts used 'node' as host. Using 'primary'.
|
|
918
|
+
// 'options' parameter corresponds to 'metadata' in the original service.
|
|
919
|
+
return this.httpService.uploadFile(`${Endpoints.TranscribeAudio}`, audio, options, 'primary');
|
|
920
|
+
}
|
|
921
|
+
async callInstruction(prompt, model) {
|
|
922
|
+
const messages = [{ content: prompt, role: ChatRole.User }];
|
|
923
|
+
const conversationDto = { messages, model };
|
|
924
|
+
// Note: Original service in agent-cards.service.ts used 'python' as host. Using 'primary'.
|
|
925
|
+
return this.httpService.post(`${Endpoints.AgentChat}`, conversationDto, 'primary');
|
|
926
|
+
}
|
|
927
|
+
async saveConversationUserChatSettings(settings) {
|
|
928
|
+
throw new Error('Method saveConversationUserChatSettings cannot be implemented in DefaultAgentCardsService without User Service/ToastService or an alternative.');
|
|
929
|
+
}
|
|
930
|
+
generateImageForCard(idCard) {
|
|
931
|
+
return this.httpService.get(`${Endpoints.GenerateImage}/${idCard}`, 'primary');
|
|
932
|
+
}
|
|
933
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.4", ngImport: i0, type: DefaultAgentCardsService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
934
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.2.4", ngImport: i0, type: DefaultAgentCardsService, providedIn: 'root' }); }
|
|
935
|
+
}
|
|
936
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.4", ngImport: i0, type: DefaultAgentCardsService, decorators: [{
|
|
937
|
+
type: Injectable,
|
|
938
|
+
args: [{
|
|
939
|
+
providedIn: 'root',
|
|
940
|
+
}]
|
|
941
|
+
}] });
|
|
942
|
+
|
|
811
943
|
class PopupService {
|
|
812
944
|
constructor() {
|
|
813
945
|
this.document = inject(DOCUMENT);
|
|
@@ -1140,12 +1272,12 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.4", ngImpor
|
|
|
1140
1272
|
|
|
1141
1273
|
class ChatHeaderComponent {
|
|
1142
1274
|
constructor() {
|
|
1143
|
-
this.agentCardService = inject(CONVERSATION_AI_TOKEN);
|
|
1144
1275
|
this.isAdmin = input(false);
|
|
1145
1276
|
this.alternativeConversation = [];
|
|
1146
1277
|
this.restartConversationEvent = output();
|
|
1147
1278
|
this.showInfoEvent = output();
|
|
1148
1279
|
this.settingsClickEvent = output();
|
|
1280
|
+
this.completeEvent = output();
|
|
1149
1281
|
}
|
|
1150
1282
|
restartConversation(conversation = null) {
|
|
1151
1283
|
this.restartConversationEvent.emit(conversation);
|
|
@@ -1156,13 +1288,16 @@ class ChatHeaderComponent {
|
|
|
1156
1288
|
settingsClick() {
|
|
1157
1289
|
this.settingsClickEvent.emit();
|
|
1158
1290
|
}
|
|
1291
|
+
complete() {
|
|
1292
|
+
this.completeEvent.emit();
|
|
1293
|
+
}
|
|
1159
1294
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.4", ngImport: i0, type: ChatHeaderComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
1160
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.4", type: ChatHeaderComponent, isStandalone: true, selector: "dc-chat-header", inputs: { isAdmin: { classPropertyName: "isAdmin", publicName: "isAdmin", isSignal: true, isRequired: false, transformFunction: null }, alternativeConversation: { classPropertyName: "alternativeConversation", publicName: "alternativeConversation", isSignal: false, isRequired: false, transformFunction: null }, agentCard: { classPropertyName: "agentCard", publicName: "agentCard", isSignal: false, isRequired: false, transformFunction: null } }, outputs: { restartConversationEvent: "restartConversationEvent", showInfoEvent: "showInfoEvent", settingsClickEvent: "settingsClickEvent" }, ngImport: i0, template: "<div class=\"chat-header\">\n <span class=\"pointer\" (click)=\"restartConversation()\">\n @if (agentCard?.title) {\n {{ agentCard.title }}\n } @else { Reiniciar conversaci\u00F3n }\n </span>\n\n @for (conversation of alternativeConversation; track conversation._id) {\n <span class=\"pointer\" (click)=\"restartConversation(conversation)\"> {{ conversation.title }} </span>\n }\n\n <div class=\"header-controls\">\n @if (isAdmin()){\n <div class=\"admin-controls\">\n <i style=\"color: rgb(255, 149, 0)\" class=\"pi pi-key\"></i>\n\n <p-button variant=\"text\" [raised]=\"true\" icon=\"pi pi-id-card\" (click)=\"showInfo()\"></p-button>\n\n <!-- <span class=\"pointer\" (click)=\"showInfo()\"> \u26A1\uFE0F </span> -->\n </div>\n }\n\n <div>\n <span class=\"pointer\" (click)=\"settingsClick()\"> \u2699\uFE0F </span>\n </div>\n </div>\n</div>\n", styles: [".chat-header{display:flex;justify-content:space-between;align-items:center;width:100%}.pointer{cursor:pointer}.header-controls{font-size:large;display:flex;justify-content:space-between;gap:10px}.admin-controls{background-color:bisque;padding:2px 5px;border-radius:4px}\n"], dependencies: [{ kind: "ngmodule", type: ButtonModule }, { kind: "component", type: i2.Button, selector: "p-button", inputs: ["type", "iconPos", "icon", "badge", "label", "disabled", "loading", "loadingIcon", "raised", "rounded", "text", "plain", "severity", "outlined", "link", "tabindex", "size", "variant", "style", "styleClass", "badgeClass", "badgeSeverity", "ariaLabel", "autofocus", "fluid", "buttonProps"], outputs: ["onClick", "onFocus", "onBlur"] }] }); }
|
|
1295
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.4", type: ChatHeaderComponent, isStandalone: true, selector: "dc-chat-header", inputs: { isAdmin: { classPropertyName: "isAdmin", publicName: "isAdmin", isSignal: true, isRequired: false, transformFunction: null }, alternativeConversation: { classPropertyName: "alternativeConversation", publicName: "alternativeConversation", isSignal: false, isRequired: false, transformFunction: null }, agentCard: { classPropertyName: "agentCard", publicName: "agentCard", isSignal: false, isRequired: false, transformFunction: null } }, outputs: { restartConversationEvent: "restartConversationEvent", showInfoEvent: "showInfoEvent", settingsClickEvent: "settingsClickEvent", completeEvent: "completeEvent" }, ngImport: i0, template: "<div class=\"chat-header\">\n <span class=\"pointer\" (click)=\"restartConversation()\">\n @if (agentCard?.title) {\n {{ agentCard.title }}\n } @else { Reiniciar conversaci\u00F3n }\n </span>\n\n @for (conversation of alternativeConversation; track conversation._id) {\n <span class=\"pointer\" (click)=\"restartConversation(conversation)\"> {{ conversation.title }} </span>\n }\n\n <div class=\"header-controls\">\n @if (isAdmin()){\n <div class=\"admin-controls\">\n <i style=\"color: rgb(255, 149, 0)\" class=\"pi pi-key\"></i>\n\n <i (click)=\"complete()\">\u26A1\uFE0F </i>\n\n <p-button variant=\"text\" [raised]=\"true\" icon=\"pi pi-id-card\" (click)=\"showInfo()\"></p-button>\n\n <!-- <span class=\"pointer\" (click)=\"showInfo()\"> \u26A1\uFE0F </span> -->\n </div>\n }\n\n <div>\n <span class=\"pointer\" (click)=\"settingsClick()\"> \u2699\uFE0F </span>\n </div>\n </div>\n</div>\n", styles: [".chat-header{display:flex;justify-content:space-between;align-items:center;width:100%}.pointer{cursor:pointer}.header-controls{font-size:large;display:flex;justify-content:space-between;gap:10px}.admin-controls{background-color:bisque;padding:2px 5px;border-radius:4px}\n"], dependencies: [{ kind: "ngmodule", type: ButtonModule }, { kind: "component", type: i2.Button, selector: "p-button", inputs: ["type", "iconPos", "icon", "badge", "label", "disabled", "loading", "loadingIcon", "raised", "rounded", "text", "plain", "severity", "outlined", "link", "tabindex", "size", "variant", "style", "styleClass", "badgeClass", "badgeSeverity", "ariaLabel", "autofocus", "fluid", "buttonProps"], outputs: ["onClick", "onFocus", "onBlur"] }] }); }
|
|
1161
1296
|
}
|
|
1162
1297
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.4", ngImport: i0, type: ChatHeaderComponent, decorators: [{
|
|
1163
1298
|
type: Component,
|
|
1164
|
-
args: [{ selector: 'dc-chat-header', standalone: true, imports: [ButtonModule], template: "<div class=\"chat-header\">\n <span class=\"pointer\" (click)=\"restartConversation()\">\n @if (agentCard?.title) {\n {{ agentCard.title }}\n } @else { Reiniciar conversaci\u00F3n }\n </span>\n\n @for (conversation of alternativeConversation; track conversation._id) {\n <span class=\"pointer\" (click)=\"restartConversation(conversation)\"> {{ conversation.title }} </span>\n }\n\n <div class=\"header-controls\">\n @if (isAdmin()){\n <div class=\"admin-controls\">\n <i style=\"color: rgb(255, 149, 0)\" class=\"pi pi-key\"></i>\n\n <p-button variant=\"text\" [raised]=\"true\" icon=\"pi pi-id-card\" (click)=\"showInfo()\"></p-button>\n\n <!-- <span class=\"pointer\" (click)=\"showInfo()\"> \u26A1\uFE0F </span> -->\n </div>\n }\n\n <div>\n <span class=\"pointer\" (click)=\"settingsClick()\"> \u2699\uFE0F </span>\n </div>\n </div>\n</div>\n", styles: [".chat-header{display:flex;justify-content:space-between;align-items:center;width:100%}.pointer{cursor:pointer}.header-controls{font-size:large;display:flex;justify-content:space-between;gap:10px}.admin-controls{background-color:bisque;padding:2px 5px;border-radius:4px}\n"] }]
|
|
1165
|
-
}],
|
|
1299
|
+
args: [{ selector: 'dc-chat-header', standalone: true, imports: [ButtonModule], template: "<div class=\"chat-header\">\n <span class=\"pointer\" (click)=\"restartConversation()\">\n @if (agentCard?.title) {\n {{ agentCard.title }}\n } @else { Reiniciar conversaci\u00F3n }\n </span>\n\n @for (conversation of alternativeConversation; track conversation._id) {\n <span class=\"pointer\" (click)=\"restartConversation(conversation)\"> {{ conversation.title }} </span>\n }\n\n <div class=\"header-controls\">\n @if (isAdmin()){\n <div class=\"admin-controls\">\n <i style=\"color: rgb(255, 149, 0)\" class=\"pi pi-key\"></i>\n\n <i (click)=\"complete()\">\u26A1\uFE0F </i>\n\n <p-button variant=\"text\" [raised]=\"true\" icon=\"pi pi-id-card\" (click)=\"showInfo()\"></p-button>\n\n <!-- <span class=\"pointer\" (click)=\"showInfo()\"> \u26A1\uFE0F </span> -->\n </div>\n }\n\n <div>\n <span class=\"pointer\" (click)=\"settingsClick()\"> \u2699\uFE0F </span>\n </div>\n </div>\n</div>\n", styles: [".chat-header{display:flex;justify-content:space-between;align-items:center;width:100%}.pointer{cursor:pointer}.header-controls{font-size:large;display:flex;justify-content:space-between;gap:10px}.admin-controls{background-color:bisque;padding:2px 5px;border-radius:4px}\n"] }]
|
|
1300
|
+
}], propDecorators: { alternativeConversation: [{
|
|
1166
1301
|
type: Input
|
|
1167
1302
|
}], agentCard: [{
|
|
1168
1303
|
type: Input
|
|
@@ -1536,149 +1671,6 @@ function buildObjectTTSRequest(message, settings = {}) {
|
|
|
1536
1671
|
};
|
|
1537
1672
|
}
|
|
1538
1673
|
|
|
1539
|
-
const Endpoints = {
|
|
1540
|
-
// Existing
|
|
1541
|
-
GenerateImage: 'api/agent-cards-generate/generate-image-card', // For completeAgentCard, generateImageForCard, generateMainImage
|
|
1542
|
-
AgentChat: 'api/agent-cards/chat', // For callChatCompletion, callInstruction
|
|
1543
|
-
UpdateAgentCard: 'api/agent-cards/partial-update', // For findById, getAll, save (POST/PUT), delete
|
|
1544
|
-
// New
|
|
1545
|
-
AgentCard: 'api/agent-cards/conversation', // For findById, getAll, save (POST/PUT), delete
|
|
1546
|
-
AgentCardQuery: 'api/agent-cards/conversation/query', // For filterConversationCards, findAgentCardByTitle
|
|
1547
|
-
UserCards: 'api/agent-cards/user-cards', // For findFilteredAgentCards
|
|
1548
|
-
VertexTTS: 'api/vertex/tts/synthesize',
|
|
1549
|
-
ListModels: 'api/agent-cards/models', // For getListModels
|
|
1550
|
-
TranslateConversation: 'api/agent-cards/translate', // For translateConversation
|
|
1551
|
-
TranscribeAudio: 'api/audio/transcribe/whisper', // For getAudioTranscriptions
|
|
1552
|
-
// UserChatSettings: 'api/users/chat-settings', // Example for get/saveConversationUserChatSettings if not throwing error
|
|
1553
|
-
};
|
|
1554
|
-
// ♦️ Finish this will be the default so i dont need to create a new one everytime
|
|
1555
|
-
class DefaultAgentCardsService {
|
|
1556
|
-
constructor() {
|
|
1557
|
-
this.httpService = inject(HttpCoreService);
|
|
1558
|
-
}
|
|
1559
|
-
partialUpdateAgentCard(agentCard) {
|
|
1560
|
-
return this.httpService.put(`${Endpoints.UpdateAgentCard}`, agentCard, 'primary');
|
|
1561
|
-
}
|
|
1562
|
-
generateMainImage(idCard) {
|
|
1563
|
-
return this.httpService.get(`${Endpoints.GenerateImage}/${idCard}`, 'primary');
|
|
1564
|
-
}
|
|
1565
|
-
completeAgentCard(idCard) {
|
|
1566
|
-
// TODO: i need a default method to do this.
|
|
1567
|
-
return this.httpService.get(`${Endpoints.GenerateImage}/${idCard}`, 'primary');
|
|
1568
|
-
}
|
|
1569
|
-
async callChatCompletion(conversation) {
|
|
1570
|
-
let messages = conversation.messages.map((m) => ({ content: m.content, role: m.role }));
|
|
1571
|
-
messages = messages.filter((m) => m.role != ChatRole.AssistantHelper);
|
|
1572
|
-
const conversationFiltered = { ...conversation, messages };
|
|
1573
|
-
if (conversation.returnJson) {
|
|
1574
|
-
return await this.httpService.post(`${Endpoints.AgentChat}?returnJson=true`, conversationFiltered, 'primary');
|
|
1575
|
-
}
|
|
1576
|
-
else {
|
|
1577
|
-
return await this.httpService.post(`${Endpoints.AgentChat}`, conversationFiltered, 'primary');
|
|
1578
|
-
}
|
|
1579
|
-
}
|
|
1580
|
-
async findAgentCardByID(id) {
|
|
1581
|
-
return this.httpService.get(`${Endpoints.AgentCard}/${id}`, 'primary');
|
|
1582
|
-
}
|
|
1583
|
-
async filterConversationCards(filters) {
|
|
1584
|
-
return this.httpService.post(`${Endpoints.AgentCardQuery}`, filters, 'primary');
|
|
1585
|
-
}
|
|
1586
|
-
async getAllConversationCards() {
|
|
1587
|
-
return this.httpService.get(`${Endpoints.AgentCard}`, 'primary');
|
|
1588
|
-
}
|
|
1589
|
-
async findFilteredAgentCards(paginator) {
|
|
1590
|
-
// Note: Original service in agent-cards.service.ts applies user-specific filters
|
|
1591
|
-
// using UserService. This default implementation omits that logic as UserService is not available here.
|
|
1592
|
-
return this.httpService.post(`${Endpoints.UserCards}`, paginator, 'primary');
|
|
1593
|
-
}
|
|
1594
|
-
async findAgentCardByTitle(title) {
|
|
1595
|
-
const filters = { filters: { title } };
|
|
1596
|
-
const response = await this.httpService.post(`${Endpoints.AgentCardQuery}`, filters, 'primary');
|
|
1597
|
-
return response.rows[0];
|
|
1598
|
-
}
|
|
1599
|
-
async saveAgentCard(conversation) {
|
|
1600
|
-
const id = conversation.id || conversation._id;
|
|
1601
|
-
if (id) {
|
|
1602
|
-
return this.httpService.put(`${Endpoints.AgentCard}/${id}`, conversation, 'primary');
|
|
1603
|
-
}
|
|
1604
|
-
else {
|
|
1605
|
-
// Note: Original service in agent-cards.service.ts sets default language using UserService.
|
|
1606
|
-
// This default implementation omits that logic.
|
|
1607
|
-
return this.httpService.post(`${Endpoints.AgentCard}`, conversation, 'primary');
|
|
1608
|
-
}
|
|
1609
|
-
}
|
|
1610
|
-
async deleteAgentCard(id) {
|
|
1611
|
-
// Assuming the backend returns the deleted card, or this matches an expected API contract.
|
|
1612
|
-
// HttpCoreService.delete by default returns Promise<DeletedData>.
|
|
1613
|
-
return this.httpService.delete(`${Endpoints.AgentCard}/${id}`, 'primary');
|
|
1614
|
-
}
|
|
1615
|
-
async getTextAudioFile(tts) {
|
|
1616
|
-
// Note: Original service in agent-cards.service.ts used 'node' as host.
|
|
1617
|
-
// HttpCoreService manages hosts via its configuration or per-call parameter. Using 'primary'.
|
|
1618
|
-
const httpResponse = await this.httpService.postFileAndGetBlob(`${Endpoints.VertexTTS}`, tts, 'primary');
|
|
1619
|
-
const audioData = { blobUrl: '', transcription: null };
|
|
1620
|
-
const transcriptionHeader = httpResponse.headers.get('transcription');
|
|
1621
|
-
if (transcriptionHeader) {
|
|
1622
|
-
try {
|
|
1623
|
-
audioData.transcription = JSON.parse(transcriptionHeader);
|
|
1624
|
-
}
|
|
1625
|
-
catch (e) {
|
|
1626
|
-
console.error('Failed to parse transcription header:', e, transcriptionHeader);
|
|
1627
|
-
// Optionally handle or log this error more robustly
|
|
1628
|
-
}
|
|
1629
|
-
}
|
|
1630
|
-
if (httpResponse.body) {
|
|
1631
|
-
audioData.blobUrl = window.URL.createObjectURL(httpResponse.body);
|
|
1632
|
-
}
|
|
1633
|
-
return audioData;
|
|
1634
|
-
}
|
|
1635
|
-
async getConversationUserChatSettings() {
|
|
1636
|
-
// Original implementation in agent-cards.service.ts relies on UserService.
|
|
1637
|
-
// DefaultAgentCardsService does not have UserService injected.
|
|
1638
|
-
// This method needs to be adapted, e.g., by fetching settings from a generic endpoint
|
|
1639
|
-
// or by injecting a similar service.
|
|
1640
|
-
throw new Error('Method getConversationUserChatSettings cannot be implemented in DefaultAgentCardsService without UserService or an alternative settings source.');
|
|
1641
|
-
}
|
|
1642
|
-
async getListModels(provider) {
|
|
1643
|
-
// Note: Original service in agent-cards.service.ts used 'node' as host. Using 'primary'.
|
|
1644
|
-
return this.httpService.get(`${Endpoints.ListModels}?provider=${provider}`, 'primary');
|
|
1645
|
-
}
|
|
1646
|
-
async translateConversation(currentLang, targetLang, id) {
|
|
1647
|
-
// Note: Original service in agent-cards.service.ts used 'python' as host. Using 'primary'.
|
|
1648
|
-
// Parameter name in abstract class is 'id', base service used 'idCard'. Using 'id'.
|
|
1649
|
-
return this.httpService.post(`${Endpoints.TranslateConversation}`, { currentLang, targetLang, idCard: id }, // Sending as idCard as per base service's DTO
|
|
1650
|
-
'primary');
|
|
1651
|
-
}
|
|
1652
|
-
async getAudioTranscriptions(audio, options) {
|
|
1653
|
-
// Note: Original service in agent-cards.service.ts used 'node' as host. Using 'primary'.
|
|
1654
|
-
// 'options' parameter corresponds to 'metadata' in the original service.
|
|
1655
|
-
return this.httpService.uploadFile(`${Endpoints.TranscribeAudio}`, audio, options, 'primary');
|
|
1656
|
-
}
|
|
1657
|
-
async callInstruction(prompt, model) {
|
|
1658
|
-
const messages = [{ content: prompt, role: ChatRole.User }];
|
|
1659
|
-
const conversationDto = { messages, model };
|
|
1660
|
-
// Note: Original service in agent-cards.service.ts used 'python' as host. Using 'primary'.
|
|
1661
|
-
return this.httpService.post(`${Endpoints.AgentChat}`, conversationDto, 'primary');
|
|
1662
|
-
}
|
|
1663
|
-
async saveConversationUserChatSettings(settings) {
|
|
1664
|
-
// Original implementation in agent-cards.service.ts relies on UserService and ToastService.
|
|
1665
|
-
// DefaultAgentCardsService does not have these services injected.
|
|
1666
|
-
// This method needs to be adapted, e.g., by POSTing settings to a generic endpoint.
|
|
1667
|
-
throw new Error('Method saveConversationUserChatSettings cannot be implemented in DefaultAgentCardsService without UserService/ToastService or an alternative.');
|
|
1668
|
-
}
|
|
1669
|
-
generateImageForCard(idCard) {
|
|
1670
|
-
return this.httpService.get(`${Endpoints.GenerateImage}/${idCard}`, 'primary');
|
|
1671
|
-
}
|
|
1672
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.4", ngImport: i0, type: DefaultAgentCardsService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
1673
|
-
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.2.4", ngImport: i0, type: DefaultAgentCardsService, providedIn: 'root' }); }
|
|
1674
|
-
}
|
|
1675
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.4", ngImport: i0, type: DefaultAgentCardsService, decorators: [{
|
|
1676
|
-
type: Injectable,
|
|
1677
|
-
args: [{
|
|
1678
|
-
providedIn: 'root',
|
|
1679
|
-
}]
|
|
1680
|
-
}] });
|
|
1681
|
-
|
|
1682
1674
|
// Helper function to get context messages based on type
|
|
1683
1675
|
function getContextMessages(messages, contextType) {
|
|
1684
1676
|
const conversationMessages = messages.filter((message) => [ChatRole.User, ChatRole.Assistant].includes(message.role));
|
|
@@ -2277,7 +2269,7 @@ class ChatFooterComponent {
|
|
|
2277
2269
|
}
|
|
2278
2270
|
}
|
|
2279
2271
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.4", ngImport: i0, type: ChatFooterComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
2280
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.4", type: ChatFooterComponent, isStandalone: true, selector: "dc-chat-footer", inputs: { isAIThinking: { classPropertyName: "isAIThinking", publicName: "isAIThinking", isSignal: true, isRequired: false, transformFunction: null }, flow: { classPropertyName: "flow", publicName: "flow", isSignal: true, isRequired: false, transformFunction: null }, micSettings: { classPropertyName: "micSettings", publicName: "micSettings", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { sendMessage: "sendMessage", textInputChanged: "textInputChanged" }, viewQueries: [{ propertyName: "micComponent", first: true, predicate: MicVadComponent, descendants: true }], ngImport: i0, template: "<div class=\"progress-input\">\n <div class=\"input-container\">\n <dc-mic (onFinished)=\"handleAudioRecorded($event)\"></dc-mic>\n <!-- \n <app-mic-vad\n (audioRecorded)=\"handleAudioRecorded($event)\"\n (statusChanged)=\"handleMicStatusChanged($event)\"\n [continueListening]=\"shouldContinueListening()\" /> -->\n\n <textarea pTextarea [formControl]=\"chatInputControl\" (keyup.enter)=\"prepareUserMsnAndSend()\" rows=\"1\"></textarea>\n\n <p-button (click)=\"prepareUserMsnAndSend()\" [disabled]=\"isAIThinking() || !chatInputControl.value\" label=\"Enviar\" [rounded]=\"true\" />\n </div>\n\n @if(flow()?.goal) {\n <p-progressbar showValue=\"false\" [value]=\"score()\" [style]=\"{ height: '6px' }\" />\n }\n</div>\n", styles: [".progress-input{padding:10px;background-color:#f5f5f545;border-top:1px solid #b1a8a8}.progress-input .input-container{display:flex;align-items:center;margin-bottom:5px}.progress-input .input-container textarea{flex:1;resize:none;margin:0 10px}.progress-input .input-container .send-button{background-color:#007bff;color:#fff;border:none;border-radius:4px;padding:8px 15px;cursor:pointer}.progress-input .input-container .send-button:disabled{background-color:#ccc;cursor:not-allowed}.progress-input .input-container .send-button:hover:not(:disabled){background-color:#0069d9}\n"], dependencies: [{ kind: "ngmodule", type: ReactiveFormsModule }, { kind: "directive", type: i1.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { kind: "directive", type: i1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1.FormControlDirective, selector: "[formControl]", inputs: ["formControl", "disabled", "ngModel"], outputs: ["ngModelChange"], exportAs: ["ngForm"] }, { kind: "ngmodule", type: ProgressBarModule }, { kind: "component", type: i2$1.ProgressBar, selector: "p-progressBar, p-progressbar, p-progress-bar", inputs: ["value", "showValue", "styleClass", "valueStyleClass", "style", "unit", "mode", "color"] }, { kind: "ngmodule", type: TextareaModule }, { kind: "directive", type: i4.Textarea, selector: "[pTextarea]", inputs: ["autoResize", "variant", "fluid", "pSize"], outputs: ["onResize"] }, { kind: "ngmodule", type: ButtonModule }, { kind: "component", type: i2.Button, selector: "p-button", inputs: ["type", "iconPos", "icon", "badge", "label", "disabled", "loading", "loadingIcon", "raised", "rounded", "text", "plain", "severity", "outlined", "link", "tabindex", "size", "variant", "style", "styleClass", "badgeClass", "badgeSeverity", "ariaLabel", "autofocus", "fluid", "buttonProps"], outputs: ["onClick", "onFocus", "onBlur"] }, { kind: "component", type: DCMicComponent, selector: "dc-mic", inputs: ["
|
|
2272
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.4", type: ChatFooterComponent, isStandalone: true, selector: "dc-chat-footer", inputs: { isAIThinking: { classPropertyName: "isAIThinking", publicName: "isAIThinking", isSignal: true, isRequired: false, transformFunction: null }, flow: { classPropertyName: "flow", publicName: "flow", isSignal: true, isRequired: false, transformFunction: null }, micSettings: { classPropertyName: "micSettings", publicName: "micSettings", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { sendMessage: "sendMessage", textInputChanged: "textInputChanged" }, viewQueries: [{ propertyName: "micComponent", first: true, predicate: MicVadComponent, descendants: true }], ngImport: i0, template: "<div class=\"progress-input\">\n <div class=\"input-container\">\n <dc-mic (onFinished)=\"handleAudioRecorded($event)\"></dc-mic>\n <!-- \n <app-mic-vad\n (audioRecorded)=\"handleAudioRecorded($event)\"\n (statusChanged)=\"handleMicStatusChanged($event)\"\n [continueListening]=\"shouldContinueListening()\" /> -->\n\n <textarea pTextarea [formControl]=\"chatInputControl\" (keyup.enter)=\"prepareUserMsnAndSend()\" rows=\"1\"></textarea>\n\n <p-button (click)=\"prepareUserMsnAndSend()\" [disabled]=\"isAIThinking() || !chatInputControl.value\" label=\"Enviar\" [rounded]=\"true\" />\n </div>\n\n @if(flow()?.goal) {\n <p-progressbar showValue=\"false\" [value]=\"score()\" [style]=\"{ height: '6px' }\" />\n }\n</div>\n", styles: [".progress-input{padding:10px;background-color:#f5f5f545;border-top:1px solid #b1a8a8}.progress-input .input-container{display:flex;align-items:center;margin-bottom:5px}.progress-input .input-container textarea{flex:1;resize:none;margin:0 10px}.progress-input .input-container .send-button{background-color:#007bff;color:#fff;border:none;border-radius:4px;padding:8px 15px;cursor:pointer}.progress-input .input-container .send-button:disabled{background-color:#ccc;cursor:not-allowed}.progress-input .input-container .send-button:hover:not(:disabled){background-color:#0069d9}\n"], dependencies: [{ kind: "ngmodule", type: ReactiveFormsModule }, { kind: "directive", type: i1.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { kind: "directive", type: i1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1.FormControlDirective, selector: "[formControl]", inputs: ["formControl", "disabled", "ngModel"], outputs: ["ngModelChange"], exportAs: ["ngForm"] }, { kind: "ngmodule", type: ProgressBarModule }, { kind: "component", type: i2$1.ProgressBar, selector: "p-progressBar, p-progressbar, p-progress-bar", inputs: ["value", "showValue", "styleClass", "valueStyleClass", "style", "unit", "mode", "color"] }, { kind: "ngmodule", type: TextareaModule }, { kind: "directive", type: i4.Textarea, selector: "[pTextarea]", inputs: ["autoResize", "variant", "fluid", "pSize"], outputs: ["onResize"] }, { kind: "ngmodule", type: ButtonModule }, { kind: "component", type: i2.Button, selector: "p-button", inputs: ["type", "iconPos", "icon", "badge", "label", "disabled", "loading", "loadingIcon", "raised", "rounded", "text", "plain", "severity", "outlined", "link", "tabindex", "size", "variant", "style", "styleClass", "badgeClass", "badgeSeverity", "ariaLabel", "autofocus", "fluid", "buttonProps"], outputs: ["onClick", "onFocus", "onBlur"] }, { kind: "component", type: DCMicComponent, selector: "dc-mic", inputs: ["targetOrBase", "micSettings", "isDone"], outputs: ["onInterpretedText", "onFinishedRecognition", "onFinished"] }] }); }
|
|
2281
2273
|
}
|
|
2282
2274
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.4", ngImport: i0, type: ChatFooterComponent, decorators: [{
|
|
2283
2275
|
type: Component,
|
|
@@ -3248,12 +3240,15 @@ class DCChatComponent {
|
|
|
3248
3240
|
}
|
|
3249
3241
|
await this.ngOnInit();
|
|
3250
3242
|
}
|
|
3243
|
+
complete() {
|
|
3244
|
+
this.goalCompleted.emit();
|
|
3245
|
+
}
|
|
3251
3246
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.4", ngImport: i0, type: DCChatComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
3252
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.4", type: DCChatComponent, isStandalone: true, selector: "dc-chat", inputs: { chatUserSettings: { classPropertyName: "chatUserSettings", publicName: "chatUserSettings", isSignal: false, isRequired: false, transformFunction: null }, conversationSettings: { classPropertyName: "conversationSettings", publicName: "conversationSettings", isSignal: false, isRequired: false, transformFunction: null }, conversationFlow: { classPropertyName: "conversationFlow", publicName: "conversationFlow", isSignal: false, isRequired: false, transformFunction: null }, agentCard: { classPropertyName: "agentCard", publicName: "agentCard", isSignal: false, isRequired: false, transformFunction: null }, parseDict: { classPropertyName: "parseDict", publicName: "parseDict", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { sendMessage: "sendMessage", goalCompleted: "goalCompleted" }, providers: [DialogService], viewQueries: [{ propertyName: "chatFooterComponent", first: true, predicate: ChatFooterComponent, descendants: true }], ngImport: i0, template: "<div class=\"chat-container\">\n <!-- Chat Header -->\n <dc-chat-header\n [agentCard]=\"agentCard\"\n [isAdmin]=\"isAdmin\"\n (showInfoEvent)=\"showInfo()\"\n (settingsClickEvent)=\"changeUserChatSettings()\"\n (restartConversationEvent)=\"restartConversation($event)\">\n </dc-chat-header>\n\n <!-- Messages List -->\n <dc-chat-messages-list [chatUserSettings]=\"chatUserSettings\" [inputMessages]=\"messages()\"> </dc-chat-messages-list>\n\n <!-- Chat Footer -->\n <dc-chat-footer [micSettings]=\"micSettings\" [flow]=\"conversationFlow\"> </dc-chat-footer>\n\n <!-- Info Dialog -->\n</div>\n\n<p-dialog [style]=\"{ width: '100vw',}\" [(visible)]=\"isInfoVisible\" [modal]=\"true\" [draggable]=\"false\" [resizable]=\"false\" header=\"Conversation Info\">\n <div class=\"info-content\">\n <div> points : {{ evaluationService.scoreSignal() }} </div>\n <details>\n <summary>Messages</summary>\n @for (message of messageStateService.getMessagesSignal()(); track message.messageId) {\n <h6>\n @if (message.role === 'system') {\n <b class=\"text-red-500\" style=\"text-transform: capitalize\">{{ message.role }}</b> - } @else {\n <b style=\"text-transform: capitalize\">{{ message.role }}</b> - }\n <b style=\"color: var(--info-color); text-transform: capitalize\">{{ message.messageId }}</b></h6\n >\n <p>{{ message.content }}</p>\n }\n </details>\n\n <details>\n <summary>Conversation Flow</summary>\n <p>Goal</p>\n <pre>{{ dynamicFlowService.conversationFlowState()?.goal.task }}</pre>\n <p>Trigger User Message</p>\n <pre>{{ dynamicFlowService.conversationFlowState()?.triggerTasks.onUserMessage.task }}</pre>\n <p>Trigger Assistant Message</p>\n <pre>{{ dynamicFlowService.conversationFlowState()?.triggerTasks.onAssistantMessage.task }}</pre>\n <p>Conditions</p>\n <pre>{{ dynamicFlowService.conversationFlowState()?.dynamicConditions | safeJson }}</pre>\n <p>Bonus</p>\n <pre>{{ dynamicFlowService.conversationFlowState()?.bonus | safeJson }}</pre>\n </details>\n\n <details>\n <summary>Agent Card</summary>\n <pre>{{ agentCard | safeJson }}</pre>\n </details>\n\n <details>\n <summary>User Settings</summary>\n <pre>{{ chatUserSettings | safeJson }}</pre>\n </details>\n </div>\n</p-dialog>\n", styles: ["::ng-deep .p-drawer-content{padding:0!important}::ng-deep .p-dialog-content{display:contents}.chat-container{display:flex;flex-direction:column;height:100%;max-height:100vh;overflow:hidden;background-color:transparent}dc-chat-messages-list{flex:1;overflow-y:auto;padding:.5rem}.score-container{padding:.5rem 1rem;background-color:var(--surface-card, #ffffff);border-top:1px solid var(--surface-border, #dee2e6)}.info-content{max-height:70vh;overflow-y:auto;padding:1rem}.info-content h3{margin-top:1rem;margin-bottom:.5rem;font-size:1.2rem}.info-content pre{background-color:var(--surface-hover, #f1f1f1);padding:1rem;border-radius:4px;overflow-x:auto;font-size:.9rem}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "component", type: ChatHeaderComponent, selector: "dc-chat-header", inputs: ["isAdmin", "alternativeConversation", "agentCard"], outputs: ["restartConversationEvent", "showInfoEvent", "settingsClickEvent"] }, { kind: "component", type: ChatFooterComponent, selector: "dc-chat-footer", inputs: ["isAIThinking", "flow", "micSettings"], outputs: ["sendMessage", "textInputChanged"] }, { kind: "component", type: ChatMessagesListComponent, selector: "dc-chat-messages-list", inputs: ["chatUserSettings", "inputMessages"] }, { kind: "ngmodule", type: DialogModule }, { kind: "component", type: i1$3.Dialog, selector: "p-dialog", inputs: ["header", "draggable", "resizable", "positionLeft", "positionTop", "contentStyle", "contentStyleClass", "modal", "closeOnEscape", "dismissableMask", "rtl", "closable", "responsive", "appendTo", "breakpoints", "styleClass", "maskStyleClass", "maskStyle", "showHeader", "breakpoint", "blockScroll", "autoZIndex", "baseZIndex", "minX", "minY", "focusOnShow", "maximizable", "keepInViewport", "focusTrap", "transitionOptions", "closeIcon", "closeAriaLabel", "closeTabindex", "minimizeIcon", "maximizeIcon", "closeButtonProps", "maximizeButtonProps", "visible", "style", "position", "role", "content", "contentTemplate", "footerTemplate", "closeIconTemplate", "maximizeIconTemplate", "minimizeIconTemplate", "headlessTemplate"], outputs: ["onShow", "onHide", "visibleChange", "onResizeInit", "onResizeEnd", "onDragEnd", "onMaximize"] }, { kind: "ngmodule", type: ProgressBarModule }, { kind: "pipe", type: SafeJsonPipe, name: "safeJson" }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
3247
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.4", type: DCChatComponent, isStandalone: true, selector: "dc-chat", inputs: { chatUserSettings: { classPropertyName: "chatUserSettings", publicName: "chatUserSettings", isSignal: false, isRequired: false, transformFunction: null }, conversationSettings: { classPropertyName: "conversationSettings", publicName: "conversationSettings", isSignal: false, isRequired: false, transformFunction: null }, conversationFlow: { classPropertyName: "conversationFlow", publicName: "conversationFlow", isSignal: false, isRequired: false, transformFunction: null }, agentCard: { classPropertyName: "agentCard", publicName: "agentCard", isSignal: false, isRequired: false, transformFunction: null }, parseDict: { classPropertyName: "parseDict", publicName: "parseDict", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { sendMessage: "sendMessage", goalCompleted: "goalCompleted" }, providers: [DialogService], viewQueries: [{ propertyName: "chatFooterComponent", first: true, predicate: ChatFooterComponent, descendants: true }], ngImport: i0, template: "<div class=\"chat-container\">\n <!-- Chat Header -->\n <dc-chat-header\n [agentCard]=\"agentCard\"\n [isAdmin]=\"isAdmin\"\n (showInfoEvent)=\"showInfo()\"\n (settingsClickEvent)=\"changeUserChatSettings()\"\n (restartConversationEvent)=\"restartConversation($event)\"\n (completeEvent)=\"complete()\">\n </dc-chat-header>\n\n <!-- Messages List -->\n <dc-chat-messages-list [chatUserSettings]=\"chatUserSettings\" [inputMessages]=\"messages()\"> </dc-chat-messages-list>\n\n <!-- Chat Footer -->\n <dc-chat-footer [micSettings]=\"micSettings\" [flow]=\"conversationFlow\"> </dc-chat-footer>\n\n <!-- Info Dialog -->\n</div>\n\n<p-dialog [style]=\"{ width: '100vw',}\" [(visible)]=\"isInfoVisible\" [modal]=\"true\" [draggable]=\"false\" [resizable]=\"false\" header=\"Conversation Info\">\n <div class=\"info-content\">\n <div> points : {{ evaluationService.scoreSignal() }} </div>\n <details>\n <summary>Messages</summary>\n @for (message of messageStateService.getMessagesSignal()(); track message.messageId) {\n <h6>\n @if (message.role === 'system') {\n <b class=\"text-red-500\" style=\"text-transform: capitalize\">{{ message.role }}</b> - } @else {\n <b style=\"text-transform: capitalize\">{{ message.role }}</b> - }\n <b style=\"color: var(--info-color); text-transform: capitalize\">{{ message.messageId }}</b></h6\n >\n <p>{{ message.content }}</p>\n }\n </details>\n\n <details>\n <summary>Conversation Flow</summary>\n <p>Goal</p>\n <pre>{{ dynamicFlowService.conversationFlowState()?.goal.task }}</pre>\n <p>Trigger User Message</p>\n <pre>{{ dynamicFlowService.conversationFlowState()?.triggerTasks.onUserMessage.task }}</pre>\n <p>Trigger Assistant Message</p>\n <pre>{{ dynamicFlowService.conversationFlowState()?.triggerTasks.onAssistantMessage.task }}</pre>\n <p>Conditions</p>\n <pre>{{ dynamicFlowService.conversationFlowState()?.dynamicConditions | safeJson }}</pre>\n <p>Bonus</p>\n <pre>{{ dynamicFlowService.conversationFlowState()?.bonus | safeJson }}</pre>\n </details>\n\n <details>\n <summary>Agent Card</summary>\n <pre>{{ agentCard | safeJson }}</pre>\n </details>\n\n <details>\n <summary>User Settings</summary>\n <pre>{{ chatUserSettings | safeJson }}</pre>\n </details>\n </div>\n</p-dialog>\n", styles: ["::ng-deep .p-drawer-content{padding:0!important}::ng-deep .p-dialog-content{display:contents}.chat-container{display:flex;flex-direction:column;height:100%;max-height:100vh;overflow:hidden;background-color:transparent}dc-chat-messages-list{flex:1;overflow-y:auto;padding:.5rem}.score-container{padding:.5rem 1rem;background-color:var(--surface-card, #ffffff);border-top:1px solid var(--surface-border, #dee2e6)}.info-content{max-height:70vh;overflow-y:auto;padding:1rem}.info-content h3{margin-top:1rem;margin-bottom:.5rem;font-size:1.2rem}.info-content pre{background-color:var(--surface-hover, #f1f1f1);padding:1rem;border-radius:4px;overflow-x:auto;font-size:.9rem}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "component", type: ChatHeaderComponent, selector: "dc-chat-header", inputs: ["isAdmin", "alternativeConversation", "agentCard"], outputs: ["restartConversationEvent", "showInfoEvent", "settingsClickEvent", "completeEvent"] }, { 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 }); }
|
|
3253
3248
|
}
|
|
3254
3249
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.4", ngImport: i0, type: DCChatComponent, decorators: [{
|
|
3255
3250
|
type: Component,
|
|
3256
|
-
args: [{ selector: 'dc-chat', standalone: true, imports: [CommonModule, ChatHeaderComponent, ChatFooterComponent, ChatMessagesListComponent, DialogModule, ProgressBarModule, SafeJsonPipe], changeDetection: ChangeDetectionStrategy.OnPush, providers: [DialogService], template: "<div class=\"chat-container\">\n <!-- Chat Header -->\n <dc-chat-header\n [agentCard]=\"agentCard\"\n [isAdmin]=\"isAdmin\"\n (showInfoEvent)=\"showInfo()\"\n (settingsClickEvent)=\"changeUserChatSettings()\"\n (restartConversationEvent)=\"restartConversation($event)\">\n </dc-chat-header>\n\n <!-- Messages List -->\n <dc-chat-messages-list [chatUserSettings]=\"chatUserSettings\" [inputMessages]=\"messages()\"> </dc-chat-messages-list>\n\n <!-- Chat Footer -->\n <dc-chat-footer [micSettings]=\"micSettings\" [flow]=\"conversationFlow\"> </dc-chat-footer>\n\n <!-- Info Dialog -->\n</div>\n\n<p-dialog [style]=\"{ width: '100vw',}\" [(visible)]=\"isInfoVisible\" [modal]=\"true\" [draggable]=\"false\" [resizable]=\"false\" header=\"Conversation Info\">\n <div class=\"info-content\">\n <div> points : {{ evaluationService.scoreSignal() }} </div>\n <details>\n <summary>Messages</summary>\n @for (message of messageStateService.getMessagesSignal()(); track message.messageId) {\n <h6>\n @if (message.role === 'system') {\n <b class=\"text-red-500\" style=\"text-transform: capitalize\">{{ message.role }}</b> - } @else {\n <b style=\"text-transform: capitalize\">{{ message.role }}</b> - }\n <b style=\"color: var(--info-color); text-transform: capitalize\">{{ message.messageId }}</b></h6\n >\n <p>{{ message.content }}</p>\n }\n </details>\n\n <details>\n <summary>Conversation Flow</summary>\n <p>Goal</p>\n <pre>{{ dynamicFlowService.conversationFlowState()?.goal.task }}</pre>\n <p>Trigger User Message</p>\n <pre>{{ dynamicFlowService.conversationFlowState()?.triggerTasks.onUserMessage.task }}</pre>\n <p>Trigger Assistant Message</p>\n <pre>{{ dynamicFlowService.conversationFlowState()?.triggerTasks.onAssistantMessage.task }}</pre>\n <p>Conditions</p>\n <pre>{{ dynamicFlowService.conversationFlowState()?.dynamicConditions | safeJson }}</pre>\n <p>Bonus</p>\n <pre>{{ dynamicFlowService.conversationFlowState()?.bonus | safeJson }}</pre>\n </details>\n\n <details>\n <summary>Agent Card</summary>\n <pre>{{ agentCard | safeJson }}</pre>\n </details>\n\n <details>\n <summary>User Settings</summary>\n <pre>{{ chatUserSettings | safeJson }}</pre>\n </details>\n </div>\n</p-dialog>\n", styles: ["::ng-deep .p-drawer-content{padding:0!important}::ng-deep .p-dialog-content{display:contents}.chat-container{display:flex;flex-direction:column;height:100%;max-height:100vh;overflow:hidden;background-color:transparent}dc-chat-messages-list{flex:1;overflow-y:auto;padding:.5rem}.score-container{padding:.5rem 1rem;background-color:var(--surface-card, #ffffff);border-top:1px solid var(--surface-border, #dee2e6)}.info-content{max-height:70vh;overflow-y:auto;padding:1rem}.info-content h3{margin-top:1rem;margin-bottom:.5rem;font-size:1.2rem}.info-content pre{background-color:var(--surface-hover, #f1f1f1);padding:1rem;border-radius:4px;overflow-x:auto;font-size:.9rem}\n"] }]
|
|
3251
|
+
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 (completeEvent)=\"complete()\">\n </dc-chat-header>\n\n <!-- Messages List -->\n <dc-chat-messages-list [chatUserSettings]=\"chatUserSettings\" [inputMessages]=\"messages()\"> </dc-chat-messages-list>\n\n <!-- Chat Footer -->\n <dc-chat-footer [micSettings]=\"micSettings\" [flow]=\"conversationFlow\"> </dc-chat-footer>\n\n <!-- Info Dialog -->\n</div>\n\n<p-dialog [style]=\"{ width: '100vw',}\" [(visible)]=\"isInfoVisible\" [modal]=\"true\" [draggable]=\"false\" [resizable]=\"false\" header=\"Conversation Info\">\n <div class=\"info-content\">\n <div> points : {{ evaluationService.scoreSignal() }} </div>\n <details>\n <summary>Messages</summary>\n @for (message of messageStateService.getMessagesSignal()(); track message.messageId) {\n <h6>\n @if (message.role === 'system') {\n <b class=\"text-red-500\" style=\"text-transform: capitalize\">{{ message.role }}</b> - } @else {\n <b style=\"text-transform: capitalize\">{{ message.role }}</b> - }\n <b style=\"color: var(--info-color); text-transform: capitalize\">{{ message.messageId }}</b></h6\n >\n <p>{{ message.content }}</p>\n }\n </details>\n\n <details>\n <summary>Conversation Flow</summary>\n <p>Goal</p>\n <pre>{{ dynamicFlowService.conversationFlowState()?.goal.task }}</pre>\n <p>Trigger User Message</p>\n <pre>{{ dynamicFlowService.conversationFlowState()?.triggerTasks.onUserMessage.task }}</pre>\n <p>Trigger Assistant Message</p>\n <pre>{{ dynamicFlowService.conversationFlowState()?.triggerTasks.onAssistantMessage.task }}</pre>\n <p>Conditions</p>\n <pre>{{ dynamicFlowService.conversationFlowState()?.dynamicConditions | safeJson }}</pre>\n <p>Bonus</p>\n <pre>{{ dynamicFlowService.conversationFlowState()?.bonus | safeJson }}</pre>\n </details>\n\n <details>\n <summary>Agent Card</summary>\n <pre>{{ agentCard | safeJson }}</pre>\n </details>\n\n <details>\n <summary>User Settings</summary>\n <pre>{{ chatUserSettings | safeJson }}</pre>\n </details>\n </div>\n</p-dialog>\n", styles: ["::ng-deep .p-drawer-content{padding:0!important}::ng-deep .p-dialog-content{display:contents}.chat-container{display:flex;flex-direction:column;height:100%;max-height:100vh;overflow:hidden;background-color:transparent}dc-chat-messages-list{flex:1;overflow-y:auto;padding:.5rem}.score-container{padding:.5rem 1rem;background-color:var(--surface-card, #ffffff);border-top:1px solid var(--surface-border, #dee2e6)}.info-content{max-height:70vh;overflow-y:auto;padding:1rem}.info-content h3{margin-top:1rem;margin-bottom:.5rem;font-size:1.2rem}.info-content pre{background-color:var(--surface-hover, #f1f1f1);padding:1rem;border-radius:4px;overflow-x:auto;font-size:.9rem}\n"] }]
|
|
3257
3252
|
}], ctorParameters: () => [], propDecorators: { chatFooterComponent: [{
|
|
3258
3253
|
type: ViewChild,
|
|
3259
3254
|
args: [ChatFooterComponent]
|
|
@@ -4735,7 +4730,7 @@ class AgentCardListComponent extends PaginationBase {
|
|
|
4735
4730
|
'characterCard.data.name': 1,
|
|
4736
4731
|
'characterCard.data.creator_notes': 1,
|
|
4737
4732
|
};
|
|
4738
|
-
this.
|
|
4733
|
+
this.findAgentCards();
|
|
4739
4734
|
this.cardComponent = this.customCardComponent() || DCConversationCardUIComponent;
|
|
4740
4735
|
this.filterBarOptions = { showCreateButton: this.showOptions(), showViewButton: this.showOptions(), showActions: this.showOptions() };
|
|
4741
4736
|
}
|
|
@@ -4762,11 +4757,11 @@ class AgentCardListComponent extends PaginationBase {
|
|
|
4762
4757
|
ngOnDestroy() {
|
|
4763
4758
|
this.clearCardEventSubs();
|
|
4764
4759
|
}
|
|
4765
|
-
async
|
|
4760
|
+
async findAgentCards() {
|
|
4766
4761
|
try {
|
|
4767
4762
|
this.isLoading = true;
|
|
4768
4763
|
this.cdr.detectChanges();
|
|
4769
|
-
console.log('
|
|
4764
|
+
console.log('findAgentCards', this.filterConfig);
|
|
4770
4765
|
const response = await this.agentCardService.findFilteredAgentCards(this.filterConfig);
|
|
4771
4766
|
this.agentCards.set(response.rows);
|
|
4772
4767
|
this.totalRecords = response.count;
|
|
@@ -4796,7 +4791,7 @@ class AgentCardListComponent extends PaginationBase {
|
|
|
4796
4791
|
}
|
|
4797
4792
|
// Implement the abstract method from PaginationBase
|
|
4798
4793
|
async loadData() {
|
|
4799
|
-
return this.
|
|
4794
|
+
return this.findAgentCards();
|
|
4800
4795
|
}
|
|
4801
4796
|
doFilterBarAction({ action, item }) {
|
|
4802
4797
|
// console.log('doAction', { action, item });
|
|
@@ -4963,5 +4958,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.4", ngImpor
|
|
|
4963
4958
|
* Generated bundle index. Do not edit.
|
|
4964
4959
|
*/
|
|
4965
4960
|
|
|
4966
|
-
export { AgentCardListComponent, AgentCardProgressStatus, AgentCardsAbstractService, AgentUserProgressService, AudioService, AudioSpeed, CONVERSATION_AI_TOKEN, ChatEventType, ChatMessage, ChatRole, ContextType, ConversationDTO, ConversationEvents, ConversationMessagesDTO, ConversationType, ConversationTypeOptions, DCAgentCardFormComponent, DCChatComponent, DCConversationCardUIComponent, DCConversationPromptBuilderService, DCConversationUserChatSettingsComponent, DcAgentCardDetailsComponent, DoActionTypeOptions, DynamicFlowService, EAccountsPlatform, EDoActionType, EntityThen, EntityWhat, EntityWhatOptions, EntityWhen, EntityWhenOptions, EvalResultStringDefinition, LangCodeDescriptionEs, MessageContent, MessageOrchestratorComponent, ModelSelectorComponent, PopupService, SystemPromptType, TextEngineOptions, TextEngines, TextHighlighterComponent, USER_DATA_EXCHANGE, UserDataExchangeAbstractService, VoiceTTSOption, VoiceTTSOptions, WordTimestamps, buildObjectTTSRequest, characterCardStringDataDefinition, convertToHTML, createAIModelFormGroup, defaultconvUserSettings, extractAudioAndTranscription, extractJsonFromResponse, markdownBasicToHTML, markdownToHTML$1 as markdownToHTML, markdownToHTML2, markdownToHtml, matchTranscription, provideChatAIService, provideUserDataExchange, removeAllEmojis, removeEmojis, removeEmojisAndSpecialCharacters, removeSpecialCharacters };
|
|
4961
|
+
export { AgentCardListComponent, AgentCardProgressStatus, AgentCardsAbstractService, AgentUserProgressService, AudioService, AudioSpeed, CONVERSATION_AI_TOKEN, ChatEventType, ChatMessage, ChatRole, ContextType, ConversationDTO, ConversationEvents, ConversationMessagesDTO, ConversationType, ConversationTypeOptions, DCAgentCardFormComponent, DCChatComponent, DCConversationCardUIComponent, DCConversationPromptBuilderService, DCConversationUserChatSettingsComponent, DcAgentCardDetailsComponent, DefaultAgentCardsService, DoActionTypeOptions, DynamicFlowService, EAccountsPlatform, EDoActionType, EntityThen, EntityWhat, EntityWhatOptions, EntityWhen, EntityWhenOptions, EvalResultStringDefinition, LangCodeDescriptionEs, MessageContent, MessageOrchestratorComponent, ModelSelectorComponent, PopupService, SystemPromptType, TextEngineOptions, TextEngines, TextHighlighterComponent, USER_DATA_EXCHANGE, UserDataExchangeAbstractService, VoiceTTSOption, VoiceTTSOptions, WordTimestamps, buildObjectTTSRequest, characterCardStringDataDefinition, convertToHTML, createAIModelFormGroup, defaultconvUserSettings, extractAudioAndTranscription, extractJsonFromResponse, markdownBasicToHTML, markdownToHTML$1 as markdownToHTML, markdownToHTML2, markdownToHtml, matchTranscription, provideChatAIService, provideUserDataExchange, removeAllEmojis, removeEmojis, removeEmojisAndSpecialCharacters, removeSpecialCharacters };
|
|
4967
4962
|
//# sourceMappingURL=dataclouder-ngx-agent-cards.mjs.map
|