ngx-core-components 0.3.17 → 0.3.18
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/ai/ai-audio-wave/ai-audio-wave.component.d.ts +18 -4
- package/ai/ai-chat/ai-chat.component.d.ts +35 -2
- package/ai/ai-chat/models.d.ts +6 -0
- package/ai/ai-code-editor/ai-code-editor.component.d.ts +15 -1
- package/ai/ai-rag-inspector/ai-rag-inspector.component.d.ts +22 -0
- package/ai/ai-rag-inspector/models.d.ts +15 -0
- package/ai/public-api.d.ts +2 -0
- package/buttons/button/button.component.d.ts +15 -1
- package/charts/bubble-chart/bubble-chart.component.d.ts +75 -0
- package/charts/public-api.d.ts +4 -0
- package/charts/sunburst-chart/sunburst-chart.component.d.ts +63 -0
- package/fesm2022/ngx-core-components-ai.mjs +910 -48
- package/fesm2022/ngx-core-components-ai.mjs.map +1 -1
- package/fesm2022/ngx-core-components-buttons.mjs +113 -16
- package/fesm2022/ngx-core-components-buttons.mjs.map +1 -1
- package/fesm2022/ngx-core-components-charts.mjs +940 -1
- package/fesm2022/ngx-core-components-charts.mjs.map +1 -1
- package/fesm2022/ngx-core-components-inputs.mjs +746 -213
- package/fesm2022/ngx-core-components-inputs.mjs.map +1 -1
- package/fesm2022/ngx-core-components-views.mjs +422 -2
- package/fesm2022/ngx-core-components-views.mjs.map +1 -1
- package/fesm2022/ngx-core-components.mjs +2 -2
- package/fesm2022/ngx-core-components.mjs.map +1 -1
- package/inputs/checkbox/checkbox.component.d.ts +6 -2
- package/inputs/date-range-picker/date-range-picker.component.d.ts +1 -1
- package/inputs/file-preview/file-preview.component.d.ts +1 -1
- package/inputs/numeric-textbox/numeric-textbox.component.d.ts +5 -1
- package/inputs/radio/radio-group.component.d.ts +12 -2
- package/inputs/rating/rating.component.d.ts +17 -4
- package/inputs/segmented-control/segmented-control.component.d.ts +2 -2
- package/inputs/switch/switch.component.d.ts +14 -4
- package/inputs/textarea/textarea.component.d.ts +3 -1
- package/inputs/textbox/textbox.component.d.ts +4 -1
- package/package.json +1 -1
- package/public-api.d.ts +6 -2
- package/views/calendar/calendar.component.d.ts +54 -0
- package/views/public-api.d.ts +2 -0
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
import * as i0 from '@angular/core';
|
|
2
|
-
import { input, output, viewChild, effect,
|
|
2
|
+
import { inject, input, output, viewChild, signal, effect, HostListener, Component, ViewChild, computed } from '@angular/core';
|
|
3
3
|
import * as i1 from '@angular/common';
|
|
4
4
|
import { CommonModule } from '@angular/common';
|
|
5
5
|
import * as i2 from '@angular/forms';
|
|
6
6
|
import { FormsModule } from '@angular/forms';
|
|
7
|
+
import { DomSanitizer } from '@angular/platform-browser';
|
|
7
8
|
|
|
8
9
|
class AIChatComponent {
|
|
10
|
+
sanitizer = inject(DomSanitizer);
|
|
9
11
|
messages = input([]);
|
|
10
12
|
agentName = input('AI Agent');
|
|
11
13
|
agentAvatarUrl = input('');
|
|
@@ -21,8 +23,63 @@ class AIChatComponent {
|
|
|
21
23
|
quickReplyClick = output();
|
|
22
24
|
cardActionClick = output();
|
|
23
25
|
clearHistory = output();
|
|
26
|
+
messageFeedback = output();
|
|
27
|
+
fileAttached = output();
|
|
28
|
+
messageSent = output();
|
|
24
29
|
chatBody = viewChild('chatBody');
|
|
25
30
|
inputText = '';
|
|
31
|
+
attachedFiles = signal([]);
|
|
32
|
+
msgFeedbackMap = {};
|
|
33
|
+
onHostClick(event) {
|
|
34
|
+
const target = event.target;
|
|
35
|
+
if (target && target.classList.contains('copy-code-btn')) {
|
|
36
|
+
const codeText = target.getAttribute('data-code');
|
|
37
|
+
if (codeText) {
|
|
38
|
+
navigator.clipboard.writeText(decodeURIComponent(codeText)).then(() => {
|
|
39
|
+
target.innerText = 'Copied!';
|
|
40
|
+
setTimeout(() => { target.innerText = 'Copy'; }, 2000);
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
onFileSelected(event) {
|
|
46
|
+
const inputEl = event.target;
|
|
47
|
+
if (inputEl && inputEl.files) {
|
|
48
|
+
const filesArray = Array.from(inputEl.files);
|
|
49
|
+
filesArray.forEach(file => {
|
|
50
|
+
const fileUrl = URL.createObjectURL(file);
|
|
51
|
+
const attachment = {
|
|
52
|
+
name: file.name,
|
|
53
|
+
type: file.type,
|
|
54
|
+
size: file.size,
|
|
55
|
+
url: fileUrl,
|
|
56
|
+
rawFile: file
|
|
57
|
+
};
|
|
58
|
+
this.attachedFiles.update(current => [...current, attachment]);
|
|
59
|
+
this.fileAttached.emit({
|
|
60
|
+
name: file.name,
|
|
61
|
+
type: file.type,
|
|
62
|
+
size: file.size,
|
|
63
|
+
file: file
|
|
64
|
+
});
|
|
65
|
+
});
|
|
66
|
+
// Reset input value to allow selecting same file again
|
|
67
|
+
inputEl.value = '';
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
removeAttachment(file) {
|
|
71
|
+
URL.revokeObjectURL(file.url);
|
|
72
|
+
this.attachedFiles.update(current => current.filter(f => f.url !== file.url));
|
|
73
|
+
}
|
|
74
|
+
onMessageRating(messageId, rating) {
|
|
75
|
+
if (this.msgFeedbackMap[messageId] === rating) {
|
|
76
|
+
delete this.msgFeedbackMap[messageId];
|
|
77
|
+
}
|
|
78
|
+
else {
|
|
79
|
+
this.msgFeedbackMap[messageId] = rating;
|
|
80
|
+
}
|
|
81
|
+
this.messageFeedback.emit({ messageId, rating });
|
|
82
|
+
}
|
|
26
83
|
constructor() {
|
|
27
84
|
// Automatically scroll to bottom when messages or typing status changes
|
|
28
85
|
effect(() => {
|
|
@@ -33,9 +90,19 @@ class AIChatComponent {
|
|
|
33
90
|
}
|
|
34
91
|
onSubmit() {
|
|
35
92
|
const text = this.inputText.trim();
|
|
36
|
-
if (!text
|
|
93
|
+
if (!text && this.attachedFiles().length === 0)
|
|
94
|
+
return;
|
|
95
|
+
if (this.disabled())
|
|
37
96
|
return;
|
|
97
|
+
const attachmentsData = this.attachedFiles().map(f => ({
|
|
98
|
+
name: f.name,
|
|
99
|
+
url: f.url,
|
|
100
|
+
type: f.type,
|
|
101
|
+
size: f.size
|
|
102
|
+
}));
|
|
38
103
|
this.sendMessage.emit(text);
|
|
104
|
+
this.messageSent.emit({ content: text, attachments: attachmentsData });
|
|
105
|
+
this.attachedFiles.set([]);
|
|
39
106
|
this.inputText = '';
|
|
40
107
|
}
|
|
41
108
|
toggleStep(step) {
|
|
@@ -75,19 +142,24 @@ class AIChatComponent {
|
|
|
75
142
|
// Code blocks helper
|
|
76
143
|
formatted = formatted.replace(/```(\w*)\n([\s\S]*?)```/g, (_, lang, code) => {
|
|
77
144
|
const language = lang || 'code';
|
|
145
|
+
const cleanCode = code.trim();
|
|
146
|
+
const encoded = encodeURIComponent(cleanCode);
|
|
78
147
|
return `
|
|
79
|
-
<div class="code-container" style="background: rgba(0,0,0,0.05); padding: 8px 12px; border-radius: 6px; font-family: monospace; font-size: 12px; margin: 8px 0; border-left: 3px solid #3b82f6; overflow-x: auto;">
|
|
80
|
-
<div style="font-size: 10px; font-weight: bold; opacity: 0.6; margin-bottom: 4px; text-transform: uppercase;"
|
|
81
|
-
|
|
148
|
+
<div class="code-container" style="background: rgba(0,0,0,0.05); padding: 8px 12px; border-radius: 6px; font-family: monospace; font-size: 12px; margin: 8px 0; border-left: 3px solid #3b82f6; overflow-x: auto; position: relative;">
|
|
149
|
+
<div style="display: flex; justify-content: space-between; align-items: center; font-size: 10px; font-weight: bold; opacity: 0.6; margin-bottom: 4px; text-transform: uppercase;">
|
|
150
|
+
<span>${language}</span>
|
|
151
|
+
<button class="copy-code-btn" data-code="${encoded}" style="background: transparent; border: 1px solid rgba(0,0,0,0.15); padding: 2px 6px; border-radius: 4px; cursor: pointer; font-size: 9px; font-family: sans-serif; transition: all 0.2s;">Copy</button>
|
|
152
|
+
</div>
|
|
153
|
+
<pre style="margin: 0; white-space: pre-wrap;"><code>${cleanCode}</code></pre>
|
|
82
154
|
</div>
|
|
83
155
|
`;
|
|
84
156
|
});
|
|
85
157
|
// Inline code helper
|
|
86
158
|
formatted = formatted.replace(/`(.*?)`/g, '<code style="background: rgba(0,0,0,0.06); padding: 2px 4px; border-radius: 4px; font-family: monospace; font-size: 12px;">$1</code>');
|
|
87
|
-
return formatted;
|
|
159
|
+
return this.sanitizer.bypassSecurityTrustHtml(formatted);
|
|
88
160
|
}
|
|
89
161
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.20", ngImport: i0, type: AIChatComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
90
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.20", type: AIChatComponent, isStandalone: true, selector: "ngx-ai-chat", inputs: { messages: { classPropertyName: "messages", publicName: "messages", isSignal: true, isRequired: false, transformFunction: null }, agentName: { classPropertyName: "agentName", publicName: "agentName", isSignal: true, isRequired: false, transformFunction: null }, agentAvatarUrl: { classPropertyName: "agentAvatarUrl", publicName: "agentAvatarUrl", isSignal: true, isRequired: false, transformFunction: null }, isOnline: { classPropertyName: "isOnline", publicName: "isOnline", isSignal: true, isRequired: false, transformFunction: null }, isTyping: { classPropertyName: "isTyping", publicName: "isTyping", isSignal: true, isRequired: false, transformFunction: null }, showSenderNames: { classPropertyName: "showSenderNames", publicName: "showSenderNames", isSignal: true, isRequired: false, transformFunction: null }, theme: { classPropertyName: "theme", publicName: "theme", isSignal: true, isRequired: false, transformFunction: null }, placeholder: { classPropertyName: "placeholder", publicName: "placeholder", isSignal: true, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null }, quickReplies: { classPropertyName: "quickReplies", publicName: "quickReplies", isSignal: true, isRequired: false, transformFunction: null }, avatarBg: { classPropertyName: "avatarBg", publicName: "avatarBg", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { sendMessage: "sendMessage", quickReplyClick: "quickReplyClick", cardActionClick: "cardActionClick", clearHistory: "clearHistory" }, viewQueries: [{ propertyName: "chatBody", first: true, predicate: ["chatBody"], descendants: true, isSignal: true }], ngImport: i0, template: `
|
|
162
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.20", type: AIChatComponent, isStandalone: true, selector: "ngx-ai-chat", inputs: { messages: { classPropertyName: "messages", publicName: "messages", isSignal: true, isRequired: false, transformFunction: null }, agentName: { classPropertyName: "agentName", publicName: "agentName", isSignal: true, isRequired: false, transformFunction: null }, agentAvatarUrl: { classPropertyName: "agentAvatarUrl", publicName: "agentAvatarUrl", isSignal: true, isRequired: false, transformFunction: null }, isOnline: { classPropertyName: "isOnline", publicName: "isOnline", isSignal: true, isRequired: false, transformFunction: null }, isTyping: { classPropertyName: "isTyping", publicName: "isTyping", isSignal: true, isRequired: false, transformFunction: null }, showSenderNames: { classPropertyName: "showSenderNames", publicName: "showSenderNames", isSignal: true, isRequired: false, transformFunction: null }, theme: { classPropertyName: "theme", publicName: "theme", isSignal: true, isRequired: false, transformFunction: null }, placeholder: { classPropertyName: "placeholder", publicName: "placeholder", isSignal: true, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null }, quickReplies: { classPropertyName: "quickReplies", publicName: "quickReplies", isSignal: true, isRequired: false, transformFunction: null }, avatarBg: { classPropertyName: "avatarBg", publicName: "avatarBg", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { sendMessage: "sendMessage", quickReplyClick: "quickReplyClick", cardActionClick: "cardActionClick", clearHistory: "clearHistory", messageFeedback: "messageFeedback", fileAttached: "fileAttached", messageSent: "messageSent" }, host: { listeners: { "click": "onHostClick($event)" } }, viewQueries: [{ propertyName: "chatBody", first: true, predicate: ["chatBody"], descendants: true, isSignal: true }], ngImport: i0, template: `
|
|
91
163
|
<div class="ngx-ai-chat-container" [class.dark-mode]="theme() === 'dark'">
|
|
92
164
|
<!-- Chat Header -->
|
|
93
165
|
<div class="ngx-ai-chat-header">
|
|
@@ -224,8 +296,34 @@ class AIChatComponent {
|
|
|
224
296
|
</div>
|
|
225
297
|
}
|
|
226
298
|
|
|
227
|
-
<!--
|
|
228
|
-
|
|
299
|
+
<!-- Attachments inside message bubble -->
|
|
300
|
+
@if (msg.attachments && msg.attachments.length > 0) {
|
|
301
|
+
<div class="message-attachments-list">
|
|
302
|
+
@for (att of msg.attachments; track att.name) {
|
|
303
|
+
<a [href]="att.url" target="_blank" class="msg-attachment-item" download>
|
|
304
|
+
@if (att.type.startsWith('image/')) {
|
|
305
|
+
<div class="msg-attachment-img-preview">
|
|
306
|
+
<img [src]="att.url" [alt]="att.name" />
|
|
307
|
+
</div>
|
|
308
|
+
} @else {
|
|
309
|
+
<span class="msg-attachment-icon">📄</span>
|
|
310
|
+
}
|
|
311
|
+
<span class="msg-attachment-name" [title]="att.name">{{ att.name }}</span>
|
|
312
|
+
</a>
|
|
313
|
+
}
|
|
314
|
+
</div>
|
|
315
|
+
}
|
|
316
|
+
|
|
317
|
+
<!-- Time & Feedback -->
|
|
318
|
+
<div class="msg-meta-row">
|
|
319
|
+
<span class="msg-time">{{ msg.timestamp | date:'shortTime' }}</span>
|
|
320
|
+
@if (msg.role !== 'user') {
|
|
321
|
+
<div class="feedback-actions">
|
|
322
|
+
<button type="button" class="feedback-tiny-btn" [class.selected]="msgFeedbackMap[msg.id] === 'like'" (click)="onMessageRating(msg.id, 'like')" title="Helpful">👍</button>
|
|
323
|
+
<button type="button" class="feedback-tiny-btn" [class.selected]="msgFeedbackMap[msg.id] === 'dislike'" (click)="onMessageRating(msg.id, 'dislike')" title="Unhelpful">👎</button>
|
|
324
|
+
</div>
|
|
325
|
+
}
|
|
326
|
+
</div>
|
|
229
327
|
</div>
|
|
230
328
|
</div>
|
|
231
329
|
}
|
|
@@ -268,7 +366,27 @@ class AIChatComponent {
|
|
|
268
366
|
|
|
269
367
|
<!-- Chat Footer / Input -->
|
|
270
368
|
<div class="ngx-ai-chat-footer">
|
|
369
|
+
<!-- Attachment Previews -->
|
|
370
|
+
@if (attachedFiles().length > 0) {
|
|
371
|
+
<div class="attachments-preview-bar">
|
|
372
|
+
@for (file of attachedFiles(); track file.name) {
|
|
373
|
+
<div class="attachment-preview-tag">
|
|
374
|
+
@if (file.type.startsWith('image/')) {
|
|
375
|
+
<img [src]="file.url" class="attachment-thumb" />
|
|
376
|
+
} @else {
|
|
377
|
+
<span class="attachment-icon">📄</span>
|
|
378
|
+
}
|
|
379
|
+
<span class="attachment-name">{{ file.name }}</span>
|
|
380
|
+
<button type="button" class="remove-attachment-btn" (click)="removeAttachment(file)">✕</button>
|
|
381
|
+
</div>
|
|
382
|
+
}
|
|
383
|
+
</div>
|
|
384
|
+
}
|
|
271
385
|
<form (ngSubmit)="onSubmit()" class="input-form">
|
|
386
|
+
<button type="button" class="attach-btn" (click)="fileInput.click()" title="Attach files" [disabled]="disabled()">
|
|
387
|
+
<svg viewBox="0 0 24 24" class="svg-icon"><path d="M16.5 6v11.5c0 2.21-1.79 4-4 4s-4-1.79-4-4V5a2.5 2.5 0 0 1 5 0v10.5c0 .83-.67 1.5-1.5 1.5s-1.5-.67-1.5-1.5V6H9v9.5c0 2.48 2.02 4.5 4.5 4.5s4.5-2.02 4.5-4.5V5a4 4 0 0 0-8 0v12c0 3.86 3.14 7 7 7s7-3.14 7-7V6h-1.5z"/></svg>
|
|
388
|
+
</button>
|
|
389
|
+
<input #fileInput type="file" style="display: none" (change)="onFileSelected($event)" multiple />
|
|
272
390
|
<input
|
|
273
391
|
type="text"
|
|
274
392
|
class="chat-input"
|
|
@@ -278,13 +396,13 @@ class AIChatComponent {
|
|
|
278
396
|
[disabled]="disabled()"
|
|
279
397
|
autocomplete="off"
|
|
280
398
|
/>
|
|
281
|
-
<button type="submit" class="send-btn" [disabled]="!inputText.trim() || disabled()" title="Send message">
|
|
399
|
+
<button type="submit" class="send-btn" [disabled]="(!inputText.trim() && attachedFiles().length === 0) || disabled()" title="Send message">
|
|
282
400
|
<svg viewBox="0 0 24 24" class="svg-icon"><path d="M2.01 21L23 12 2.01 3 2 10l15 2-15 2z"/></svg>
|
|
283
401
|
</button>
|
|
284
402
|
</form>
|
|
285
403
|
</div>
|
|
286
404
|
</div>
|
|
287
|
-
`, isInline: true, styles: [":host{display:block;height:100%;font-family:var(--ngx-font-family, system-ui, -apple-system, sans-serif)}.ngx-ai-chat-container{display:flex;flex-direction:column;height:100%;background:var(--ngx-ai-chat-bg, #ffffff);border:1px solid var(--ngx-ai-chat-border, #e2e8f0);border-radius:12px;overflow:hidden;box-shadow:0 4px 20px #0000000d;transition:all .3s ease}.ngx-ai-chat-container.dark-mode{--ngx-ai-chat-bg: #1e293b;--ngx-ai-chat-border: #334155;--ngx-ai-header-bg: #0f172a;--ngx-ai-header-text: #f8fafc;--ngx-ai-bubble-user-bg: #3b82f6;--ngx-ai-bubble-user-text: #ffffff;--ngx-ai-bubble-assistant-bg: #334155;--ngx-ai-bubble-assistant-text: #f8fafc;--ngx-ai-input-bg: #0f172a;--ngx-ai-input-text: #f8fafc;--ngx-ai-input-border: #334155}.ngx-ai-chat-header{display:flex;align-items:center;padding:14px 18px;background:var(--ngx-ai-header-bg, #f8fafc);border-bottom:1px solid var(--ngx-ai-chat-border, #e2e8f0);gap:12px}.header-avatar{position:relative;width:40px;height:40px;border-radius:50%;display:flex;align-items:center;justify-content:center;font-weight:700;color:#fff;font-size:14px}.header-avatar img{width:100%;height:100%;object-fit:cover;border-radius:50%}.status-indicator{position:absolute;bottom:0;right:0;width:10px;height:10px;border-radius:50%;background:#94a3b8;border:2px solid var(--ngx-ai-chat-bg, #fff)}.status-indicator.online{background:#10b981}.header-info{flex:1}.agent-title{font-weight:600;font-size:15px;color:var(--ngx-ai-header-text, #1e293b)}.agent-status{font-size:12px;color:#64748b}.header-actions{display:flex;gap:8px}.header-btn{background:none;border:none;padding:8px;border-radius:50%;cursor:pointer;color:#64748b;display:flex;align-items:center;justify-content:center;transition:background-color .2s}.header-btn:hover{background-color:#64748b1a}.svg-icon{width:20px;height:20px;fill:currentColor}.ngx-ai-chat-body{flex:1;overflow-y:auto;padding:16px 20px;display:flex;flex-direction:column}.messages-list{display:flex;flex-direction:column;gap:20px}.message-wrapper{display:flex;gap:12px;max-width:85%}.message-wrapper.user-msg{align-self:flex-end;flex-direction:row-reverse;max-width:75%}.message-wrapper.assistant-msg{align-self:flex-start}.msg-avatar{width:32px;height:32px;border-radius:50%;display:flex;align-items:center;justify-content:center;color:#fff;font-weight:600;font-size:12px;flex-shrink:0}.msg-avatar img{width:100%;height:100%;object-fit:cover;border-radius:50%}.msg-bubble-container{display:flex;flex-direction:column;gap:4px}.user-msg .msg-bubble-container{align-items:flex-end}.msg-sender{font-size:11px;font-weight:600;color:#64748b;margin-left:4px}.msg-bubble{padding:12px 16px;border-radius:16px;font-size:14px;line-height:1.5;word-break:break-word}.user-msg .msg-bubble{background:var(--ngx-ai-bubble-user-bg, #1a73e8);color:var(--ngx-ai-bubble-user-text, #ffffff);border-bottom-right-radius:4px}.assistant-msg .msg-bubble{background:var(--ngx-ai-bubble-assistant-bg, #f1f5f9);color:var(--ngx-ai-bubble-assistant-text, #1e293b);border-bottom-left-radius:4px}.msg-text{white-space:pre-wrap}.msg-time{font-size:10px;color:#94a3b8;margin:0 4px}.agent-steps-container{margin-top:10px;border:1px solid rgba(148,163,184,.2);border-radius:8px;overflow:hidden;background:#ffffff0d}.steps-header{display:flex;justify-content:space-between;align-items:center;padding:8px 12px;background:#94a3b81a;border-bottom:1px solid rgba(148,163,184,.1)}.steps-title-text{font-size:12px;font-weight:600;opacity:.8}.steps-badge{font-size:10px;font-weight:700;background:#94a3b833;padding:2px 6px;border-radius:10px}.steps-list{display:flex;flex-direction:column}.agent-step-item{border-bottom:1px solid rgba(148,163,184,.08)}.agent-step-item:last-child{border-bottom:none}.step-summary{display:flex;align-items:center;padding:8px 12px;cursor:pointer;font-size:12px;gap:8px;transition:background-color .2s}.step-summary:hover{background:#94a3b80d}.step-status-icon{width:16px;height:16px;border-radius:50%;display:flex;align-items:center;justify-content:center;font-size:10px;font-weight:700;color:#fff}.step-status-icon.success{background:#10b981}.step-status-icon.error{background:#ef4444}.step-status-icon.running{background:#3b82f6}.step-name{flex:1;font-weight:500}.step-duration{font-size:10px;opacity:.6}.step-chevron{font-size:8px;transition:transform .2s;opacity:.5}.step-chevron.expanded{transform:rotate(180deg)}.step-details{padding:8px 12px;background:#00000005;display:flex;flex-direction:column;gap:8px;border-top:1px solid rgba(148,163,184,.05)}.step-detail-section{display:flex;flex-direction:column;gap:4px}.detail-label{font-size:10px;font-weight:600;opacity:.6;text-transform:uppercase;letter-spacing:.3px}.detail-code{margin:0;padding:6px 10px;background:#0000000d;border-radius:4px;font-family:monospace;font-size:11px;overflow-x:auto;white-space:pre-wrap;max-height:120px}.cards-carousel{display:flex;gap:12px;overflow-x:auto;padding:10px 4px 6px;margin-top:8px;scroll-snap-type:x mandatory;scrollbar-width:thin}.cards-carousel::-webkit-scrollbar{height:6px}.cards-carousel::-webkit-scrollbar-thumb{background:#94a3b84d;border-radius:3px}.ai-carousel-card{flex:0 0 240px;background:var(--ngx-ai-chat-bg, #fff);border:1px solid var(--ngx-ai-chat-border, #e2e8f0);border-radius:12px;overflow:hidden;display:flex;flex-direction:column;scroll-snap-align:start;box-shadow:0 2px 8px #0000000a}.card-img-container{height:120px;overflow:hidden}.card-img-container img{width:100%;height:100%;object-fit:cover}.card-body{padding:12px;display:flex;flex-direction:column;flex:1}.card-title{font-size:14px;font-weight:600;margin:0 0 2px}.card-subtitle{font-size:12px;font-weight:500;color:#64748b;margin:0 0 6px}.card-description{font-size:12px;color:#64748b;line-height:1.4;margin:0 0 12px;flex:1}.card-actions{display:flex;flex-direction:column;gap:6px}.card-action-btn{width:100%;padding:6px 12px;font-size:12px;font-weight:600;border-radius:6px;border:1px solid var(--ngx-ai-chat-border, #e2e8f0);background:none;cursor:pointer;transition:all .2s}.card-action-btn.btn-primary{background:var(--ngx-ai-bubble-user-bg, #1a73e8);color:#fff;border-color:transparent}.card-action-btn:hover{opacity:.9;transform:translateY(-1px)}.typing-bubble{display:flex;align-items:center;justify-content:center;padding:12px 20px}.typing-indicator{display:flex;gap:4px}.typing-indicator span{width:8px;height:8px;background:#94a3b8;border-radius:50%;animation:typing 1.4s infinite ease-in-out both}.typing-indicator span:nth-child(1){animation-delay:-.32s}.typing-indicator span:nth-child(2){animation-delay:-.16s}@keyframes typing{0%,80%,to{transform:scale(0)}40%{transform:scale(1)}}.spinner{width:10px;height:10px;border:2px solid rgba(255,255,255,.3);border-radius:50%;border-top-color:#fff;animation:spin 1s ease-in-out infinite}@keyframes spin{to{transform:rotate(360deg)}}.quick-replies-container{padding:10px 16px 4px;background:transparent}.quick-replies-list{display:flex;gap:8px;overflow-x:auto;padding-bottom:6px;scrollbar-width:none}.quick-replies-list::-webkit-scrollbar{display:none}.quick-reply-btn{flex:0 0 auto;padding:6px 14px;border-radius:18px;border:1px solid var(--ngx-ai-chat-border, #e2e8f0);background:var(--ngx-ai-chat-bg, #fff);font-size:13px;font-weight:500;color:#64748b;cursor:pointer;display:flex;align-items:center;gap:6px;transition:all .2s}.quick-reply-btn:hover{border-color:var(--ngx-ai-bubble-user-bg, #1a73e8);color:var(--ngx-ai-bubble-user-bg, #1a73e8);background-color:#1a73e80a}.ngx-ai-chat-footer{padding:14px 18px;background:var(--ngx-ai-header-bg, #f8fafc);border-top:1px solid var(--ngx-ai-chat-border, #e2e8f0)}.input-form{display:flex;gap:10px}.chat-input{flex:1;padding:10px 14px;border-radius:8px;border:1px solid var(--ngx-ai-input-border, #cbd5e1);background:var(--ngx-ai-input-bg, #fff);color:var(--ngx-ai-input-text, #1e293b);font-size:14px;outline:none;transition:border-color .2s}.chat-input:focus{border-color:var(--ngx-ai-bubble-user-bg, #1a73e8)}.send-btn{width:38px;height:38px;border-radius:8px;background:var(--ngx-ai-bubble-user-bg, #1a73e8);color:#fff;border:none;cursor:pointer;display:flex;align-items:center;justify-content:center;transition:background-color .2s,transform .1s}.send-btn:hover:not(:disabled){background-color:#1557b0;transform:translateY(-1px)}.send-btn:disabled{background-color:#94a3b8;cursor:not-allowed}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "pipe", type: i1.DatePipe, name: "date" }, { kind: "ngmodule", type: FormsModule }, { kind: "directive", type: i2.ɵNgNoValidate, selector: "form:not([ngNoForm]):not([ngNativeValidate])" }, { kind: "directive", type: i2.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: i2.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i2.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i2.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "directive", type: i2.NgForm, selector: "form:not([ngNoForm]):not([formGroup]),ng-form,[ngForm]", inputs: ["ngFormOptions"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }] });
|
|
405
|
+
`, isInline: true, styles: [":host{display:block;height:100%;font-family:var(--ngx-font-family, system-ui, -apple-system, sans-serif)}.ngx-ai-chat-container{display:flex;flex-direction:column;height:100%;background:var(--ngx-ai-chat-bg, #ffffff);border:1px solid var(--ngx-ai-chat-border, #e2e8f0);border-radius:12px;overflow:hidden;box-shadow:0 4px 20px #0000000d;transition:all .3s ease}.ngx-ai-chat-container.dark-mode{--ngx-ai-chat-bg: #1e293b;--ngx-ai-chat-border: #334155;--ngx-ai-header-bg: #0f172a;--ngx-ai-header-text: #f8fafc;--ngx-ai-bubble-user-bg: #3b82f6;--ngx-ai-bubble-user-text: #ffffff;--ngx-ai-bubble-assistant-bg: #334155;--ngx-ai-bubble-assistant-text: #f8fafc;--ngx-ai-input-bg: #0f172a;--ngx-ai-input-text: #f8fafc;--ngx-ai-input-border: #334155}.ngx-ai-chat-header{display:flex;align-items:center;padding:14px 18px;background:var(--ngx-ai-header-bg, #f8fafc);border-bottom:1px solid var(--ngx-ai-chat-border, #e2e8f0);gap:12px}.header-avatar{position:relative;width:40px;height:40px;border-radius:50%;display:flex;align-items:center;justify-content:center;font-weight:700;color:#fff;font-size:14px}.header-avatar img{width:100%;height:100%;object-fit:cover;border-radius:50%}.status-indicator{position:absolute;bottom:0;right:0;width:10px;height:10px;border-radius:50%;background:#94a3b8;border:2px solid var(--ngx-ai-chat-bg, #fff)}.status-indicator.online{background:#10b981}.header-info{flex:1}.agent-title{font-weight:600;font-size:15px;color:var(--ngx-ai-header-text, #1e293b)}.agent-status{font-size:12px;color:#64748b}.header-actions{display:flex;gap:8px}.header-btn{background:none;border:none;padding:8px;border-radius:50%;cursor:pointer;color:#64748b;display:flex;align-items:center;justify-content:center;transition:background-color .2s}.header-btn:hover{background-color:#64748b1a}.svg-icon{width:20px;height:20px;fill:currentColor}.ngx-ai-chat-body{flex:1;overflow-y:auto;padding:16px 20px;display:flex;flex-direction:column}.messages-list{display:flex;flex-direction:column;gap:20px}.message-wrapper{display:flex;gap:12px;max-width:85%}.message-wrapper.user-msg{align-self:flex-end;flex-direction:row-reverse;max-width:75%}.message-wrapper.assistant-msg{align-self:flex-start}.msg-avatar{width:32px;height:32px;border-radius:50%;display:flex;align-items:center;justify-content:center;color:#fff;font-weight:600;font-size:12px;flex-shrink:0}.msg-avatar img{width:100%;height:100%;object-fit:cover;border-radius:50%}.msg-bubble-container{display:flex;flex-direction:column;gap:4px}.user-msg .msg-bubble-container{align-items:flex-end}.msg-sender{font-size:11px;font-weight:600;color:#64748b;margin-left:4px}.msg-bubble{padding:12px 16px;border-radius:16px;font-size:14px;line-height:1.5;word-break:break-word}.user-msg .msg-bubble{background:var(--ngx-ai-bubble-user-bg, #1a73e8);color:var(--ngx-ai-bubble-user-text, #ffffff);border-bottom-right-radius:4px}.assistant-msg .msg-bubble{background:var(--ngx-ai-bubble-assistant-bg, #f1f5f9);color:var(--ngx-ai-bubble-assistant-text, #1e293b);border-bottom-left-radius:4px}.msg-text{white-space:pre-wrap}.msg-time{font-size:10px;color:#94a3b8;margin:0 4px}.agent-steps-container{margin-top:10px;border:1px solid rgba(148,163,184,.2);border-radius:8px;overflow:hidden;background:#ffffff0d}.steps-header{display:flex;justify-content:space-between;align-items:center;padding:8px 12px;background:#94a3b81a;border-bottom:1px solid rgba(148,163,184,.1)}.steps-title-text{font-size:12px;font-weight:600;opacity:.8}.steps-badge{font-size:10px;font-weight:700;background:#94a3b833;padding:2px 6px;border-radius:10px}.steps-list{display:flex;flex-direction:column}.agent-step-item{border-bottom:1px solid rgba(148,163,184,.08)}.agent-step-item:last-child{border-bottom:none}.step-summary{display:flex;align-items:center;padding:8px 12px;cursor:pointer;font-size:12px;gap:8px;transition:background-color .2s}.step-summary:hover{background:#94a3b80d}.step-status-icon{width:16px;height:16px;border-radius:50%;display:flex;align-items:center;justify-content:center;font-size:10px;font-weight:700;color:#fff}.step-status-icon.success{background:#10b981}.step-status-icon.error{background:#ef4444}.step-status-icon.running{background:#3b82f6}.step-name{flex:1;font-weight:500}.step-duration{font-size:10px;opacity:.6}.step-chevron{font-size:8px;transition:transform .2s;opacity:.5}.step-chevron.expanded{transform:rotate(180deg)}.step-details{padding:8px 12px;background:#00000005;display:flex;flex-direction:column;gap:8px;border-top:1px solid rgba(148,163,184,.05)}.step-detail-section{display:flex;flex-direction:column;gap:4px}.detail-label{font-size:10px;font-weight:600;opacity:.6;text-transform:uppercase;letter-spacing:.3px}.detail-code{margin:0;padding:6px 10px;background:#0000000d;border-radius:4px;font-family:monospace;font-size:11px;overflow-x:auto;white-space:pre-wrap;max-height:120px}.cards-carousel{display:flex;gap:12px;overflow-x:auto;padding:10px 4px 6px;margin-top:8px;scroll-snap-type:x mandatory;scrollbar-width:thin}.cards-carousel::-webkit-scrollbar{height:6px}.cards-carousel::-webkit-scrollbar-thumb{background:#94a3b84d;border-radius:3px}.ai-carousel-card{flex:0 0 240px;background:var(--ngx-ai-chat-bg, #fff);border:1px solid var(--ngx-ai-chat-border, #e2e8f0);border-radius:12px;overflow:hidden;display:flex;flex-direction:column;scroll-snap-align:start;box-shadow:0 2px 8px #0000000a}.card-img-container{height:120px;overflow:hidden}.card-img-container img{width:100%;height:100%;object-fit:cover}.card-body{padding:12px;display:flex;flex-direction:column;flex:1}.card-title{font-size:14px;font-weight:600;margin:0 0 2px}.card-subtitle{font-size:12px;font-weight:500;color:#64748b;margin:0 0 6px}.card-description{font-size:12px;color:#64748b;line-height:1.4;margin:0 0 12px;flex:1}.card-actions{display:flex;flex-direction:column;gap:6px}.card-action-btn{width:100%;padding:6px 12px;font-size:12px;font-weight:600;border-radius:6px;border:1px solid var(--ngx-ai-chat-border, #e2e8f0);background:none;cursor:pointer;transition:all .2s}.card-action-btn.btn-primary{background:var(--ngx-ai-bubble-user-bg, #1a73e8);color:#fff;border-color:transparent}.card-action-btn:hover{opacity:.9;transform:translateY(-1px)}.typing-bubble{display:flex;align-items:center;justify-content:center;padding:12px 20px}.typing-indicator{display:flex;gap:4px}.typing-indicator span{width:8px;height:8px;background:#94a3b8;border-radius:50%;animation:typing 1.4s infinite ease-in-out both}.typing-indicator span:nth-child(1){animation-delay:-.32s}.typing-indicator span:nth-child(2){animation-delay:-.16s}@keyframes typing{0%,80%,to{transform:scale(0)}40%{transform:scale(1)}}.spinner{width:10px;height:10px;border:2px solid rgba(255,255,255,.3);border-radius:50%;border-top-color:#fff;animation:spin 1s ease-in-out infinite}@keyframes spin{to{transform:rotate(360deg)}}.quick-replies-container{padding:10px 16px 4px;background:transparent}.quick-replies-list{display:flex;gap:8px;overflow-x:auto;padding-bottom:6px;scrollbar-width:none}.quick-replies-list::-webkit-scrollbar{display:none}.quick-reply-btn{flex:0 0 auto;padding:6px 14px;border-radius:18px;border:1px solid var(--ngx-ai-chat-border, #e2e8f0);background:var(--ngx-ai-chat-bg, #fff);font-size:13px;font-weight:500;color:#64748b;cursor:pointer;display:flex;align-items:center;gap:6px;transition:all .2s}.quick-reply-btn:hover{border-color:var(--ngx-ai-bubble-user-bg, #1a73e8);color:var(--ngx-ai-bubble-user-bg, #1a73e8);background-color:#1a73e80a}.ngx-ai-chat-footer{padding:14px 18px;background:var(--ngx-ai-header-bg, #f8fafc);border-top:1px solid var(--ngx-ai-chat-border, #e2e8f0)}.input-form{display:flex;gap:10px}.chat-input{flex:1;padding:10px 14px;border-radius:8px;border:1px solid var(--ngx-ai-input-border, #cbd5e1);background:var(--ngx-ai-input-bg, #fff);color:var(--ngx-ai-input-text, #1e293b);font-size:14px;outline:none;transition:border-color .2s}.chat-input:focus{border-color:var(--ngx-ai-bubble-user-bg, #1a73e8)}.send-btn{width:38px;height:38px;border-radius:8px;background:var(--ngx-ai-bubble-user-bg, #1a73e8);color:#fff;border:none;cursor:pointer;display:flex;align-items:center;justify-content:center;transition:background-color .2s,transform .1s}.send-btn:hover:not(:disabled){background-color:#1557b0;transform:translateY(-1px)}.send-btn:disabled{background-color:#94a3b8;cursor:not-allowed}.attachments-preview-bar{display:flex;gap:8px;padding:8px;overflow-x:auto;border-bottom:1px solid var(--ngx-ai-chat-border, #e2e8f0);background:var(--ngx-ai-chat-bg, #ffffff)}.attachment-preview-tag{display:flex;align-items:center;gap:6px;padding:4px 8px;background:#f1f5f9;border:1px solid #cbd5e1;border-radius:6px;font-size:11px;max-width:150px}.attachment-thumb{width:18px;height:18px;object-fit:cover;border-radius:2px}.attachment-icon{font-size:12px}.attachment-name{white-space:nowrap;overflow:hidden;text-overflow:ellipsis;flex:1;color:#334155}.remove-attachment-btn{background:none;border:none;color:#94a3b8;cursor:pointer;padding:0 2px;font-size:10px}.remove-attachment-btn:hover{color:#ef4444}.message-attachments-list{display:flex;flex-direction:column;gap:6px;margin-top:8px}.msg-attachment-item{display:flex;align-items:center;gap:8px;padding:6px 10px;background:#ffffffb3;border:1px solid rgba(0,0,0,.06);border-radius:8px;text-decoration:none;color:inherit;max-width:250px;font-size:12px;transition:background .2s}.msg-attachment-item:hover{background:#ffffffe6}.msg-attachment-img-preview{width:32px;height:32px;overflow:hidden;border-radius:4px}.msg-attachment-img-preview img{width:100%;height:100%;object-fit:cover}.msg-attachment-icon{font-size:16px}.msg-attachment-name{white-space:nowrap;overflow:hidden;text-overflow:ellipsis;font-weight:500}.attach-btn{background:none;border:none;color:#64748b;cursor:pointer;display:flex;align-items:center;justify-content:center;padding:8px;border-radius:8px;transition:background .2s}.attach-btn:hover:not(:disabled){background:#64748b1a;color:#334155}.attach-btn:disabled{opacity:.5;cursor:not-allowed}.msg-meta-row{display:flex;justify-content:space-between;align-items:center;margin-top:4px;min-width:80px}.feedback-actions{display:flex;gap:4px;opacity:.3;transition:opacity .2s}.message-wrapper:hover .feedback-actions{opacity:1}.feedback-tiny-btn{background:transparent;border:none;cursor:pointer;font-size:10px;padding:2px;border-radius:4px;transition:background .2s}.feedback-tiny-btn:hover{background:#00000014}.feedback-tiny-btn.selected{background:#0000001f;transform:scale(1.1)}.dark-mode .attachments-preview-bar{border-bottom-color:var(--ngx-ai-chat-border, #334155);background:var(--ngx-ai-chat-bg, #1e293b)}.dark-mode .attachment-preview-tag{background:#334155;border-color:#475569}.dark-mode .attachment-name{color:#f8fafc}.dark-mode .msg-attachment-item{background:#0f172a66;border-color:#ffffff0f}.dark-mode .msg-attachment-item:hover{background:#0f172a99}.dark-mode .attach-btn{color:#94a3b8}.dark-mode .attach-btn:hover:not(:disabled){background:#ffffff0d;color:#f8fafc}.dark-mode .feedback-tiny-btn:hover{background:#ffffff14}.dark-mode .feedback-tiny-btn.selected{background:#ffffff26}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "pipe", type: i1.DatePipe, name: "date" }, { kind: "ngmodule", type: FormsModule }, { kind: "directive", type: i2.ɵNgNoValidate, selector: "form:not([ngNoForm]):not([ngNativeValidate])" }, { kind: "directive", type: i2.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: i2.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i2.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i2.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "directive", type: i2.NgForm, selector: "form:not([ngNoForm]):not([formGroup]),ng-form,[ngForm]", inputs: ["ngFormOptions"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }] });
|
|
288
406
|
}
|
|
289
407
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.20", ngImport: i0, type: AIChatComponent, decorators: [{
|
|
290
408
|
type: Component,
|
|
@@ -425,8 +543,34 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.20", ngImpo
|
|
|
425
543
|
</div>
|
|
426
544
|
}
|
|
427
545
|
|
|
428
|
-
<!--
|
|
429
|
-
|
|
546
|
+
<!-- Attachments inside message bubble -->
|
|
547
|
+
@if (msg.attachments && msg.attachments.length > 0) {
|
|
548
|
+
<div class="message-attachments-list">
|
|
549
|
+
@for (att of msg.attachments; track att.name) {
|
|
550
|
+
<a [href]="att.url" target="_blank" class="msg-attachment-item" download>
|
|
551
|
+
@if (att.type.startsWith('image/')) {
|
|
552
|
+
<div class="msg-attachment-img-preview">
|
|
553
|
+
<img [src]="att.url" [alt]="att.name" />
|
|
554
|
+
</div>
|
|
555
|
+
} @else {
|
|
556
|
+
<span class="msg-attachment-icon">📄</span>
|
|
557
|
+
}
|
|
558
|
+
<span class="msg-attachment-name" [title]="att.name">{{ att.name }}</span>
|
|
559
|
+
</a>
|
|
560
|
+
}
|
|
561
|
+
</div>
|
|
562
|
+
}
|
|
563
|
+
|
|
564
|
+
<!-- Time & Feedback -->
|
|
565
|
+
<div class="msg-meta-row">
|
|
566
|
+
<span class="msg-time">{{ msg.timestamp | date:'shortTime' }}</span>
|
|
567
|
+
@if (msg.role !== 'user') {
|
|
568
|
+
<div class="feedback-actions">
|
|
569
|
+
<button type="button" class="feedback-tiny-btn" [class.selected]="msgFeedbackMap[msg.id] === 'like'" (click)="onMessageRating(msg.id, 'like')" title="Helpful">👍</button>
|
|
570
|
+
<button type="button" class="feedback-tiny-btn" [class.selected]="msgFeedbackMap[msg.id] === 'dislike'" (click)="onMessageRating(msg.id, 'dislike')" title="Unhelpful">👎</button>
|
|
571
|
+
</div>
|
|
572
|
+
}
|
|
573
|
+
</div>
|
|
430
574
|
</div>
|
|
431
575
|
</div>
|
|
432
576
|
}
|
|
@@ -469,7 +613,27 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.20", ngImpo
|
|
|
469
613
|
|
|
470
614
|
<!-- Chat Footer / Input -->
|
|
471
615
|
<div class="ngx-ai-chat-footer">
|
|
616
|
+
<!-- Attachment Previews -->
|
|
617
|
+
@if (attachedFiles().length > 0) {
|
|
618
|
+
<div class="attachments-preview-bar">
|
|
619
|
+
@for (file of attachedFiles(); track file.name) {
|
|
620
|
+
<div class="attachment-preview-tag">
|
|
621
|
+
@if (file.type.startsWith('image/')) {
|
|
622
|
+
<img [src]="file.url" class="attachment-thumb" />
|
|
623
|
+
} @else {
|
|
624
|
+
<span class="attachment-icon">📄</span>
|
|
625
|
+
}
|
|
626
|
+
<span class="attachment-name">{{ file.name }}</span>
|
|
627
|
+
<button type="button" class="remove-attachment-btn" (click)="removeAttachment(file)">✕</button>
|
|
628
|
+
</div>
|
|
629
|
+
}
|
|
630
|
+
</div>
|
|
631
|
+
}
|
|
472
632
|
<form (ngSubmit)="onSubmit()" class="input-form">
|
|
633
|
+
<button type="button" class="attach-btn" (click)="fileInput.click()" title="Attach files" [disabled]="disabled()">
|
|
634
|
+
<svg viewBox="0 0 24 24" class="svg-icon"><path d="M16.5 6v11.5c0 2.21-1.79 4-4 4s-4-1.79-4-4V5a2.5 2.5 0 0 1 5 0v10.5c0 .83-.67 1.5-1.5 1.5s-1.5-.67-1.5-1.5V6H9v9.5c0 2.48 2.02 4.5 4.5 4.5s4.5-2.02 4.5-4.5V5a4 4 0 0 0-8 0v12c0 3.86 3.14 7 7 7s7-3.14 7-7V6h-1.5z"/></svg>
|
|
635
|
+
</button>
|
|
636
|
+
<input #fileInput type="file" style="display: none" (change)="onFileSelected($event)" multiple />
|
|
473
637
|
<input
|
|
474
638
|
type="text"
|
|
475
639
|
class="chat-input"
|
|
@@ -479,14 +643,17 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.20", ngImpo
|
|
|
479
643
|
[disabled]="disabled()"
|
|
480
644
|
autocomplete="off"
|
|
481
645
|
/>
|
|
482
|
-
<button type="submit" class="send-btn" [disabled]="!inputText.trim() || disabled()" title="Send message">
|
|
646
|
+
<button type="submit" class="send-btn" [disabled]="(!inputText.trim() && attachedFiles().length === 0) || disabled()" title="Send message">
|
|
483
647
|
<svg viewBox="0 0 24 24" class="svg-icon"><path d="M2.01 21L23 12 2.01 3 2 10l15 2-15 2z"/></svg>
|
|
484
648
|
</button>
|
|
485
649
|
</form>
|
|
486
650
|
</div>
|
|
487
651
|
</div>
|
|
488
|
-
`, styles: [":host{display:block;height:100%;font-family:var(--ngx-font-family, system-ui, -apple-system, sans-serif)}.ngx-ai-chat-container{display:flex;flex-direction:column;height:100%;background:var(--ngx-ai-chat-bg, #ffffff);border:1px solid var(--ngx-ai-chat-border, #e2e8f0);border-radius:12px;overflow:hidden;box-shadow:0 4px 20px #0000000d;transition:all .3s ease}.ngx-ai-chat-container.dark-mode{--ngx-ai-chat-bg: #1e293b;--ngx-ai-chat-border: #334155;--ngx-ai-header-bg: #0f172a;--ngx-ai-header-text: #f8fafc;--ngx-ai-bubble-user-bg: #3b82f6;--ngx-ai-bubble-user-text: #ffffff;--ngx-ai-bubble-assistant-bg: #334155;--ngx-ai-bubble-assistant-text: #f8fafc;--ngx-ai-input-bg: #0f172a;--ngx-ai-input-text: #f8fafc;--ngx-ai-input-border: #334155}.ngx-ai-chat-header{display:flex;align-items:center;padding:14px 18px;background:var(--ngx-ai-header-bg, #f8fafc);border-bottom:1px solid var(--ngx-ai-chat-border, #e2e8f0);gap:12px}.header-avatar{position:relative;width:40px;height:40px;border-radius:50%;display:flex;align-items:center;justify-content:center;font-weight:700;color:#fff;font-size:14px}.header-avatar img{width:100%;height:100%;object-fit:cover;border-radius:50%}.status-indicator{position:absolute;bottom:0;right:0;width:10px;height:10px;border-radius:50%;background:#94a3b8;border:2px solid var(--ngx-ai-chat-bg, #fff)}.status-indicator.online{background:#10b981}.header-info{flex:1}.agent-title{font-weight:600;font-size:15px;color:var(--ngx-ai-header-text, #1e293b)}.agent-status{font-size:12px;color:#64748b}.header-actions{display:flex;gap:8px}.header-btn{background:none;border:none;padding:8px;border-radius:50%;cursor:pointer;color:#64748b;display:flex;align-items:center;justify-content:center;transition:background-color .2s}.header-btn:hover{background-color:#64748b1a}.svg-icon{width:20px;height:20px;fill:currentColor}.ngx-ai-chat-body{flex:1;overflow-y:auto;padding:16px 20px;display:flex;flex-direction:column}.messages-list{display:flex;flex-direction:column;gap:20px}.message-wrapper{display:flex;gap:12px;max-width:85%}.message-wrapper.user-msg{align-self:flex-end;flex-direction:row-reverse;max-width:75%}.message-wrapper.assistant-msg{align-self:flex-start}.msg-avatar{width:32px;height:32px;border-radius:50%;display:flex;align-items:center;justify-content:center;color:#fff;font-weight:600;font-size:12px;flex-shrink:0}.msg-avatar img{width:100%;height:100%;object-fit:cover;border-radius:50%}.msg-bubble-container{display:flex;flex-direction:column;gap:4px}.user-msg .msg-bubble-container{align-items:flex-end}.msg-sender{font-size:11px;font-weight:600;color:#64748b;margin-left:4px}.msg-bubble{padding:12px 16px;border-radius:16px;font-size:14px;line-height:1.5;word-break:break-word}.user-msg .msg-bubble{background:var(--ngx-ai-bubble-user-bg, #1a73e8);color:var(--ngx-ai-bubble-user-text, #ffffff);border-bottom-right-radius:4px}.assistant-msg .msg-bubble{background:var(--ngx-ai-bubble-assistant-bg, #f1f5f9);color:var(--ngx-ai-bubble-assistant-text, #1e293b);border-bottom-left-radius:4px}.msg-text{white-space:pre-wrap}.msg-time{font-size:10px;color:#94a3b8;margin:0 4px}.agent-steps-container{margin-top:10px;border:1px solid rgba(148,163,184,.2);border-radius:8px;overflow:hidden;background:#ffffff0d}.steps-header{display:flex;justify-content:space-between;align-items:center;padding:8px 12px;background:#94a3b81a;border-bottom:1px solid rgba(148,163,184,.1)}.steps-title-text{font-size:12px;font-weight:600;opacity:.8}.steps-badge{font-size:10px;font-weight:700;background:#94a3b833;padding:2px 6px;border-radius:10px}.steps-list{display:flex;flex-direction:column}.agent-step-item{border-bottom:1px solid rgba(148,163,184,.08)}.agent-step-item:last-child{border-bottom:none}.step-summary{display:flex;align-items:center;padding:8px 12px;cursor:pointer;font-size:12px;gap:8px;transition:background-color .2s}.step-summary:hover{background:#94a3b80d}.step-status-icon{width:16px;height:16px;border-radius:50%;display:flex;align-items:center;justify-content:center;font-size:10px;font-weight:700;color:#fff}.step-status-icon.success{background:#10b981}.step-status-icon.error{background:#ef4444}.step-status-icon.running{background:#3b82f6}.step-name{flex:1;font-weight:500}.step-duration{font-size:10px;opacity:.6}.step-chevron{font-size:8px;transition:transform .2s;opacity:.5}.step-chevron.expanded{transform:rotate(180deg)}.step-details{padding:8px 12px;background:#00000005;display:flex;flex-direction:column;gap:8px;border-top:1px solid rgba(148,163,184,.05)}.step-detail-section{display:flex;flex-direction:column;gap:4px}.detail-label{font-size:10px;font-weight:600;opacity:.6;text-transform:uppercase;letter-spacing:.3px}.detail-code{margin:0;padding:6px 10px;background:#0000000d;border-radius:4px;font-family:monospace;font-size:11px;overflow-x:auto;white-space:pre-wrap;max-height:120px}.cards-carousel{display:flex;gap:12px;overflow-x:auto;padding:10px 4px 6px;margin-top:8px;scroll-snap-type:x mandatory;scrollbar-width:thin}.cards-carousel::-webkit-scrollbar{height:6px}.cards-carousel::-webkit-scrollbar-thumb{background:#94a3b84d;border-radius:3px}.ai-carousel-card{flex:0 0 240px;background:var(--ngx-ai-chat-bg, #fff);border:1px solid var(--ngx-ai-chat-border, #e2e8f0);border-radius:12px;overflow:hidden;display:flex;flex-direction:column;scroll-snap-align:start;box-shadow:0 2px 8px #0000000a}.card-img-container{height:120px;overflow:hidden}.card-img-container img{width:100%;height:100%;object-fit:cover}.card-body{padding:12px;display:flex;flex-direction:column;flex:1}.card-title{font-size:14px;font-weight:600;margin:0 0 2px}.card-subtitle{font-size:12px;font-weight:500;color:#64748b;margin:0 0 6px}.card-description{font-size:12px;color:#64748b;line-height:1.4;margin:0 0 12px;flex:1}.card-actions{display:flex;flex-direction:column;gap:6px}.card-action-btn{width:100%;padding:6px 12px;font-size:12px;font-weight:600;border-radius:6px;border:1px solid var(--ngx-ai-chat-border, #e2e8f0);background:none;cursor:pointer;transition:all .2s}.card-action-btn.btn-primary{background:var(--ngx-ai-bubble-user-bg, #1a73e8);color:#fff;border-color:transparent}.card-action-btn:hover{opacity:.9;transform:translateY(-1px)}.typing-bubble{display:flex;align-items:center;justify-content:center;padding:12px 20px}.typing-indicator{display:flex;gap:4px}.typing-indicator span{width:8px;height:8px;background:#94a3b8;border-radius:50%;animation:typing 1.4s infinite ease-in-out both}.typing-indicator span:nth-child(1){animation-delay:-.32s}.typing-indicator span:nth-child(2){animation-delay:-.16s}@keyframes typing{0%,80%,to{transform:scale(0)}40%{transform:scale(1)}}.spinner{width:10px;height:10px;border:2px solid rgba(255,255,255,.3);border-radius:50%;border-top-color:#fff;animation:spin 1s ease-in-out infinite}@keyframes spin{to{transform:rotate(360deg)}}.quick-replies-container{padding:10px 16px 4px;background:transparent}.quick-replies-list{display:flex;gap:8px;overflow-x:auto;padding-bottom:6px;scrollbar-width:none}.quick-replies-list::-webkit-scrollbar{display:none}.quick-reply-btn{flex:0 0 auto;padding:6px 14px;border-radius:18px;border:1px solid var(--ngx-ai-chat-border, #e2e8f0);background:var(--ngx-ai-chat-bg, #fff);font-size:13px;font-weight:500;color:#64748b;cursor:pointer;display:flex;align-items:center;gap:6px;transition:all .2s}.quick-reply-btn:hover{border-color:var(--ngx-ai-bubble-user-bg, #1a73e8);color:var(--ngx-ai-bubble-user-bg, #1a73e8);background-color:#1a73e80a}.ngx-ai-chat-footer{padding:14px 18px;background:var(--ngx-ai-header-bg, #f8fafc);border-top:1px solid var(--ngx-ai-chat-border, #e2e8f0)}.input-form{display:flex;gap:10px}.chat-input{flex:1;padding:10px 14px;border-radius:8px;border:1px solid var(--ngx-ai-input-border, #cbd5e1);background:var(--ngx-ai-input-bg, #fff);color:var(--ngx-ai-input-text, #1e293b);font-size:14px;outline:none;transition:border-color .2s}.chat-input:focus{border-color:var(--ngx-ai-bubble-user-bg, #1a73e8)}.send-btn{width:38px;height:38px;border-radius:8px;background:var(--ngx-ai-bubble-user-bg, #1a73e8);color:#fff;border:none;cursor:pointer;display:flex;align-items:center;justify-content:center;transition:background-color .2s,transform .1s}.send-btn:hover:not(:disabled){background-color:#1557b0;transform:translateY(-1px)}.send-btn:disabled{background-color:#94a3b8;cursor:not-allowed}\n"] }]
|
|
489
|
-
}], ctorParameters: () => []
|
|
652
|
+
`, styles: [":host{display:block;height:100%;font-family:var(--ngx-font-family, system-ui, -apple-system, sans-serif)}.ngx-ai-chat-container{display:flex;flex-direction:column;height:100%;background:var(--ngx-ai-chat-bg, #ffffff);border:1px solid var(--ngx-ai-chat-border, #e2e8f0);border-radius:12px;overflow:hidden;box-shadow:0 4px 20px #0000000d;transition:all .3s ease}.ngx-ai-chat-container.dark-mode{--ngx-ai-chat-bg: #1e293b;--ngx-ai-chat-border: #334155;--ngx-ai-header-bg: #0f172a;--ngx-ai-header-text: #f8fafc;--ngx-ai-bubble-user-bg: #3b82f6;--ngx-ai-bubble-user-text: #ffffff;--ngx-ai-bubble-assistant-bg: #334155;--ngx-ai-bubble-assistant-text: #f8fafc;--ngx-ai-input-bg: #0f172a;--ngx-ai-input-text: #f8fafc;--ngx-ai-input-border: #334155}.ngx-ai-chat-header{display:flex;align-items:center;padding:14px 18px;background:var(--ngx-ai-header-bg, #f8fafc);border-bottom:1px solid var(--ngx-ai-chat-border, #e2e8f0);gap:12px}.header-avatar{position:relative;width:40px;height:40px;border-radius:50%;display:flex;align-items:center;justify-content:center;font-weight:700;color:#fff;font-size:14px}.header-avatar img{width:100%;height:100%;object-fit:cover;border-radius:50%}.status-indicator{position:absolute;bottom:0;right:0;width:10px;height:10px;border-radius:50%;background:#94a3b8;border:2px solid var(--ngx-ai-chat-bg, #fff)}.status-indicator.online{background:#10b981}.header-info{flex:1}.agent-title{font-weight:600;font-size:15px;color:var(--ngx-ai-header-text, #1e293b)}.agent-status{font-size:12px;color:#64748b}.header-actions{display:flex;gap:8px}.header-btn{background:none;border:none;padding:8px;border-radius:50%;cursor:pointer;color:#64748b;display:flex;align-items:center;justify-content:center;transition:background-color .2s}.header-btn:hover{background-color:#64748b1a}.svg-icon{width:20px;height:20px;fill:currentColor}.ngx-ai-chat-body{flex:1;overflow-y:auto;padding:16px 20px;display:flex;flex-direction:column}.messages-list{display:flex;flex-direction:column;gap:20px}.message-wrapper{display:flex;gap:12px;max-width:85%}.message-wrapper.user-msg{align-self:flex-end;flex-direction:row-reverse;max-width:75%}.message-wrapper.assistant-msg{align-self:flex-start}.msg-avatar{width:32px;height:32px;border-radius:50%;display:flex;align-items:center;justify-content:center;color:#fff;font-weight:600;font-size:12px;flex-shrink:0}.msg-avatar img{width:100%;height:100%;object-fit:cover;border-radius:50%}.msg-bubble-container{display:flex;flex-direction:column;gap:4px}.user-msg .msg-bubble-container{align-items:flex-end}.msg-sender{font-size:11px;font-weight:600;color:#64748b;margin-left:4px}.msg-bubble{padding:12px 16px;border-radius:16px;font-size:14px;line-height:1.5;word-break:break-word}.user-msg .msg-bubble{background:var(--ngx-ai-bubble-user-bg, #1a73e8);color:var(--ngx-ai-bubble-user-text, #ffffff);border-bottom-right-radius:4px}.assistant-msg .msg-bubble{background:var(--ngx-ai-bubble-assistant-bg, #f1f5f9);color:var(--ngx-ai-bubble-assistant-text, #1e293b);border-bottom-left-radius:4px}.msg-text{white-space:pre-wrap}.msg-time{font-size:10px;color:#94a3b8;margin:0 4px}.agent-steps-container{margin-top:10px;border:1px solid rgba(148,163,184,.2);border-radius:8px;overflow:hidden;background:#ffffff0d}.steps-header{display:flex;justify-content:space-between;align-items:center;padding:8px 12px;background:#94a3b81a;border-bottom:1px solid rgba(148,163,184,.1)}.steps-title-text{font-size:12px;font-weight:600;opacity:.8}.steps-badge{font-size:10px;font-weight:700;background:#94a3b833;padding:2px 6px;border-radius:10px}.steps-list{display:flex;flex-direction:column}.agent-step-item{border-bottom:1px solid rgba(148,163,184,.08)}.agent-step-item:last-child{border-bottom:none}.step-summary{display:flex;align-items:center;padding:8px 12px;cursor:pointer;font-size:12px;gap:8px;transition:background-color .2s}.step-summary:hover{background:#94a3b80d}.step-status-icon{width:16px;height:16px;border-radius:50%;display:flex;align-items:center;justify-content:center;font-size:10px;font-weight:700;color:#fff}.step-status-icon.success{background:#10b981}.step-status-icon.error{background:#ef4444}.step-status-icon.running{background:#3b82f6}.step-name{flex:1;font-weight:500}.step-duration{font-size:10px;opacity:.6}.step-chevron{font-size:8px;transition:transform .2s;opacity:.5}.step-chevron.expanded{transform:rotate(180deg)}.step-details{padding:8px 12px;background:#00000005;display:flex;flex-direction:column;gap:8px;border-top:1px solid rgba(148,163,184,.05)}.step-detail-section{display:flex;flex-direction:column;gap:4px}.detail-label{font-size:10px;font-weight:600;opacity:.6;text-transform:uppercase;letter-spacing:.3px}.detail-code{margin:0;padding:6px 10px;background:#0000000d;border-radius:4px;font-family:monospace;font-size:11px;overflow-x:auto;white-space:pre-wrap;max-height:120px}.cards-carousel{display:flex;gap:12px;overflow-x:auto;padding:10px 4px 6px;margin-top:8px;scroll-snap-type:x mandatory;scrollbar-width:thin}.cards-carousel::-webkit-scrollbar{height:6px}.cards-carousel::-webkit-scrollbar-thumb{background:#94a3b84d;border-radius:3px}.ai-carousel-card{flex:0 0 240px;background:var(--ngx-ai-chat-bg, #fff);border:1px solid var(--ngx-ai-chat-border, #e2e8f0);border-radius:12px;overflow:hidden;display:flex;flex-direction:column;scroll-snap-align:start;box-shadow:0 2px 8px #0000000a}.card-img-container{height:120px;overflow:hidden}.card-img-container img{width:100%;height:100%;object-fit:cover}.card-body{padding:12px;display:flex;flex-direction:column;flex:1}.card-title{font-size:14px;font-weight:600;margin:0 0 2px}.card-subtitle{font-size:12px;font-weight:500;color:#64748b;margin:0 0 6px}.card-description{font-size:12px;color:#64748b;line-height:1.4;margin:0 0 12px;flex:1}.card-actions{display:flex;flex-direction:column;gap:6px}.card-action-btn{width:100%;padding:6px 12px;font-size:12px;font-weight:600;border-radius:6px;border:1px solid var(--ngx-ai-chat-border, #e2e8f0);background:none;cursor:pointer;transition:all .2s}.card-action-btn.btn-primary{background:var(--ngx-ai-bubble-user-bg, #1a73e8);color:#fff;border-color:transparent}.card-action-btn:hover{opacity:.9;transform:translateY(-1px)}.typing-bubble{display:flex;align-items:center;justify-content:center;padding:12px 20px}.typing-indicator{display:flex;gap:4px}.typing-indicator span{width:8px;height:8px;background:#94a3b8;border-radius:50%;animation:typing 1.4s infinite ease-in-out both}.typing-indicator span:nth-child(1){animation-delay:-.32s}.typing-indicator span:nth-child(2){animation-delay:-.16s}@keyframes typing{0%,80%,to{transform:scale(0)}40%{transform:scale(1)}}.spinner{width:10px;height:10px;border:2px solid rgba(255,255,255,.3);border-radius:50%;border-top-color:#fff;animation:spin 1s ease-in-out infinite}@keyframes spin{to{transform:rotate(360deg)}}.quick-replies-container{padding:10px 16px 4px;background:transparent}.quick-replies-list{display:flex;gap:8px;overflow-x:auto;padding-bottom:6px;scrollbar-width:none}.quick-replies-list::-webkit-scrollbar{display:none}.quick-reply-btn{flex:0 0 auto;padding:6px 14px;border-radius:18px;border:1px solid var(--ngx-ai-chat-border, #e2e8f0);background:var(--ngx-ai-chat-bg, #fff);font-size:13px;font-weight:500;color:#64748b;cursor:pointer;display:flex;align-items:center;gap:6px;transition:all .2s}.quick-reply-btn:hover{border-color:var(--ngx-ai-bubble-user-bg, #1a73e8);color:var(--ngx-ai-bubble-user-bg, #1a73e8);background-color:#1a73e80a}.ngx-ai-chat-footer{padding:14px 18px;background:var(--ngx-ai-header-bg, #f8fafc);border-top:1px solid var(--ngx-ai-chat-border, #e2e8f0)}.input-form{display:flex;gap:10px}.chat-input{flex:1;padding:10px 14px;border-radius:8px;border:1px solid var(--ngx-ai-input-border, #cbd5e1);background:var(--ngx-ai-input-bg, #fff);color:var(--ngx-ai-input-text, #1e293b);font-size:14px;outline:none;transition:border-color .2s}.chat-input:focus{border-color:var(--ngx-ai-bubble-user-bg, #1a73e8)}.send-btn{width:38px;height:38px;border-radius:8px;background:var(--ngx-ai-bubble-user-bg, #1a73e8);color:#fff;border:none;cursor:pointer;display:flex;align-items:center;justify-content:center;transition:background-color .2s,transform .1s}.send-btn:hover:not(:disabled){background-color:#1557b0;transform:translateY(-1px)}.send-btn:disabled{background-color:#94a3b8;cursor:not-allowed}.attachments-preview-bar{display:flex;gap:8px;padding:8px;overflow-x:auto;border-bottom:1px solid var(--ngx-ai-chat-border, #e2e8f0);background:var(--ngx-ai-chat-bg, #ffffff)}.attachment-preview-tag{display:flex;align-items:center;gap:6px;padding:4px 8px;background:#f1f5f9;border:1px solid #cbd5e1;border-radius:6px;font-size:11px;max-width:150px}.attachment-thumb{width:18px;height:18px;object-fit:cover;border-radius:2px}.attachment-icon{font-size:12px}.attachment-name{white-space:nowrap;overflow:hidden;text-overflow:ellipsis;flex:1;color:#334155}.remove-attachment-btn{background:none;border:none;color:#94a3b8;cursor:pointer;padding:0 2px;font-size:10px}.remove-attachment-btn:hover{color:#ef4444}.message-attachments-list{display:flex;flex-direction:column;gap:6px;margin-top:8px}.msg-attachment-item{display:flex;align-items:center;gap:8px;padding:6px 10px;background:#ffffffb3;border:1px solid rgba(0,0,0,.06);border-radius:8px;text-decoration:none;color:inherit;max-width:250px;font-size:12px;transition:background .2s}.msg-attachment-item:hover{background:#ffffffe6}.msg-attachment-img-preview{width:32px;height:32px;overflow:hidden;border-radius:4px}.msg-attachment-img-preview img{width:100%;height:100%;object-fit:cover}.msg-attachment-icon{font-size:16px}.msg-attachment-name{white-space:nowrap;overflow:hidden;text-overflow:ellipsis;font-weight:500}.attach-btn{background:none;border:none;color:#64748b;cursor:pointer;display:flex;align-items:center;justify-content:center;padding:8px;border-radius:8px;transition:background .2s}.attach-btn:hover:not(:disabled){background:#64748b1a;color:#334155}.attach-btn:disabled{opacity:.5;cursor:not-allowed}.msg-meta-row{display:flex;justify-content:space-between;align-items:center;margin-top:4px;min-width:80px}.feedback-actions{display:flex;gap:4px;opacity:.3;transition:opacity .2s}.message-wrapper:hover .feedback-actions{opacity:1}.feedback-tiny-btn{background:transparent;border:none;cursor:pointer;font-size:10px;padding:2px;border-radius:4px;transition:background .2s}.feedback-tiny-btn:hover{background:#00000014}.feedback-tiny-btn.selected{background:#0000001f;transform:scale(1.1)}.dark-mode .attachments-preview-bar{border-bottom-color:var(--ngx-ai-chat-border, #334155);background:var(--ngx-ai-chat-bg, #1e293b)}.dark-mode .attachment-preview-tag{background:#334155;border-color:#475569}.dark-mode .attachment-name{color:#f8fafc}.dark-mode .msg-attachment-item{background:#0f172a66;border-color:#ffffff0f}.dark-mode .msg-attachment-item:hover{background:#0f172a99}.dark-mode .attach-btn{color:#94a3b8}.dark-mode .attach-btn:hover:not(:disabled){background:#ffffff0d;color:#f8fafc}.dark-mode .feedback-tiny-btn:hover{background:#ffffff14}.dark-mode .feedback-tiny-btn.selected{background:#ffffff26}\n"] }]
|
|
653
|
+
}], ctorParameters: () => [], propDecorators: { onHostClick: [{
|
|
654
|
+
type: HostListener,
|
|
655
|
+
args: ['click', ['$event']]
|
|
656
|
+
}] } });
|
|
490
657
|
|
|
491
658
|
class AIChatWidgetComponent {
|
|
492
659
|
agentName = input('AI Assistant');
|
|
@@ -1048,6 +1215,7 @@ class AICodeEditorComponent {
|
|
|
1048
1215
|
// Inputs
|
|
1049
1216
|
code = input('');
|
|
1050
1217
|
suggestion = input('');
|
|
1218
|
+
suggestions = input([]);
|
|
1051
1219
|
language = input('typescript');
|
|
1052
1220
|
theme = input('light');
|
|
1053
1221
|
disabled = input(false);
|
|
@@ -1063,11 +1231,177 @@ class AICodeEditorComponent {
|
|
|
1063
1231
|
showExplanation = signal(false);
|
|
1064
1232
|
copyText = signal('Copy');
|
|
1065
1233
|
copyTooltip = signal('Copy code to clipboard');
|
|
1234
|
+
activeSuggestionIndex = signal(0);
|
|
1235
|
+
diffMode = signal(false);
|
|
1236
|
+
// Computed suggestion resolution
|
|
1237
|
+
currentSuggestion = computed(() => {
|
|
1238
|
+
const list = this.suggestions() || [];
|
|
1239
|
+
if (list.length > 0) {
|
|
1240
|
+
const idx = this.activeSuggestionIndex();
|
|
1241
|
+
return list[idx] || '';
|
|
1242
|
+
}
|
|
1243
|
+
return this.suggestion() || '';
|
|
1244
|
+
});
|
|
1245
|
+
hasSuggestion = computed(() => !!this.currentSuggestion());
|
|
1066
1246
|
// Lines computed property for line numbers
|
|
1067
1247
|
lines = () => {
|
|
1068
1248
|
const rawCode = this.code() || '';
|
|
1069
1249
|
return rawCode.split('\n');
|
|
1070
1250
|
};
|
|
1251
|
+
highlightedCode = computed(() => {
|
|
1252
|
+
const raw = this.code() || '';
|
|
1253
|
+
if (!raw)
|
|
1254
|
+
return '';
|
|
1255
|
+
const escaped = this.escapeHtml(raw);
|
|
1256
|
+
const lang = (this.language() || 'typescript').toLowerCase();
|
|
1257
|
+
if (lang === 'typescript' || lang === 'javascript' || lang === 'js' || lang === 'ts') {
|
|
1258
|
+
return this.highlightJS(escaped);
|
|
1259
|
+
}
|
|
1260
|
+
else if (lang === 'json') {
|
|
1261
|
+
return this.highlightJSON(escaped);
|
|
1262
|
+
}
|
|
1263
|
+
else if (lang === 'css') {
|
|
1264
|
+
return this.highlightCSS(escaped);
|
|
1265
|
+
}
|
|
1266
|
+
else if (lang === 'html' || lang === 'xml') {
|
|
1267
|
+
return this.highlightHTML(escaped);
|
|
1268
|
+
}
|
|
1269
|
+
return escaped;
|
|
1270
|
+
});
|
|
1271
|
+
highlightJS(text) {
|
|
1272
|
+
const comments = [];
|
|
1273
|
+
const strings = [];
|
|
1274
|
+
let temp = text;
|
|
1275
|
+
temp = temp.replace(/\/\*[\s\S]*?\*\//g, (match) => {
|
|
1276
|
+
comments.push(match);
|
|
1277
|
+
return `___COMMENT_${comments.length - 1}___`;
|
|
1278
|
+
});
|
|
1279
|
+
temp = temp.replace(/(?<!:)\/\/.*$/gm, (match) => {
|
|
1280
|
+
comments.push(match);
|
|
1281
|
+
return `___COMMENT_${comments.length - 1}___`;
|
|
1282
|
+
});
|
|
1283
|
+
temp = temp.replace(/"(\\.|[^"\\])*"/g, (match) => {
|
|
1284
|
+
strings.push(match);
|
|
1285
|
+
return `___STRING_${strings.length - 1}___`;
|
|
1286
|
+
});
|
|
1287
|
+
temp = temp.replace(/'(\\.|[^'\\])*'/g, (match) => {
|
|
1288
|
+
strings.push(match);
|
|
1289
|
+
return `___STRING_${strings.length - 1}___`;
|
|
1290
|
+
});
|
|
1291
|
+
temp = temp.replace(/`(\\.|[^`\\])*`/g, (match) => {
|
|
1292
|
+
strings.push(match);
|
|
1293
|
+
return `___STRING_${strings.length - 1}___`;
|
|
1294
|
+
});
|
|
1295
|
+
const keywords = [
|
|
1296
|
+
'const', 'let', 'var', 'function', 'class', 'return', 'import', 'export', 'from', 'as',
|
|
1297
|
+
'extends', 'implements', 'if', 'else', 'for', 'while', 'do', 'switch', 'case', 'break',
|
|
1298
|
+
'continue', 'default', 'new', 'this', 'typeof', 'instanceof', 'async', 'await',
|
|
1299
|
+
'try', 'catch', 'finally', 'throw', 'interface', 'type', 'readonly', 'private',
|
|
1300
|
+
'public', 'protected', 'constructor', 'super', 'get', 'set'
|
|
1301
|
+
];
|
|
1302
|
+
const builtins = [
|
|
1303
|
+
'String', 'Number', 'Boolean', 'Array', 'Object', 'Function', 'Promise', 'Observable',
|
|
1304
|
+
'signal', 'computed', 'input', 'output', 'Component', 'Injectable', 'Directive', 'Pipe', 'NgModule',
|
|
1305
|
+
'true', 'false', 'null', 'undefined'
|
|
1306
|
+
];
|
|
1307
|
+
const keywordRegex = new RegExp(`\\b(${keywords.join('|')})\\b`, 'g');
|
|
1308
|
+
temp = temp.replace(keywordRegex, '<span class="hl-keyword">$1</span>');
|
|
1309
|
+
const builtinRegex = new RegExp(`\\b(${builtins.join('|')})\\b`, 'g');
|
|
1310
|
+
temp = temp.replace(builtinRegex, '<span class="hl-builtin">$1</span>');
|
|
1311
|
+
temp = temp.replace(/\b(\d+)\b/g, '<span class="hl-number">$1</span>');
|
|
1312
|
+
temp = temp.replace(/\b(\w+)(?=\()/g, '<span class="hl-function">$1</span>');
|
|
1313
|
+
strings.forEach((str, idx) => {
|
|
1314
|
+
temp = temp.replace(`___STRING_${idx}___`, `<span class="hl-string">${str}</span>`);
|
|
1315
|
+
});
|
|
1316
|
+
comments.forEach((comment, idx) => {
|
|
1317
|
+
temp = temp.replace(`___COMMENT_${idx}___`, `<span class="hl-comment">${comment}</span>`);
|
|
1318
|
+
});
|
|
1319
|
+
return temp;
|
|
1320
|
+
}
|
|
1321
|
+
highlightCSS(text) {
|
|
1322
|
+
const comments = [];
|
|
1323
|
+
const strings = [];
|
|
1324
|
+
let temp = text;
|
|
1325
|
+
temp = temp.replace(/\/\*[\s\S]*?\*\//g, (match) => {
|
|
1326
|
+
comments.push(match);
|
|
1327
|
+
return `___COMMENT_${comments.length - 1}___`;
|
|
1328
|
+
});
|
|
1329
|
+
temp = temp.replace(/"(\\.|[^"\\])*"/g, (match) => {
|
|
1330
|
+
strings.push(match);
|
|
1331
|
+
return `___STRING_${strings.length - 1}___`;
|
|
1332
|
+
});
|
|
1333
|
+
temp = temp.replace(/'(\\.|[^'\\])*'/g, (match) => {
|
|
1334
|
+
strings.push(match);
|
|
1335
|
+
return `___STRING_${strings.length - 1}___`;
|
|
1336
|
+
});
|
|
1337
|
+
temp = temp.replace(/(\.[a-zA-Z_-][\w_-]*)/g, '<span class="hl-class">$1</span>');
|
|
1338
|
+
temp = temp.replace(/(#[a-zA-Z_-][\w_-]*)/g, '<span class="hl-id">$1</span>');
|
|
1339
|
+
temp = temp.replace(/(:\w+)\b/g, '<span class="hl-pseudo">$1</span>');
|
|
1340
|
+
temp = temp.replace(/\b([a-zA-Z-]+)(?=\s*:)/g, '<span class="hl-property">$1</span>');
|
|
1341
|
+
temp = temp.replace(/\b(\d+(?:px|em|rem|%|ms|s|deg|fr|vh|vw|pt)?)\b/g, '<span class="hl-number">$1</span>');
|
|
1342
|
+
strings.forEach((str, idx) => {
|
|
1343
|
+
temp = temp.replace(`___STRING_${idx}___`, `<span class="hl-string">${str}</span>`);
|
|
1344
|
+
});
|
|
1345
|
+
comments.forEach((comment, idx) => {
|
|
1346
|
+
temp = temp.replace(`___COMMENT_${idx}___`, `<span class="hl-comment">${comment}</span>`);
|
|
1347
|
+
});
|
|
1348
|
+
return temp;
|
|
1349
|
+
}
|
|
1350
|
+
highlightHTML(text) {
|
|
1351
|
+
let temp = text;
|
|
1352
|
+
const comments = [];
|
|
1353
|
+
temp = temp.replace(/<!--[\s\S]*?-->/g, (match) => {
|
|
1354
|
+
comments.push(match);
|
|
1355
|
+
return `___COMMENT_${comments.length - 1}___`;
|
|
1356
|
+
});
|
|
1357
|
+
temp = temp.replace(/(<\/?[a-zA-Z0-9:-]+)/g, '<span class="hl-tag">$1</span>');
|
|
1358
|
+
temp = temp.replace(/(\/?>)/g, '<span class="hl-tag">$1</span>');
|
|
1359
|
+
temp = temp.replace(/\b([a-zA-Z-]+)(?=\s*=)/g, '<span class="hl-attr">$1</span>');
|
|
1360
|
+
const strings = [];
|
|
1361
|
+
temp = temp.replace(/="([^"]*)"/g, (match, p1) => {
|
|
1362
|
+
strings.push(`="${p1}"`);
|
|
1363
|
+
return `=___STRING_${strings.length - 1}___`;
|
|
1364
|
+
});
|
|
1365
|
+
temp = temp.replace(/='([^']*)'/g, (match, p1) => {
|
|
1366
|
+
strings.push(`='${p1}'`);
|
|
1367
|
+
return `=___STRING_${strings.length - 1}___`;
|
|
1368
|
+
});
|
|
1369
|
+
strings.forEach((str, idx) => {
|
|
1370
|
+
temp = temp.replace(`___STRING_${idx}___`, `<span class="hl-string">${str}</span>`);
|
|
1371
|
+
});
|
|
1372
|
+
comments.forEach((comment, idx) => {
|
|
1373
|
+
temp = temp.replace(`___COMMENT_${idx}___`, `<span class="hl-comment">${comment}</span>`);
|
|
1374
|
+
});
|
|
1375
|
+
return temp;
|
|
1376
|
+
}
|
|
1377
|
+
highlightJSON(text) {
|
|
1378
|
+
let temp = text;
|
|
1379
|
+
const strings = [];
|
|
1380
|
+
temp = temp.replace(/"(\\.|[^"\\])*"/g, (match) => {
|
|
1381
|
+
strings.push(match);
|
|
1382
|
+
return `___STRING_${strings.length - 1}___`;
|
|
1383
|
+
});
|
|
1384
|
+
temp = temp.replace(/(___STRING_\d+___)(?=\s*:)/g, '<span class="hl-key">$1</span>');
|
|
1385
|
+
temp = temp.replace(/\b(true|false|null)\b/g, '<span class="hl-builtin">$1</span>');
|
|
1386
|
+
temp = temp.replace(/\b(\d+)\b/g, '<span class="hl-number">$1</span>');
|
|
1387
|
+
strings.forEach((str, idx) => {
|
|
1388
|
+
if (temp.includes(`<span class="hl-key">___STRING_${idx}___</span>`)) {
|
|
1389
|
+
temp = temp.replace(`___STRING_${idx}___`, str);
|
|
1390
|
+
}
|
|
1391
|
+
else {
|
|
1392
|
+
temp = temp.replace(`___STRING_${idx}___`, `<span class="hl-string">${str}</span>`);
|
|
1393
|
+
}
|
|
1394
|
+
});
|
|
1395
|
+
return temp;
|
|
1396
|
+
}
|
|
1397
|
+
escapeHtml(unsafe) {
|
|
1398
|
+
return unsafe
|
|
1399
|
+
.replace(/&/g, '&')
|
|
1400
|
+
.replace(/</g, '<')
|
|
1401
|
+
.replace(/>/g, '>')
|
|
1402
|
+
.replace(/"/g, '"')
|
|
1403
|
+
.replace(/'/g, ''');
|
|
1404
|
+
}
|
|
1071
1405
|
editorInput;
|
|
1072
1406
|
focusTextarea() {
|
|
1073
1407
|
if (this.disabled())
|
|
@@ -1087,24 +1421,61 @@ class AICodeEditorComponent {
|
|
|
1087
1421
|
if (this.disabled())
|
|
1088
1422
|
return;
|
|
1089
1423
|
// Tab accepts suggestion if available
|
|
1090
|
-
if (event.key === 'Tab' && this.
|
|
1424
|
+
if (event.key === 'Tab' && this.hasSuggestion() && !this.suggestionAccepted()) {
|
|
1091
1425
|
event.preventDefault();
|
|
1092
1426
|
this.accept();
|
|
1093
1427
|
}
|
|
1428
|
+
// Tab inserts spaces if no suggestion is active
|
|
1429
|
+
else if (event.key === 'Tab' && (!this.hasSuggestion() || this.suggestionAccepted())) {
|
|
1430
|
+
event.preventDefault();
|
|
1431
|
+
const textarea = event.target;
|
|
1432
|
+
const start = textarea.selectionStart;
|
|
1433
|
+
const end = textarea.selectionEnd;
|
|
1434
|
+
const val = textarea.value;
|
|
1435
|
+
const newVal = val.substring(0, start) + ' ' + val.substring(end);
|
|
1436
|
+
this.onCodeChange(newVal);
|
|
1437
|
+
// Wait for Angular to update the model, then restore cursor position
|
|
1438
|
+
setTimeout(() => {
|
|
1439
|
+
textarea.selectionStart = textarea.selectionEnd = start + 2;
|
|
1440
|
+
});
|
|
1441
|
+
}
|
|
1094
1442
|
// Esc declines suggestion if available
|
|
1095
|
-
if (event.key === 'Escape' && this.
|
|
1443
|
+
if (event.key === 'Escape' && this.hasSuggestion() && !this.suggestionAccepted()) {
|
|
1096
1444
|
event.preventDefault();
|
|
1097
1445
|
this.decline();
|
|
1098
1446
|
}
|
|
1099
1447
|
}
|
|
1448
|
+
prevSuggestion() {
|
|
1449
|
+
if (this.disabled())
|
|
1450
|
+
return;
|
|
1451
|
+
const len = this.suggestions().length;
|
|
1452
|
+
if (len <= 1)
|
|
1453
|
+
return;
|
|
1454
|
+
this.activeSuggestionIndex.update(idx => (idx - 1 + len) % len);
|
|
1455
|
+
}
|
|
1456
|
+
nextSuggestion() {
|
|
1457
|
+
if (this.disabled())
|
|
1458
|
+
return;
|
|
1459
|
+
const len = this.suggestions().length;
|
|
1460
|
+
if (len <= 1)
|
|
1461
|
+
return;
|
|
1462
|
+
this.activeSuggestionIndex.update(idx => (idx + 1) % len);
|
|
1463
|
+
}
|
|
1464
|
+
toggleDiffMode() {
|
|
1465
|
+
if (this.disabled())
|
|
1466
|
+
return;
|
|
1467
|
+
this.diffMode.update(d => !d);
|
|
1468
|
+
}
|
|
1100
1469
|
accept() {
|
|
1101
1470
|
this.suggestionAccepted.set(true);
|
|
1102
|
-
const fullCode = this.code() + this.
|
|
1471
|
+
const fullCode = this.code() + this.currentSuggestion();
|
|
1103
1472
|
this.codeChange.emit(fullCode);
|
|
1104
1473
|
this.acceptSuggestion.emit();
|
|
1474
|
+
this.diffMode.set(false); // Reset diff mode when suggestion is accepted
|
|
1105
1475
|
}
|
|
1106
1476
|
decline() {
|
|
1107
1477
|
this.declineSuggestion.emit();
|
|
1478
|
+
this.diffMode.set(false); // Reset diff mode when suggestion is declined
|
|
1108
1479
|
}
|
|
1109
1480
|
triggerRegenerate() {
|
|
1110
1481
|
this.suggestionAccepted.set(false);
|
|
@@ -1115,14 +1486,14 @@ class AICodeEditorComponent {
|
|
|
1115
1486
|
this.showExplanation.set(true);
|
|
1116
1487
|
}
|
|
1117
1488
|
copyCode() {
|
|
1118
|
-
const combined = this.code() + (this.suggestionAccepted() ? '' : this.
|
|
1489
|
+
const combined = this.code() + (this.suggestionAccepted() ? '' : this.currentSuggestion());
|
|
1119
1490
|
navigator.clipboard.writeText(combined).then(() => {
|
|
1120
1491
|
this.copyText.set('Copied!');
|
|
1121
1492
|
setTimeout(() => this.copyText.set('Copy'), 2000);
|
|
1122
1493
|
});
|
|
1123
1494
|
}
|
|
1124
1495
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.20", ngImport: i0, type: AICodeEditorComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
1125
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.20", type: AICodeEditorComponent, isStandalone: true, selector: "ngx-ai-code-editor", inputs: { code: { classPropertyName: "code", publicName: "code", isSignal: true, isRequired: false, transformFunction: null }, suggestion: { classPropertyName: "suggestion", publicName: "suggestion", isSignal: true, isRequired: false, transformFunction: null }, language: { classPropertyName: "language", publicName: "language", isSignal: true, isRequired: false, transformFunction: null }, theme: { classPropertyName: "theme", publicName: "theme", isSignal: true, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null }, explanation: { classPropertyName: "explanation", publicName: "explanation", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { codeChange: "codeChange", acceptSuggestion: "acceptSuggestion", declineSuggestion: "declineSuggestion", regenerate: "regenerate" }, viewQueries: [{ propertyName: "editorInput", first: true, predicate: ["editorInput"], descendants: true }], ngImport: i0, template: `
|
|
1496
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.20", type: AICodeEditorComponent, isStandalone: true, selector: "ngx-ai-code-editor", inputs: { code: { classPropertyName: "code", publicName: "code", isSignal: true, isRequired: false, transformFunction: null }, suggestion: { classPropertyName: "suggestion", publicName: "suggestion", isSignal: true, isRequired: false, transformFunction: null }, suggestions: { classPropertyName: "suggestions", publicName: "suggestions", isSignal: true, isRequired: false, transformFunction: null }, language: { classPropertyName: "language", publicName: "language", isSignal: true, isRequired: false, transformFunction: null }, theme: { classPropertyName: "theme", publicName: "theme", isSignal: true, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null }, explanation: { classPropertyName: "explanation", publicName: "explanation", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { codeChange: "codeChange", acceptSuggestion: "acceptSuggestion", declineSuggestion: "declineSuggestion", regenerate: "regenerate" }, viewQueries: [{ propertyName: "editorInput", first: true, predicate: ["editorInput"], descendants: true }], ngImport: i0, template: `
|
|
1126
1497
|
<div class="code-editor-wrapper" [class.dark]="theme() === 'dark'" [class.focused]="isFocused()">
|
|
1127
1498
|
<!-- Toolbar Header -->
|
|
1128
1499
|
<div class="editor-header">
|
|
@@ -1133,6 +1504,14 @@ class AICodeEditorComponent {
|
|
|
1133
1504
|
<span class="editor-lang-badge">{{ language() | uppercase }}</span>
|
|
1134
1505
|
</div>
|
|
1135
1506
|
<div class="header-right">
|
|
1507
|
+
<button
|
|
1508
|
+
*ngIf="hasSuggestion() && !suggestionAccepted()"
|
|
1509
|
+
class="toolbar-toggle-btn"
|
|
1510
|
+
[class.active]="diffMode()"
|
|
1511
|
+
(click)="toggleDiffMode()"
|
|
1512
|
+
>
|
|
1513
|
+
{{ diffMode() ? '👁️ Editor' : '🔍 Diff View' }}
|
|
1514
|
+
</button>
|
|
1136
1515
|
<span class="ai-pill">✨ AI Suggestion Active</span>
|
|
1137
1516
|
<button class="icon-btn" (click)="copyCode()" [title]="copyTooltip()">
|
|
1138
1517
|
{{ copyText() }}
|
|
@@ -1141,14 +1520,14 @@ class AICodeEditorComponent {
|
|
|
1141
1520
|
</div>
|
|
1142
1521
|
|
|
1143
1522
|
<!-- Editor Canvas -->
|
|
1144
|
-
<div class="editor-canvas" (click)="focusTextarea()">
|
|
1523
|
+
<div class="editor-canvas" *ngIf="!diffMode()" (click)="focusTextarea()">
|
|
1145
1524
|
<!-- Line Numbers -->
|
|
1146
1525
|
<div class="line-numbers">
|
|
1147
1526
|
@for (line of lines(); track $index) {
|
|
1148
1527
|
<div class="line-num">{{ $index + 1 }}</div>
|
|
1149
1528
|
}
|
|
1150
1529
|
</div>
|
|
1151
|
-
|
|
1530
|
+
|
|
1152
1531
|
<!-- Code Content Area -->
|
|
1153
1532
|
<div class="code-content-container">
|
|
1154
1533
|
<textarea
|
|
@@ -1161,20 +1540,41 @@ class AICodeEditorComponent {
|
|
|
1161
1540
|
(keydown)="handleKeydown($event)"
|
|
1162
1541
|
[disabled]="disabled()"
|
|
1163
1542
|
></textarea>
|
|
1164
|
-
|
|
1543
|
+
|
|
1165
1544
|
<!-- Rendered Code Grid with Ghost Text -->
|
|
1166
|
-
<pre class="rendered-code"><code
|
|
1167
|
-
*ngIf="
|
|
1545
|
+
<pre class="rendered-code"><code><span [innerHTML]="highlightedCode()"></span><span class="cursor-pipe" *ngIf="isFocused()">|</span><span
|
|
1546
|
+
*ngIf="hasSuggestion() && !suggestionAccepted()"
|
|
1168
1547
|
class="ghost-text"
|
|
1169
|
-
>{{
|
|
1548
|
+
>{{ currentSuggestion() }}</span></code></pre>
|
|
1549
|
+
</div>
|
|
1550
|
+
</div>
|
|
1551
|
+
|
|
1552
|
+
<!-- Diff Canvas -->
|
|
1553
|
+
<div class="diff-canvas" *ngIf="diffMode() && hasSuggestion() && !suggestionAccepted()">
|
|
1554
|
+
<!-- Left original panel -->
|
|
1555
|
+
<div class="diff-pane original-pane">
|
|
1556
|
+
<div class="diff-pane-title">Original</div>
|
|
1557
|
+
<pre class="diff-code"><code>{{ code() }}</code></pre>
|
|
1558
|
+
</div>
|
|
1559
|
+
<!-- Right proposed panel -->
|
|
1560
|
+
<div class="diff-pane proposed-pane">
|
|
1561
|
+
<div class="diff-pane-title">Proposed</div>
|
|
1562
|
+
<pre class="diff-code"><code>{{ code() }}<span class="diff-highlight">{{ currentSuggestion() }}</span></code></pre>
|
|
1170
1563
|
</div>
|
|
1171
1564
|
</div>
|
|
1172
1565
|
|
|
1173
1566
|
<!-- Suggestion Panel Controls -->
|
|
1174
|
-
<div class="editor-footer" *ngIf="
|
|
1567
|
+
<div class="editor-footer" *ngIf="hasSuggestion() && !suggestionAccepted()">
|
|
1175
1568
|
<div class="suggestion-info">
|
|
1176
1569
|
<span class="sparkle">✨</span>
|
|
1177
|
-
<span class="desc">Press <kbd class="editor-kbd">Tab</kbd> to accept
|
|
1570
|
+
<span class="desc">Press <kbd class="editor-kbd">Tab</kbd> to accept, or <kbd class="editor-kbd">Esc</kbd> to dismiss.</span>
|
|
1571
|
+
@if (suggestions().length > 1) {
|
|
1572
|
+
<div class="suggestions-navigator">
|
|
1573
|
+
<button type="button" class="nav-arrow" (click)="prevSuggestion()" title="Previous suggestion">◀</button>
|
|
1574
|
+
<span class="nav-count">{{ activeSuggestionIndex() + 1 }} / {{ suggestions().length }}</span>
|
|
1575
|
+
<button type="button" class="nav-arrow" (click)="nextSuggestion()" title="Next suggestion">▶</button>
|
|
1576
|
+
</div>
|
|
1577
|
+
}
|
|
1178
1578
|
</div>
|
|
1179
1579
|
<div class="action-buttons">
|
|
1180
1580
|
<button class="footer-btn reject-btn" (click)="decline()">Decline (Esc)</button>
|
|
@@ -1194,14 +1594,14 @@ class AICodeEditorComponent {
|
|
|
1194
1594
|
</div>
|
|
1195
1595
|
|
|
1196
1596
|
<!-- Secondary Panel Controls (when suggestion is accepted or inactive) -->
|
|
1197
|
-
<div class="editor-footer justify-end" *ngIf="!
|
|
1597
|
+
<div class="editor-footer justify-end" *ngIf="!hasSuggestion() || suggestionAccepted()">
|
|
1198
1598
|
<div class="action-buttons">
|
|
1199
1599
|
<button class="footer-btn secondary-btn" (click)="explainSuggestedCode()">Explain Code</button>
|
|
1200
1600
|
<button class="footer-btn primary-btn" (click)="triggerRegenerate()">Re-generate Suggestion</button>
|
|
1201
1601
|
</div>
|
|
1202
1602
|
</div>
|
|
1203
1603
|
</div>
|
|
1204
|
-
`, isInline: true, styles: [":host{display:block;width:100%;font-family:Consolas,Monaco,Andale Mono,Ubuntu Mono,monospace}.code-editor-wrapper{border:1px solid var(--border-color, #e2e8f0);border-radius:var(--radius-md, 10px);background:var(--bg-secondary, #ffffff);box-shadow:var(--shadow-md, 0 4px 6px -1px rgba(0, 0, 0, .08));overflow:hidden;display:flex;flex-direction:column;transition:all .25s cubic-bezier(.4,0,.2,1)}.code-editor-wrapper.focused{border-color:var(--primary-color, #4f46e5);box-shadow:0 0 0 3px var(--primary-glow, rgba(79, 70, 229, .15))}.editor-header{display:flex;justify-content:space-between;align-items:center;padding:10px 16px;background:var(--border-light, #f1f5f9);border-bottom:1px solid var(--border-color, #e2e8f0)}.header-left{display:flex;align-items:center;gap:6px}.editor-dot{width:10px;height:10px;border-radius:50%}.editor-dot.red{background:#ef4444}.editor-dot.yellow{background:#f59e0b}.editor-dot.green{background:#10b981}.editor-lang-badge{margin-left:10px;font-size:11px;font-weight:700;color:var(--text-secondary, #475569);background:#0000000d;padding:2px 6px;border-radius:4px;letter-spacing:.5px}.header-right{display:flex;align-items:center;gap:12px}.ai-pill{font-size:11px;font-weight:600;background:linear-gradient(135deg,#4f46e51a,#7c3aed1a);color:#6d28d9;padding:2px 8px;border-radius:9999px;border:1px solid rgba(124,58,237,.2)}.icon-btn{background:transparent;border:none;color:var(--text-secondary, #475569);cursor:pointer;font-size:11px;padding:4px 8px;border-radius:4px;transition:background .2s}.icon-btn:hover{background:#0000000d;color:var(--text-primary, #0f172a)}.editor-canvas{display:flex;flex-direction:row;position:relative;min-height:150px;background:var(--bg-secondary, #ffffff);cursor:text}.line-numbers{padding:16px 8px 16px 12px;border-right:1px solid var(--border-color, #e2e8f0);background:#00000003;-webkit-user-select:none;user-select:none;text-align:right;min-width:40px}.line-num{color:var(--text-muted, #94a3b8);font-size:12px;line-height:1.6;height:19.2px}.code-content-container{position:relative;flex:1;overflow:hidden}.hidden-textarea{position:absolute;top:0;left:0;width:100%;height:100%;opacity:0;z-index:2;resize:none;border:none;outline:none;padding:16px;font-family:inherit;font-size:13px;line-height:1.6;white-space:pre-wrap;word-wrap:break-word}.rendered-code{margin:0;padding:16px;font-family:inherit;font-size:13px;line-height:1.6;color:var(--text-primary, #0f172a);white-space:pre-wrap;word-wrap:break-word;pointer-events:none;z-index:1;overflow-y:auto}.cursor-pipe{color:var(--primary-color, #4f46e5);font-weight:700;animation:blink 1s step-end infinite}@keyframes blink{0%,to{opacity:0}50%{opacity:1}}.ghost-text{color:var(--text-muted, #94a3b8);font-style:italic;opacity:.7}.editor-footer{display:flex;justify-content:space-between;align-items:center;padding:12px 16px;background:var(--border-light, #f1f5f9);border-top:1px solid var(--border-color, #e2e8f0);gap:12px;flex-wrap:wrap}.editor-footer.justify-end{justify-content:flex-end}.suggestion-info{display:flex;align-items:center;gap:8px;font-size:12px;color:var(--text-secondary, #475569)}.sparkle{font-size:14px}.editor-kbd{background:var(--bg-secondary, #ffffff);border:1px solid var(--border-color, #e2e8f0);border-radius:3px;box-shadow:0 1px #0000001a;padding:1px 4px;font-size:11px;font-family:sans-serif;font-weight:600;color:var(--text-primary, #0f172a)}.action-buttons{display:flex;gap:8px}.footer-btn{padding:6px 12px;font-size:12px;font-weight:600;border-radius:6px;cursor:pointer;font-family:var(--ngx-font-family, sans-serif);transition:all .2s}.accept-btn{background:var(--primary-color, #4f46e5);border:1px solid var(--primary-color, #4f46e5);color:#fff}.accept-btn:hover{background:var(--primary-hover, #4338ca)}.reject-btn{background:transparent;border:1px solid var(--border-color, #e2e8f0);color:var(--text-secondary, #475569)}.reject-btn:hover{background:#0000000a;border-color:var(--text-secondary, #475569)}.primary-btn{background:var(--primary-color, #4f46e5);border:1px solid var(--primary-color, #4f46e5);color:#fff}.primary-btn:hover{background:var(--primary-hover, #4338ca)}.secondary-btn{background:transparent;border:1px solid var(--border-color, #e2e8f0);color:var(--text-secondary, #475569)}.secondary-btn:hover{background:#0000000a}.explanation-panel{background:linear-gradient(to right,#4f46e508,#7c3aed08);border-top:1px solid var(--border-color, #e2e8f0);padding:16px}.explanation-header{display:flex;justify-content:space-between;align-items:center;margin-bottom:8px;font-weight:700;font-size:13px;color:var(--primary-color, #4f46e5);font-family:var(--ngx-font-family, sans-serif)}.close-explanation-btn{background:transparent;border:none;color:var(--text-muted, #94a3b8);font-size:14px;cursor:pointer}.close-explanation-btn:hover{color:var(--text-primary, #0f172a)}.explanation-body{font-size:12px;line-height:1.6;color:var(--text-secondary, #475569);font-family:var(--ngx-font-family, sans-serif)}.
|
|
1604
|
+
`, isInline: true, styles: [":host{display:block;width:100%;font-family:Consolas,Monaco,Andale Mono,Ubuntu Mono,monospace}.code-editor-wrapper{border:1px solid var(--border-color, #e2e8f0);border-radius:var(--radius-md, 10px);background:var(--bg-secondary, #ffffff);box-shadow:var(--shadow-md, 0 4px 6px -1px rgba(0, 0, 0, .08));overflow:hidden;display:flex;flex-direction:column;transition:all .25s cubic-bezier(.4,0,.2,1)}.code-editor-wrapper.focused{border-color:var(--primary-color, #4f46e5);box-shadow:0 0 0 3px var(--primary-glow, rgba(79, 70, 229, .15))}.editor-header{display:flex;justify-content:space-between;align-items:center;padding:10px 16px;background:var(--border-light, #f1f5f9);border-bottom:1px solid var(--border-color, #e2e8f0)}.header-left{display:flex;align-items:center;gap:6px}.editor-dot{width:10px;height:10px;border-radius:50%}.editor-dot.red{background:#ef4444}.editor-dot.yellow{background:#f59e0b}.editor-dot.green{background:#10b981}.editor-lang-badge{margin-left:10px;font-size:11px;font-weight:700;color:var(--text-secondary, #475569);background:#0000000d;padding:2px 6px;border-radius:4px;letter-spacing:.5px}.header-right{display:flex;align-items:center;gap:12px}.ai-pill{font-size:11px;font-weight:600;background:linear-gradient(135deg,#4f46e51a,#7c3aed1a);color:#6d28d9;padding:2px 8px;border-radius:9999px;border:1px solid rgba(124,58,237,.2)}.icon-btn{background:transparent;border:none;color:var(--text-secondary, #475569);cursor:pointer;font-size:11px;padding:4px 8px;border-radius:4px;transition:background .2s}.icon-btn:hover{background:#0000000d;color:var(--text-primary, #0f172a)}.editor-canvas{display:flex;flex-direction:row;position:relative;min-height:150px;background:var(--bg-secondary, #ffffff);cursor:text}.line-numbers{padding:16px 8px 16px 12px;border-right:1px solid var(--border-color, #e2e8f0);background:#00000003;-webkit-user-select:none;user-select:none;text-align:right;min-width:40px}.line-num{color:var(--text-muted, #94a3b8);font-size:12px;line-height:1.6;height:19.2px}.code-content-container{position:relative;flex:1;overflow:hidden}.hidden-textarea{position:absolute;top:0;left:0;width:100%;height:100%;opacity:0;z-index:2;resize:none;border:none;outline:none;padding:16px;font-family:inherit;font-size:13px;line-height:1.6;white-space:pre-wrap;word-wrap:break-word}.rendered-code{margin:0;padding:16px;font-family:inherit;font-size:13px;line-height:1.6;color:var(--text-primary, #0f172a);white-space:pre-wrap;word-wrap:break-word;pointer-events:none;z-index:1;overflow-y:auto}.cursor-pipe{color:var(--primary-color, #4f46e5);font-weight:700;animation:blink 1s step-end infinite}@keyframes blink{0%,to{opacity:0}50%{opacity:1}}.ghost-text{color:var(--text-muted, #94a3b8);font-style:italic;opacity:.7}.editor-footer{display:flex;justify-content:space-between;align-items:center;padding:12px 16px;background:var(--border-light, #f1f5f9);border-top:1px solid var(--border-color, #e2e8f0);gap:12px;flex-wrap:wrap}.editor-footer.justify-end{justify-content:flex-end}.suggestion-info{display:flex;align-items:center;gap:8px;font-size:12px;color:var(--text-secondary, #475569)}.sparkle{font-size:14px}.editor-kbd{background:var(--bg-secondary, #ffffff);border:1px solid var(--border-color, #e2e8f0);border-radius:3px;box-shadow:0 1px #0000001a;padding:1px 4px;font-size:11px;font-family:sans-serif;font-weight:600;color:var(--text-primary, #0f172a)}.action-buttons{display:flex;gap:8px}.footer-btn{padding:6px 12px;font-size:12px;font-weight:600;border-radius:6px;cursor:pointer;font-family:var(--ngx-font-family, sans-serif);transition:all .2s}.accept-btn{background:var(--primary-color, #4f46e5);border:1px solid var(--primary-color, #4f46e5);color:#fff}.accept-btn:hover{background:var(--primary-hover, #4338ca)}.reject-btn{background:transparent;border:1px solid var(--border-color, #e2e8f0);color:var(--text-secondary, #475569)}.reject-btn:hover{background:#0000000a;border-color:var(--text-secondary, #475569)}.primary-btn{background:var(--primary-color, #4f46e5);border:1px solid var(--primary-color, #4f46e5);color:#fff}.primary-btn:hover{background:var(--primary-hover, #4338ca)}.secondary-btn{background:transparent;border:1px solid var(--border-color, #e2e8f0);color:var(--text-secondary, #475569)}.secondary-btn:hover{background:#0000000a}.explanation-panel{background:linear-gradient(to right,#4f46e508,#7c3aed08);border-top:1px solid var(--border-color, #e2e8f0);padding:16px}.explanation-header{display:flex;justify-content:space-between;align-items:center;margin-bottom:8px;font-weight:700;font-size:13px;color:var(--primary-color, #4f46e5);font-family:var(--ngx-font-family, sans-serif)}.close-explanation-btn{background:transparent;border:none;color:var(--text-muted, #94a3b8);font-size:14px;cursor:pointer}.close-explanation-btn:hover{color:var(--text-primary, #0f172a)}.explanation-body{font-size:12px;line-height:1.6;color:var(--text-secondary, #475569);font-family:var(--ngx-font-family, sans-serif)}.toolbar-toggle-btn{background:transparent;border:1px solid var(--border-color, #cbd5e1);border-radius:6px;color:var(--text-secondary, #475569);cursor:pointer;font-size:11px;font-weight:600;padding:4px 8px;font-family:inherit;transition:all .2s}.toolbar-toggle-btn:hover{background:#0000000d;border-color:var(--text-primary, #0f172a);color:var(--text-primary, #0f172a)}.toolbar-toggle-btn.active{background:var(--primary-color, #4f46e5);border-color:var(--primary-color, #4f46e5);color:#fff}.diff-canvas{display:grid;grid-template-columns:1fr 1fr;min-height:180px;background:var(--bg-secondary, #ffffff);border-bottom:1px solid var(--border-color, #e2e8f0)}.diff-pane{display:flex;flex-direction:column;border-right:1px solid var(--border-color, #e2e8f0)}.diff-pane:last-child{border-right:none}.diff-pane-title{padding:6px 12px;background:#00000005;font-size:10px;font-weight:700;text-transform:uppercase;color:var(--text-secondary, #64748b);border-bottom:1px solid var(--border-color, #e2e8f0)}.diff-code{margin:0;padding:12px;font-family:inherit;font-size:12px;line-height:1.6;white-space:pre-wrap;overflow-y:auto;flex:1}.original-pane .diff-code{background:#ef444405;color:#991b1b}.proposed-pane .diff-code{background:#10b98105}.diff-highlight{background:#10b98126;color:#065f46;border-radius:2px;padding:1px 2px;font-weight:600}.suggestions-navigator{display:inline-flex;align-items:center;gap:6px;margin-left:12px;padding-left:12px;border-left:1px solid var(--border-color, #cbd5e1)}.nav-arrow{background:none;border:none;color:var(--primary-color, #4f46e5);cursor:pointer;font-size:10px;padding:2px 4px;border-radius:4px;transition:background .2s}.nav-arrow:hover{background:#4f46e51a}.nav-count{font-size:11px;font-weight:700;color:var(--text-primary, #0f172a)}.code-editor-wrapper.dark .toolbar-toggle-btn{border-color:#374151;color:#94a3b8}.code-editor-wrapper.dark .toolbar-toggle-btn:hover{background:#ffffff0d;color:#f8fafc}.code-editor-wrapper.dark .toolbar-toggle-btn.active{background:var(--primary-color, #6366f1);border-color:var(--primary-color, #6366f1);color:#fff}.code-editor-wrapper.dark .diff-canvas{background:#0f172a;border-bottom-color:#1f2937}.code-editor-wrapper.dark .diff-pane{border-right-color:#1f2937}.code-editor-wrapper.dark .diff-pane-title{background:#ffffff05;color:#94a3b8;border-bottom-color:#1f2937}.code-editor-wrapper.dark .original-pane .diff-code{background:#ef44440d;color:#fca5a5}.code-editor-wrapper.dark .proposed-pane .diff-code{background:#10b9810d;color:#e2e8f0}.code-editor-wrapper.dark .diff-highlight{background:#10b98140;color:#34d399}.code-editor-wrapper.dark .suggestions-navigator{border-left-color:#374151}.code-editor-wrapper.dark .nav-count{color:#cbd5e1}.code-editor-wrapper.dark .nav-arrow{color:#818cf8}.code-editor-wrapper.dark .nav-arrow:hover{background:#6366f126}.hl-keyword{color:#2563eb;font-weight:600}.hl-builtin{color:#7c3aed}.hl-number{color:#ea580c}.hl-string{color:#16a34a}.hl-comment{color:#94a3b8;font-style:italic}.hl-function{color:#d97706}.hl-tag{color:#2563eb}.hl-attr{color:#7c3aed}.hl-class{color:#d97706}.hl-id{color:#ef4444}.hl-pseudo{color:#8b5cf6}.hl-property{color:#0284c7}.hl-key{color:#2563eb;font-weight:600}.code-editor-wrapper.dark .hl-keyword{color:#60a5fa}.code-editor-wrapper.dark .hl-builtin{color:#a78bfa}.code-editor-wrapper.dark .hl-number{color:#fb923c}.code-editor-wrapper.dark .hl-string{color:#4ade80}.code-editor-wrapper.dark .hl-comment{color:#64748b}.code-editor-wrapper.dark .hl-function{color:#f59e0b}.code-editor-wrapper.dark .hl-tag{color:#60a5fa}.code-editor-wrapper.dark .hl-attr{color:#a78bfa}.code-editor-wrapper.dark .hl-class{color:#f59e0b}.code-editor-wrapper.dark .hl-id{color:#f87171}.code-editor-wrapper.dark .hl-pseudo{color:#c084fc}.code-editor-wrapper.dark .hl-property{color:#38bdf8}.code-editor-wrapper.dark .hl-key{color:#60a5fa}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "pipe", type: i1.UpperCasePipe, name: "uppercase" }, { kind: "ngmodule", type: FormsModule }, { kind: "directive", type: i2.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: i2.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i2.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }] });
|
|
1205
1605
|
}
|
|
1206
1606
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.20", ngImport: i0, type: AICodeEditorComponent, decorators: [{
|
|
1207
1607
|
type: Component,
|
|
@@ -1216,6 +1616,14 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.20", ngImpo
|
|
|
1216
1616
|
<span class="editor-lang-badge">{{ language() | uppercase }}</span>
|
|
1217
1617
|
</div>
|
|
1218
1618
|
<div class="header-right">
|
|
1619
|
+
<button
|
|
1620
|
+
*ngIf="hasSuggestion() && !suggestionAccepted()"
|
|
1621
|
+
class="toolbar-toggle-btn"
|
|
1622
|
+
[class.active]="diffMode()"
|
|
1623
|
+
(click)="toggleDiffMode()"
|
|
1624
|
+
>
|
|
1625
|
+
{{ diffMode() ? '👁️ Editor' : '🔍 Diff View' }}
|
|
1626
|
+
</button>
|
|
1219
1627
|
<span class="ai-pill">✨ AI Suggestion Active</span>
|
|
1220
1628
|
<button class="icon-btn" (click)="copyCode()" [title]="copyTooltip()">
|
|
1221
1629
|
{{ copyText() }}
|
|
@@ -1224,14 +1632,14 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.20", ngImpo
|
|
|
1224
1632
|
</div>
|
|
1225
1633
|
|
|
1226
1634
|
<!-- Editor Canvas -->
|
|
1227
|
-
<div class="editor-canvas" (click)="focusTextarea()">
|
|
1635
|
+
<div class="editor-canvas" *ngIf="!diffMode()" (click)="focusTextarea()">
|
|
1228
1636
|
<!-- Line Numbers -->
|
|
1229
1637
|
<div class="line-numbers">
|
|
1230
1638
|
@for (line of lines(); track $index) {
|
|
1231
1639
|
<div class="line-num">{{ $index + 1 }}</div>
|
|
1232
1640
|
}
|
|
1233
1641
|
</div>
|
|
1234
|
-
|
|
1642
|
+
|
|
1235
1643
|
<!-- Code Content Area -->
|
|
1236
1644
|
<div class="code-content-container">
|
|
1237
1645
|
<textarea
|
|
@@ -1244,20 +1652,41 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.20", ngImpo
|
|
|
1244
1652
|
(keydown)="handleKeydown($event)"
|
|
1245
1653
|
[disabled]="disabled()"
|
|
1246
1654
|
></textarea>
|
|
1247
|
-
|
|
1655
|
+
|
|
1248
1656
|
<!-- Rendered Code Grid with Ghost Text -->
|
|
1249
|
-
<pre class="rendered-code"><code
|
|
1250
|
-
*ngIf="
|
|
1657
|
+
<pre class="rendered-code"><code><span [innerHTML]="highlightedCode()"></span><span class="cursor-pipe" *ngIf="isFocused()">|</span><span
|
|
1658
|
+
*ngIf="hasSuggestion() && !suggestionAccepted()"
|
|
1251
1659
|
class="ghost-text"
|
|
1252
|
-
>{{
|
|
1660
|
+
>{{ currentSuggestion() }}</span></code></pre>
|
|
1661
|
+
</div>
|
|
1662
|
+
</div>
|
|
1663
|
+
|
|
1664
|
+
<!-- Diff Canvas -->
|
|
1665
|
+
<div class="diff-canvas" *ngIf="diffMode() && hasSuggestion() && !suggestionAccepted()">
|
|
1666
|
+
<!-- Left original panel -->
|
|
1667
|
+
<div class="diff-pane original-pane">
|
|
1668
|
+
<div class="diff-pane-title">Original</div>
|
|
1669
|
+
<pre class="diff-code"><code>{{ code() }}</code></pre>
|
|
1670
|
+
</div>
|
|
1671
|
+
<!-- Right proposed panel -->
|
|
1672
|
+
<div class="diff-pane proposed-pane">
|
|
1673
|
+
<div class="diff-pane-title">Proposed</div>
|
|
1674
|
+
<pre class="diff-code"><code>{{ code() }}<span class="diff-highlight">{{ currentSuggestion() }}</span></code></pre>
|
|
1253
1675
|
</div>
|
|
1254
1676
|
</div>
|
|
1255
1677
|
|
|
1256
1678
|
<!-- Suggestion Panel Controls -->
|
|
1257
|
-
<div class="editor-footer" *ngIf="
|
|
1679
|
+
<div class="editor-footer" *ngIf="hasSuggestion() && !suggestionAccepted()">
|
|
1258
1680
|
<div class="suggestion-info">
|
|
1259
1681
|
<span class="sparkle">✨</span>
|
|
1260
|
-
<span class="desc">Press <kbd class="editor-kbd">Tab</kbd> to accept
|
|
1682
|
+
<span class="desc">Press <kbd class="editor-kbd">Tab</kbd> to accept, or <kbd class="editor-kbd">Esc</kbd> to dismiss.</span>
|
|
1683
|
+
@if (suggestions().length > 1) {
|
|
1684
|
+
<div class="suggestions-navigator">
|
|
1685
|
+
<button type="button" class="nav-arrow" (click)="prevSuggestion()" title="Previous suggestion">◀</button>
|
|
1686
|
+
<span class="nav-count">{{ activeSuggestionIndex() + 1 }} / {{ suggestions().length }}</span>
|
|
1687
|
+
<button type="button" class="nav-arrow" (click)="nextSuggestion()" title="Next suggestion">▶</button>
|
|
1688
|
+
</div>
|
|
1689
|
+
}
|
|
1261
1690
|
</div>
|
|
1262
1691
|
<div class="action-buttons">
|
|
1263
1692
|
<button class="footer-btn reject-btn" (click)="decline()">Decline (Esc)</button>
|
|
@@ -1277,14 +1706,14 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.20", ngImpo
|
|
|
1277
1706
|
</div>
|
|
1278
1707
|
|
|
1279
1708
|
<!-- Secondary Panel Controls (when suggestion is accepted or inactive) -->
|
|
1280
|
-
<div class="editor-footer justify-end" *ngIf="!
|
|
1709
|
+
<div class="editor-footer justify-end" *ngIf="!hasSuggestion() || suggestionAccepted()">
|
|
1281
1710
|
<div class="action-buttons">
|
|
1282
1711
|
<button class="footer-btn secondary-btn" (click)="explainSuggestedCode()">Explain Code</button>
|
|
1283
1712
|
<button class="footer-btn primary-btn" (click)="triggerRegenerate()">Re-generate Suggestion</button>
|
|
1284
1713
|
</div>
|
|
1285
1714
|
</div>
|
|
1286
1715
|
</div>
|
|
1287
|
-
`, styles: [":host{display:block;width:100%;font-family:Consolas,Monaco,Andale Mono,Ubuntu Mono,monospace}.code-editor-wrapper{border:1px solid var(--border-color, #e2e8f0);border-radius:var(--radius-md, 10px);background:var(--bg-secondary, #ffffff);box-shadow:var(--shadow-md, 0 4px 6px -1px rgba(0, 0, 0, .08));overflow:hidden;display:flex;flex-direction:column;transition:all .25s cubic-bezier(.4,0,.2,1)}.code-editor-wrapper.focused{border-color:var(--primary-color, #4f46e5);box-shadow:0 0 0 3px var(--primary-glow, rgba(79, 70, 229, .15))}.editor-header{display:flex;justify-content:space-between;align-items:center;padding:10px 16px;background:var(--border-light, #f1f5f9);border-bottom:1px solid var(--border-color, #e2e8f0)}.header-left{display:flex;align-items:center;gap:6px}.editor-dot{width:10px;height:10px;border-radius:50%}.editor-dot.red{background:#ef4444}.editor-dot.yellow{background:#f59e0b}.editor-dot.green{background:#10b981}.editor-lang-badge{margin-left:10px;font-size:11px;font-weight:700;color:var(--text-secondary, #475569);background:#0000000d;padding:2px 6px;border-radius:4px;letter-spacing:.5px}.header-right{display:flex;align-items:center;gap:12px}.ai-pill{font-size:11px;font-weight:600;background:linear-gradient(135deg,#4f46e51a,#7c3aed1a);color:#6d28d9;padding:2px 8px;border-radius:9999px;border:1px solid rgba(124,58,237,.2)}.icon-btn{background:transparent;border:none;color:var(--text-secondary, #475569);cursor:pointer;font-size:11px;padding:4px 8px;border-radius:4px;transition:background .2s}.icon-btn:hover{background:#0000000d;color:var(--text-primary, #0f172a)}.editor-canvas{display:flex;flex-direction:row;position:relative;min-height:150px;background:var(--bg-secondary, #ffffff);cursor:text}.line-numbers{padding:16px 8px 16px 12px;border-right:1px solid var(--border-color, #e2e8f0);background:#00000003;-webkit-user-select:none;user-select:none;text-align:right;min-width:40px}.line-num{color:var(--text-muted, #94a3b8);font-size:12px;line-height:1.6;height:19.2px}.code-content-container{position:relative;flex:1;overflow:hidden}.hidden-textarea{position:absolute;top:0;left:0;width:100%;height:100%;opacity:0;z-index:2;resize:none;border:none;outline:none;padding:16px;font-family:inherit;font-size:13px;line-height:1.6;white-space:pre-wrap;word-wrap:break-word}.rendered-code{margin:0;padding:16px;font-family:inherit;font-size:13px;line-height:1.6;color:var(--text-primary, #0f172a);white-space:pre-wrap;word-wrap:break-word;pointer-events:none;z-index:1;overflow-y:auto}.cursor-pipe{color:var(--primary-color, #4f46e5);font-weight:700;animation:blink 1s step-end infinite}@keyframes blink{0%,to{opacity:0}50%{opacity:1}}.ghost-text{color:var(--text-muted, #94a3b8);font-style:italic;opacity:.7}.editor-footer{display:flex;justify-content:space-between;align-items:center;padding:12px 16px;background:var(--border-light, #f1f5f9);border-top:1px solid var(--border-color, #e2e8f0);gap:12px;flex-wrap:wrap}.editor-footer.justify-end{justify-content:flex-end}.suggestion-info{display:flex;align-items:center;gap:8px;font-size:12px;color:var(--text-secondary, #475569)}.sparkle{font-size:14px}.editor-kbd{background:var(--bg-secondary, #ffffff);border:1px solid var(--border-color, #e2e8f0);border-radius:3px;box-shadow:0 1px #0000001a;padding:1px 4px;font-size:11px;font-family:sans-serif;font-weight:600;color:var(--text-primary, #0f172a)}.action-buttons{display:flex;gap:8px}.footer-btn{padding:6px 12px;font-size:12px;font-weight:600;border-radius:6px;cursor:pointer;font-family:var(--ngx-font-family, sans-serif);transition:all .2s}.accept-btn{background:var(--primary-color, #4f46e5);border:1px solid var(--primary-color, #4f46e5);color:#fff}.accept-btn:hover{background:var(--primary-hover, #4338ca)}.reject-btn{background:transparent;border:1px solid var(--border-color, #e2e8f0);color:var(--text-secondary, #475569)}.reject-btn:hover{background:#0000000a;border-color:var(--text-secondary, #475569)}.primary-btn{background:var(--primary-color, #4f46e5);border:1px solid var(--primary-color, #4f46e5);color:#fff}.primary-btn:hover{background:var(--primary-hover, #4338ca)}.secondary-btn{background:transparent;border:1px solid var(--border-color, #e2e8f0);color:var(--text-secondary, #475569)}.secondary-btn:hover{background:#0000000a}.explanation-panel{background:linear-gradient(to right,#4f46e508,#7c3aed08);border-top:1px solid var(--border-color, #e2e8f0);padding:16px}.explanation-header{display:flex;justify-content:space-between;align-items:center;margin-bottom:8px;font-weight:700;font-size:13px;color:var(--primary-color, #4f46e5);font-family:var(--ngx-font-family, sans-serif)}.close-explanation-btn{background:transparent;border:none;color:var(--text-muted, #94a3b8);font-size:14px;cursor:pointer}.close-explanation-btn:hover{color:var(--text-primary, #0f172a)}.explanation-body{font-size:12px;line-height:1.6;color:var(--text-secondary, #475569);font-family:var(--ngx-font-family, sans-serif)}.
|
|
1716
|
+
`, styles: [":host{display:block;width:100%;font-family:Consolas,Monaco,Andale Mono,Ubuntu Mono,monospace}.code-editor-wrapper{border:1px solid var(--border-color, #e2e8f0);border-radius:var(--radius-md, 10px);background:var(--bg-secondary, #ffffff);box-shadow:var(--shadow-md, 0 4px 6px -1px rgba(0, 0, 0, .08));overflow:hidden;display:flex;flex-direction:column;transition:all .25s cubic-bezier(.4,0,.2,1)}.code-editor-wrapper.focused{border-color:var(--primary-color, #4f46e5);box-shadow:0 0 0 3px var(--primary-glow, rgba(79, 70, 229, .15))}.editor-header{display:flex;justify-content:space-between;align-items:center;padding:10px 16px;background:var(--border-light, #f1f5f9);border-bottom:1px solid var(--border-color, #e2e8f0)}.header-left{display:flex;align-items:center;gap:6px}.editor-dot{width:10px;height:10px;border-radius:50%}.editor-dot.red{background:#ef4444}.editor-dot.yellow{background:#f59e0b}.editor-dot.green{background:#10b981}.editor-lang-badge{margin-left:10px;font-size:11px;font-weight:700;color:var(--text-secondary, #475569);background:#0000000d;padding:2px 6px;border-radius:4px;letter-spacing:.5px}.header-right{display:flex;align-items:center;gap:12px}.ai-pill{font-size:11px;font-weight:600;background:linear-gradient(135deg,#4f46e51a,#7c3aed1a);color:#6d28d9;padding:2px 8px;border-radius:9999px;border:1px solid rgba(124,58,237,.2)}.icon-btn{background:transparent;border:none;color:var(--text-secondary, #475569);cursor:pointer;font-size:11px;padding:4px 8px;border-radius:4px;transition:background .2s}.icon-btn:hover{background:#0000000d;color:var(--text-primary, #0f172a)}.editor-canvas{display:flex;flex-direction:row;position:relative;min-height:150px;background:var(--bg-secondary, #ffffff);cursor:text}.line-numbers{padding:16px 8px 16px 12px;border-right:1px solid var(--border-color, #e2e8f0);background:#00000003;-webkit-user-select:none;user-select:none;text-align:right;min-width:40px}.line-num{color:var(--text-muted, #94a3b8);font-size:12px;line-height:1.6;height:19.2px}.code-content-container{position:relative;flex:1;overflow:hidden}.hidden-textarea{position:absolute;top:0;left:0;width:100%;height:100%;opacity:0;z-index:2;resize:none;border:none;outline:none;padding:16px;font-family:inherit;font-size:13px;line-height:1.6;white-space:pre-wrap;word-wrap:break-word}.rendered-code{margin:0;padding:16px;font-family:inherit;font-size:13px;line-height:1.6;color:var(--text-primary, #0f172a);white-space:pre-wrap;word-wrap:break-word;pointer-events:none;z-index:1;overflow-y:auto}.cursor-pipe{color:var(--primary-color, #4f46e5);font-weight:700;animation:blink 1s step-end infinite}@keyframes blink{0%,to{opacity:0}50%{opacity:1}}.ghost-text{color:var(--text-muted, #94a3b8);font-style:italic;opacity:.7}.editor-footer{display:flex;justify-content:space-between;align-items:center;padding:12px 16px;background:var(--border-light, #f1f5f9);border-top:1px solid var(--border-color, #e2e8f0);gap:12px;flex-wrap:wrap}.editor-footer.justify-end{justify-content:flex-end}.suggestion-info{display:flex;align-items:center;gap:8px;font-size:12px;color:var(--text-secondary, #475569)}.sparkle{font-size:14px}.editor-kbd{background:var(--bg-secondary, #ffffff);border:1px solid var(--border-color, #e2e8f0);border-radius:3px;box-shadow:0 1px #0000001a;padding:1px 4px;font-size:11px;font-family:sans-serif;font-weight:600;color:var(--text-primary, #0f172a)}.action-buttons{display:flex;gap:8px}.footer-btn{padding:6px 12px;font-size:12px;font-weight:600;border-radius:6px;cursor:pointer;font-family:var(--ngx-font-family, sans-serif);transition:all .2s}.accept-btn{background:var(--primary-color, #4f46e5);border:1px solid var(--primary-color, #4f46e5);color:#fff}.accept-btn:hover{background:var(--primary-hover, #4338ca)}.reject-btn{background:transparent;border:1px solid var(--border-color, #e2e8f0);color:var(--text-secondary, #475569)}.reject-btn:hover{background:#0000000a;border-color:var(--text-secondary, #475569)}.primary-btn{background:var(--primary-color, #4f46e5);border:1px solid var(--primary-color, #4f46e5);color:#fff}.primary-btn:hover{background:var(--primary-hover, #4338ca)}.secondary-btn{background:transparent;border:1px solid var(--border-color, #e2e8f0);color:var(--text-secondary, #475569)}.secondary-btn:hover{background:#0000000a}.explanation-panel{background:linear-gradient(to right,#4f46e508,#7c3aed08);border-top:1px solid var(--border-color, #e2e8f0);padding:16px}.explanation-header{display:flex;justify-content:space-between;align-items:center;margin-bottom:8px;font-weight:700;font-size:13px;color:var(--primary-color, #4f46e5);font-family:var(--ngx-font-family, sans-serif)}.close-explanation-btn{background:transparent;border:none;color:var(--text-muted, #94a3b8);font-size:14px;cursor:pointer}.close-explanation-btn:hover{color:var(--text-primary, #0f172a)}.explanation-body{font-size:12px;line-height:1.6;color:var(--text-secondary, #475569);font-family:var(--ngx-font-family, sans-serif)}.toolbar-toggle-btn{background:transparent;border:1px solid var(--border-color, #cbd5e1);border-radius:6px;color:var(--text-secondary, #475569);cursor:pointer;font-size:11px;font-weight:600;padding:4px 8px;font-family:inherit;transition:all .2s}.toolbar-toggle-btn:hover{background:#0000000d;border-color:var(--text-primary, #0f172a);color:var(--text-primary, #0f172a)}.toolbar-toggle-btn.active{background:var(--primary-color, #4f46e5);border-color:var(--primary-color, #4f46e5);color:#fff}.diff-canvas{display:grid;grid-template-columns:1fr 1fr;min-height:180px;background:var(--bg-secondary, #ffffff);border-bottom:1px solid var(--border-color, #e2e8f0)}.diff-pane{display:flex;flex-direction:column;border-right:1px solid var(--border-color, #e2e8f0)}.diff-pane:last-child{border-right:none}.diff-pane-title{padding:6px 12px;background:#00000005;font-size:10px;font-weight:700;text-transform:uppercase;color:var(--text-secondary, #64748b);border-bottom:1px solid var(--border-color, #e2e8f0)}.diff-code{margin:0;padding:12px;font-family:inherit;font-size:12px;line-height:1.6;white-space:pre-wrap;overflow-y:auto;flex:1}.original-pane .diff-code{background:#ef444405;color:#991b1b}.proposed-pane .diff-code{background:#10b98105}.diff-highlight{background:#10b98126;color:#065f46;border-radius:2px;padding:1px 2px;font-weight:600}.suggestions-navigator{display:inline-flex;align-items:center;gap:6px;margin-left:12px;padding-left:12px;border-left:1px solid var(--border-color, #cbd5e1)}.nav-arrow{background:none;border:none;color:var(--primary-color, #4f46e5);cursor:pointer;font-size:10px;padding:2px 4px;border-radius:4px;transition:background .2s}.nav-arrow:hover{background:#4f46e51a}.nav-count{font-size:11px;font-weight:700;color:var(--text-primary, #0f172a)}.code-editor-wrapper.dark .toolbar-toggle-btn{border-color:#374151;color:#94a3b8}.code-editor-wrapper.dark .toolbar-toggle-btn:hover{background:#ffffff0d;color:#f8fafc}.code-editor-wrapper.dark .toolbar-toggle-btn.active{background:var(--primary-color, #6366f1);border-color:var(--primary-color, #6366f1);color:#fff}.code-editor-wrapper.dark .diff-canvas{background:#0f172a;border-bottom-color:#1f2937}.code-editor-wrapper.dark .diff-pane{border-right-color:#1f2937}.code-editor-wrapper.dark .diff-pane-title{background:#ffffff05;color:#94a3b8;border-bottom-color:#1f2937}.code-editor-wrapper.dark .original-pane .diff-code{background:#ef44440d;color:#fca5a5}.code-editor-wrapper.dark .proposed-pane .diff-code{background:#10b9810d;color:#e2e8f0}.code-editor-wrapper.dark .diff-highlight{background:#10b98140;color:#34d399}.code-editor-wrapper.dark .suggestions-navigator{border-left-color:#374151}.code-editor-wrapper.dark .nav-count{color:#cbd5e1}.code-editor-wrapper.dark .nav-arrow{color:#818cf8}.code-editor-wrapper.dark .nav-arrow:hover{background:#6366f126}.hl-keyword{color:#2563eb;font-weight:600}.hl-builtin{color:#7c3aed}.hl-number{color:#ea580c}.hl-string{color:#16a34a}.hl-comment{color:#94a3b8;font-style:italic}.hl-function{color:#d97706}.hl-tag{color:#2563eb}.hl-attr{color:#7c3aed}.hl-class{color:#d97706}.hl-id{color:#ef4444}.hl-pseudo{color:#8b5cf6}.hl-property{color:#0284c7}.hl-key{color:#2563eb;font-weight:600}.code-editor-wrapper.dark .hl-keyword{color:#60a5fa}.code-editor-wrapper.dark .hl-builtin{color:#a78bfa}.code-editor-wrapper.dark .hl-number{color:#fb923c}.code-editor-wrapper.dark .hl-string{color:#4ade80}.code-editor-wrapper.dark .hl-comment{color:#64748b}.code-editor-wrapper.dark .hl-function{color:#f59e0b}.code-editor-wrapper.dark .hl-tag{color:#60a5fa}.code-editor-wrapper.dark .hl-attr{color:#a78bfa}.code-editor-wrapper.dark .hl-class{color:#f59e0b}.code-editor-wrapper.dark .hl-id{color:#f87171}.code-editor-wrapper.dark .hl-pseudo{color:#c084fc}.code-editor-wrapper.dark .hl-property{color:#38bdf8}.code-editor-wrapper.dark .hl-key{color:#60a5fa}\n"] }]
|
|
1288
1717
|
}], propDecorators: { editorInput: [{
|
|
1289
1718
|
type: ViewChild,
|
|
1290
1719
|
args: ['editorInput']
|
|
@@ -1296,6 +1725,7 @@ class AIAudioWaveComponent {
|
|
|
1296
1725
|
color = input('');
|
|
1297
1726
|
theme = input('light');
|
|
1298
1727
|
muted = input(false);
|
|
1728
|
+
autoCapture = input(false);
|
|
1299
1729
|
// Outputs
|
|
1300
1730
|
stateChange = output();
|
|
1301
1731
|
mutedChange = output();
|
|
@@ -1305,7 +1735,7 @@ class AIAudioWaveComponent {
|
|
|
1305
1735
|
localMuted = signal(false);
|
|
1306
1736
|
speedMultiplier = signal(1.0);
|
|
1307
1737
|
// Pre-configured equalizer bars representation
|
|
1308
|
-
bars = [
|
|
1738
|
+
bars = signal([
|
|
1309
1739
|
{ height: 16, delay: '0.1s' },
|
|
1310
1740
|
{ height: 28, delay: '0.3s' },
|
|
1311
1741
|
{ height: 42, delay: '0.5s' },
|
|
@@ -1318,7 +1748,94 @@ class AIAudioWaveComponent {
|
|
|
1318
1748
|
{ height: 38, delay: '0.25s' },
|
|
1319
1749
|
{ height: 24, delay: '0.45s' },
|
|
1320
1750
|
{ height: 14, delay: '0.05s' }
|
|
1321
|
-
];
|
|
1751
|
+
]);
|
|
1752
|
+
defaultHeights = [16, 28, 42, 50, 36, 22, 30, 48, 52, 38, 24, 14];
|
|
1753
|
+
audioCtx;
|
|
1754
|
+
analyser;
|
|
1755
|
+
dataArray;
|
|
1756
|
+
stream;
|
|
1757
|
+
animationFrameId;
|
|
1758
|
+
constructor() {
|
|
1759
|
+
effect(() => {
|
|
1760
|
+
const capture = this.autoCapture();
|
|
1761
|
+
const stateVal = this.state();
|
|
1762
|
+
const isMutedVal = this.isMuted();
|
|
1763
|
+
if (capture && stateVal === 'listening' && !isMutedVal) {
|
|
1764
|
+
this.startMicCapture();
|
|
1765
|
+
}
|
|
1766
|
+
else {
|
|
1767
|
+
this.stopMicCapture();
|
|
1768
|
+
}
|
|
1769
|
+
});
|
|
1770
|
+
}
|
|
1771
|
+
ngOnDestroy() {
|
|
1772
|
+
this.stopMicCapture();
|
|
1773
|
+
}
|
|
1774
|
+
startMicCapture() {
|
|
1775
|
+
if (typeof window === 'undefined' || !navigator.mediaDevices || !navigator.mediaDevices.getUserMedia) {
|
|
1776
|
+
return;
|
|
1777
|
+
}
|
|
1778
|
+
this.stopMicCapture();
|
|
1779
|
+
navigator.mediaDevices.getUserMedia({ audio: true }).then(s => {
|
|
1780
|
+
this.stream = s;
|
|
1781
|
+
const AudioContextClass = window.AudioContext || window.webkitAudioContext;
|
|
1782
|
+
this.audioCtx = new AudioContextClass();
|
|
1783
|
+
const source = this.audioCtx.createMediaStreamSource(s);
|
|
1784
|
+
this.analyser = this.audioCtx.createAnalyser();
|
|
1785
|
+
this.analyser.fftSize = 64; // Small fft size for our 12 bars
|
|
1786
|
+
const bufferLength = this.analyser.frequencyBinCount;
|
|
1787
|
+
this.dataArray = new Uint8Array(bufferLength);
|
|
1788
|
+
source.connect(this.analyser);
|
|
1789
|
+
this.updateBarsFromAudio();
|
|
1790
|
+
}).catch(err => {
|
|
1791
|
+
console.warn('Microphone access denied or failed:', err);
|
|
1792
|
+
});
|
|
1793
|
+
}
|
|
1794
|
+
updateBarsFromAudio() {
|
|
1795
|
+
if (!this.analyser || !this.dataArray)
|
|
1796
|
+
return;
|
|
1797
|
+
this.analyser.getByteFrequencyData(this.dataArray);
|
|
1798
|
+
const barsLength = this.bars().length;
|
|
1799
|
+
const binSize = Math.floor(this.dataArray.length / barsLength) || 1;
|
|
1800
|
+
this.bars.update(current => {
|
|
1801
|
+
return current.map((bar, i) => {
|
|
1802
|
+
let sum = 0;
|
|
1803
|
+
for (let j = 0; j < binSize; j++) {
|
|
1804
|
+
sum += this.dataArray[i * binSize + j] || 0;
|
|
1805
|
+
}
|
|
1806
|
+
const avg = sum / binSize;
|
|
1807
|
+
const baseHeight = 10;
|
|
1808
|
+
const calculatedHeight = baseHeight + (avg / 255) * 55;
|
|
1809
|
+
return { ...bar, height: calculatedHeight };
|
|
1810
|
+
});
|
|
1811
|
+
});
|
|
1812
|
+
this.animationFrameId = requestAnimationFrame(() => this.updateBarsFromAudio());
|
|
1813
|
+
}
|
|
1814
|
+
stopMicCapture() {
|
|
1815
|
+
if (this.animationFrameId) {
|
|
1816
|
+
cancelAnimationFrame(this.animationFrameId);
|
|
1817
|
+
this.animationFrameId = undefined;
|
|
1818
|
+
}
|
|
1819
|
+
if (this.stream) {
|
|
1820
|
+
this.stream.getTracks().forEach(track => track.stop());
|
|
1821
|
+
this.stream = undefined;
|
|
1822
|
+
}
|
|
1823
|
+
if (this.audioCtx && this.audioCtx.state !== 'closed') {
|
|
1824
|
+
this.audioCtx.close();
|
|
1825
|
+
this.audioCtx = undefined;
|
|
1826
|
+
}
|
|
1827
|
+
this.analyser = undefined;
|
|
1828
|
+
this.dataArray = undefined;
|
|
1829
|
+
this.resetBars();
|
|
1830
|
+
}
|
|
1831
|
+
resetBars() {
|
|
1832
|
+
this.bars.update(current => {
|
|
1833
|
+
return current.map((bar, i) => ({
|
|
1834
|
+
...bar,
|
|
1835
|
+
height: this.defaultHeights[i] || 16
|
|
1836
|
+
}));
|
|
1837
|
+
});
|
|
1838
|
+
}
|
|
1322
1839
|
isMuted = computed(() => this.muted() || this.localMuted() || !this.micEnabled());
|
|
1323
1840
|
stateLabel = computed(() => {
|
|
1324
1841
|
switch (this.state()) {
|
|
@@ -1375,7 +1892,7 @@ class AIAudioWaveComponent {
|
|
|
1375
1892
|
this.mutedChange.emit(nextVal);
|
|
1376
1893
|
}
|
|
1377
1894
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.20", ngImport: i0, type: AIAudioWaveComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
1378
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.20", type: AIAudioWaveComponent, isStandalone: true, selector: "ngx-ai-audio-wave", inputs: { state: { classPropertyName: "state", publicName: "state", isSignal: true, isRequired: false, transformFunction: null }, color: { classPropertyName: "color", publicName: "color", isSignal: true, isRequired: false, transformFunction: null }, theme: { classPropertyName: "theme", publicName: "theme", isSignal: true, isRequired: false, transformFunction: null }, muted: { classPropertyName: "muted", publicName: "muted", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { stateChange: "stateChange", mutedChange: "mutedChange", micToggle: "micToggle" }, ngImport: i0, template: `
|
|
1895
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.20", type: AIAudioWaveComponent, isStandalone: true, selector: "ngx-ai-audio-wave", inputs: { state: { classPropertyName: "state", publicName: "state", isSignal: true, isRequired: false, transformFunction: null }, color: { classPropertyName: "color", publicName: "color", isSignal: true, isRequired: false, transformFunction: null }, theme: { classPropertyName: "theme", publicName: "theme", isSignal: true, isRequired: false, transformFunction: null }, muted: { classPropertyName: "muted", publicName: "muted", isSignal: true, isRequired: false, transformFunction: null }, autoCapture: { classPropertyName: "autoCapture", publicName: "autoCapture", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { stateChange: "stateChange", mutedChange: "mutedChange", micToggle: "micToggle" }, ngImport: i0, template: `
|
|
1379
1896
|
<div class="audio-wave-wrapper" [class.dark]="theme() === 'dark'">
|
|
1380
1897
|
<!-- Status Badge & Description -->
|
|
1381
1898
|
<div class="wave-header">
|
|
@@ -1390,7 +1907,7 @@ class AIAudioWaveComponent {
|
|
|
1390
1907
|
|
|
1391
1908
|
<!-- Equalizer Wave Container -->
|
|
1392
1909
|
<div class="equalizer-container" [class.muted]="isMuted()">
|
|
1393
|
-
@for (bar of bars; track
|
|
1910
|
+
@for (bar of bars(); track $index) {
|
|
1394
1911
|
<div
|
|
1395
1912
|
class="wave-bar"
|
|
1396
1913
|
[class]="state()"
|
|
@@ -1482,7 +1999,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.20", ngImpo
|
|
|
1482
1999
|
|
|
1483
2000
|
<!-- Equalizer Wave Container -->
|
|
1484
2001
|
<div class="equalizer-container" [class.muted]="isMuted()">
|
|
1485
|
-
@for (bar of bars; track
|
|
2002
|
+
@for (bar of bars(); track $index) {
|
|
1486
2003
|
<div
|
|
1487
2004
|
class="wave-bar"
|
|
1488
2005
|
[class]="state()"
|
|
@@ -1556,7 +2073,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.20", ngImpo
|
|
|
1556
2073
|
</div>
|
|
1557
2074
|
</div>
|
|
1558
2075
|
`, styles: [":host{display:block;width:100%}.audio-wave-wrapper{background:var(--bg-secondary, #ffffff);border:1px solid var(--border-color, #e2e8f0);border-radius:var(--radius-md, 10px);padding:20px;box-shadow:var(--shadow-md, 0 4px 6px -1px rgba(0, 0, 0, .08));display:flex;flex-direction:column;gap:20px;transition:background .3s,border-color .3s}.wave-header{display:flex;justify-content:space-between;align-items:center;font-family:var(--ngx-font-family, sans-serif)}.state-indicator{display:flex;align-items:center;gap:8px;font-size:13px;font-weight:700}.state-dot{width:8px;height:8px;border-radius:50%;background:#94a3b8;transition:background .3s}.state-indicator.idle .state-dot{background:#94a3b8}.state-indicator.listening .state-dot{background:#10b981;animation:blink 1.2s infinite}.state-indicator.thinking .state-dot{background:#3b82f6;animation:spin-color 2s infinite}.state-indicator.speaking .state-dot{background:#8b5cf6}.state-indicator.idle{color:var(--text-secondary, #475569)}.state-indicator.listening{color:#10b981}.state-indicator.thinking{color:#3b82f6}.state-indicator.speaking{color:#8b5cf6}@keyframes blink{0%,to{opacity:1}50%{opacity:.3}}@keyframes spin-color{0%{transform:scale(1);filter:brightness(1)}50%{transform:scale(1.2);filter:brightness(1.2)}to{transform:scale(1);filter:brightness(1)}}.amplitude-label{font-size:11px;color:var(--text-secondary, #475569);font-weight:500}.equalizer-container{display:flex;justify-content:center;align-items:center;gap:4px;height:70px;padding:0 10px;border-radius:var(--radius-sm, 6px);background:var(--border-light, #f1f5f9);overflow:hidden;transition:background .3s,opacity .3s}.equalizer-container.muted{opacity:.5}.wave-bar{width:4px;border-radius:9999px;transition:height .3s,background .3s}.wave-bar.idle{height:6px!important;opacity:.4}.wave-bar.listening{animation:listenPulse 1s ease-in-out infinite alternate}@keyframes listenPulse{0%{transform:scaleY(1)}to{transform:scaleY(3.5)}}.wave-bar.thinking{animation:thinkFlow 1.6s ease-in-out infinite}@keyframes thinkFlow{0%,to{transform:scaleY(1.2)}50%{transform:scaleY(5)}}.wave-bar.speaking{animation:speakBounce .8s cubic-bezier(.25,.8,.25,1) infinite alternate}@keyframes speakBounce{0%{transform:scaleY(1)}to{transform:scaleY(7.5)}}.controls-panel{display:flex;align-items:center;gap:12px;border-top:1px solid var(--border-color, #e2e8f0);padding-top:16px}.control-btn{width:38px;height:38px;border-radius:50%;border:1px solid var(--border-color, #e2e8f0);background:transparent;color:var(--text-secondary, #475569);cursor:pointer;display:flex;align-items:center;justify-content:center;transition:all .25s}.control-btn:hover{background:var(--border-light, #f1f5f9);color:var(--text-primary, #0f172a);border-color:var(--text-secondary, #475569)}.control-btn.active{background:var(--primary-color, #4f46e5);color:#fff;border-color:var(--primary-color, #4f46e5);box-shadow:0 0 0 3px var(--primary-glow, rgba(79, 70, 229, .15))}.control-btn.muted{color:#ef4444;border-color:#ef444433;background:#ef44440d}.control-btn.muted:hover{background:#ef44441a}.icon-svg{width:18px;height:18px}.slider-container{display:flex;align-items:center;gap:8px;margin-left:auto;font-family:var(--ngx-font-family, sans-serif);font-size:11px;color:var(--text-secondary, #475569)}.wave-speed-slider{width:80px;height:4px;background:var(--border-color, #e2e8f0);border-radius:2px;outline:none;-webkit-appearance:none;cursor:pointer}.wave-speed-slider::-webkit-slider-thumb{-webkit-appearance:none;width:12px;height:12px;border-radius:50%;background:var(--primary-color, #4f46e5);transition:transform .15s}.wave-speed-slider::-webkit-slider-thumb:hover{transform:scale(1.2)}.audio-wave-wrapper.dark{background:#0f172a;border-color:#1f2937}.audio-wave-wrapper.dark .equalizer-container{background:#1e293b}.audio-wave-wrapper.dark .control-btn{border-color:#374151;color:#94a3b8}.audio-wave-wrapper.dark .control-btn:hover{background:#1e293b;color:#f8fafc;border-color:#94a3b8}.audio-wave-wrapper.dark .control-btn.active{background:var(--primary-color, #6366f1);border-color:var(--primary-color, #6366f1);color:#fff}.audio-wave-wrapper.dark .controls-panel{border-top-color:#1f2937}.audio-wave-wrapper.dark .amplitude-label,.audio-wave-wrapper.dark .slider-label{color:#94a3b8}.audio-wave-wrapper.dark .wave-speed-slider{background:#374151}.audio-wave-wrapper.dark .wave-speed-slider::-webkit-slider-thumb{background:var(--primary-color, #6366f1)}\n"] }]
|
|
1559
|
-
}] });
|
|
2076
|
+
}], ctorParameters: () => [] });
|
|
1560
2077
|
|
|
1561
2078
|
class AIModelCompareComponent {
|
|
1562
2079
|
// Inputs
|
|
@@ -1904,9 +2421,354 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.20", ngImpo
|
|
|
1904
2421
|
`, styles: [":host{display:block;width:100%}.model-compare-wrapper{background:var(--bg-secondary, #ffffff);border:1px solid var(--border-color, #e2e8f0);border-radius:var(--radius-md, 10px);box-shadow:var(--shadow-md, 0 4px 6px -1px rgba(0, 0, 0, .08));overflow:hidden;display:flex;flex-direction:column;transition:all .3s}.toolbar-header{display:flex;justify-content:space-between;align-items:center;padding:16px 20px;border-bottom:1px solid var(--border-color, #e2e8f0);gap:16px;flex-wrap:wrap}.search-box{display:flex;align-items:center;gap:8px;border:1px solid var(--border-color, #e2e8f0);border-radius:var(--radius-sm, 6px);padding:6px 12px;background:var(--bg-primary, #f8fafc);min-width:250px;flex:1;max-width:400px}.search-icon{font-size:14px}.filter-input{border:none;background:transparent;outline:none;font-size:13px;width:100%;color:var(--text-primary, #0f172a)}.filter-tags{display:flex;gap:8px;overflow-x:auto;padding-bottom:2px}.tag-btn{padding:6px 12px;font-size:12px;font-weight:600;border-radius:9999px;border:1px solid var(--border-color, #e2e8f0);background:transparent;color:var(--text-secondary, #475569);cursor:pointer;font-family:var(--ngx-font-family, sans-serif);transition:all .2s}.tag-btn:hover{background:var(--border-light, #f1f5f9);color:var(--text-primary, #0f172a)}.tag-btn.active{background:var(--primary-color, #4f46e5);border-color:var(--primary-color, #4f46e5);color:#fff}.table-container{overflow-x:auto}.compare-table{width:100%;border-collapse:collapse;text-align:left;font-family:var(--ngx-font-family, sans-serif);font-size:13px}.compare-table th{padding:14px 20px;font-weight:700;color:var(--text-secondary, #475569);background:var(--border-light, #f1f5f9);border-bottom:1px solid var(--border-color, #e2e8f0);-webkit-user-select:none;user-select:none}.compare-table td{padding:16px 20px;border-bottom:1px solid var(--border-light, #f1f5f9);vertical-align:middle;color:var(--text-primary, #0f172a);transition:background .15s}.model-row{cursor:pointer}.model-row:hover td{background:#4f46e505}.model-row.selected td{background:#4f46e50d}.model-row.recommended{position:relative}.model-title-wrap{display:flex;flex-direction:column;gap:2px}.model-name{font-weight:700;display:flex;align-items:center;gap:6px}.model-provider{font-size:11px;color:var(--text-secondary, #475569)}.badge-recommended{background:#e0e7ff;color:#4f46e5;font-size:10px;padding:1px 6px;border-radius:4px;font-weight:700}.badge-beta{background:#fef3c7;color:#d97706;font-size:10px;padding:1px 6px;border-radius:4px;font-weight:700}.param-tag{background:var(--border-light, #f1f5f9);color:var(--text-secondary, #475569);padding:2px 8px;border-radius:4px;font-size:11px;font-weight:600}.pricing-wrap{display:flex;align-items:center;font-weight:600}.price-slash{color:var(--text-muted, #94a3b8);margin:0 4px}.latency-graph-wrap{display:flex;flex-direction:column;gap:6px;width:100px}.latency-metrics{display:flex;justify-content:space-between;font-size:11px;font-weight:600;color:var(--text-secondary, #475569)}.bar-track{height:6px;background:var(--border-color, #e2e8f0);border-radius:3px;overflow:hidden}.bar-fill{height:100%;border-radius:3px}.bar-fill.fast{background:#10b981}.bar-fill.moderate{background:#f59e0b}.bar-fill.slow{background:#ef4444}.capabilities-icons{display:flex;gap:6px;font-size:15px}.capabilities-icons span{opacity:.2;filter:grayscale(1);transition:opacity .2s}.capabilities-icons span.active{opacity:1;filter:none}.rating-stars{color:#f59e0b;font-size:14px;letter-spacing:-2px;white-space:nowrap}.star{opacity:.2}.star.filled{opacity:1}.select-btn{padding:6px 12px;font-size:11px;font-weight:700;border-radius:6px;border:1px solid var(--border-color, #e2e8f0);background:transparent;color:var(--text-secondary, #475569);cursor:pointer;font-family:var(--ngx-font-family, sans-serif);transition:all .2s;width:76px}.select-btn:hover{background:#4f46e50d;color:var(--primary-color, #4f46e5);border-color:var(--primary-color, #4f46e5)}.select-btn.active{background:var(--primary-color, #4f46e5);border-color:var(--primary-color, #4f46e5);color:#fff}.empty-state{text-align:center;padding:30px!important;color:var(--text-secondary, #475569);font-style:italic}.model-compare-wrapper.dark{background:#0f172a;border-color:#1f2937}.model-compare-wrapper.dark .toolbar-header{border-bottom-color:#1f2937}.model-compare-wrapper.dark .search-box{border-color:#1f2937;background:#0b0f19}.model-compare-wrapper.dark .filter-input{color:#f8fafc}.model-compare-wrapper.dark .tag-btn{border-color:#374151;color:#94a3b8}.model-compare-wrapper.dark .tag-btn:hover{background:#1f2937;color:#f8fafc}.model-compare-wrapper.dark .tag-btn.active{background:var(--primary-color, #6366f1);border-color:var(--primary-color, #6366f1);color:#fff}.model-compare-wrapper.dark .compare-table th{background:#1e293b;border-bottom-color:#1f2937;color:#94a3b8}.model-compare-wrapper.dark .compare-table td{border-bottom-color:#1f2937;color:#e2e8f0}.model-compare-wrapper.dark .model-row:hover td{background:#6366f105}.model-compare-wrapper.dark .model-row.selected td{background:#6366f10d}.model-compare-wrapper.dark .badge-recommended{background:#6366f126;color:#818cf8}.model-compare-wrapper.dark .badge-beta{background:#f59e0b26;color:#fbbf24}.model-compare-wrapper.dark .param-tag{background:#1e293b;color:#94a3b8}.model-compare-wrapper.dark .model-provider{color:#6b7280}.model-compare-wrapper.dark .bar-track{background:#1f2937}.model-compare-wrapper.dark .latency-metrics{color:#94a3b8}.model-compare-wrapper.dark .select-btn{border-color:#374151;color:#94a3b8}.model-compare-wrapper.dark .select-btn:hover{background:#6366f10d;color:var(--primary-color, #6366f1);border-color:var(--primary-color, #6366f1)}.model-compare-wrapper.dark .select-btn.active{background:var(--primary-color, #6366f1);border-color:var(--primary-color, #6366f1);color:#fff}\n"] }]
|
|
1905
2422
|
}] });
|
|
1906
2423
|
|
|
2424
|
+
class AIRagInspectorComponent {
|
|
2425
|
+
// Inputs
|
|
2426
|
+
sources = input([]);
|
|
2427
|
+
title = input('Search Citations & Sources');
|
|
2428
|
+
theme = input('light');
|
|
2429
|
+
// Outputs
|
|
2430
|
+
sourceClick = output();
|
|
2431
|
+
sourceFeedback = output();
|
|
2432
|
+
// State
|
|
2433
|
+
searchQuery = signal('');
|
|
2434
|
+
expandedId = signal(null);
|
|
2435
|
+
// Map to store feedback local state
|
|
2436
|
+
feedbackMap = {};
|
|
2437
|
+
// Compute filtered sources based on search keyword
|
|
2438
|
+
filteredSources = computed(() => {
|
|
2439
|
+
const query = this.searchQuery().toLowerCase().trim();
|
|
2440
|
+
const list = this.sources() || [];
|
|
2441
|
+
if (!query)
|
|
2442
|
+
return list;
|
|
2443
|
+
return list.filter(s => s.title.toLowerCase().includes(query) ||
|
|
2444
|
+
s.snippet.toLowerCase().includes(query) ||
|
|
2445
|
+
(s.metadata?.filePath && s.metadata.filePath.toLowerCase().includes(query)));
|
|
2446
|
+
});
|
|
2447
|
+
toggleExpand(id) {
|
|
2448
|
+
if (this.expandedId() === id) {
|
|
2449
|
+
this.expandedId.set(null);
|
|
2450
|
+
}
|
|
2451
|
+
else {
|
|
2452
|
+
this.expandedId.set(id);
|
|
2453
|
+
const matched = this.sources().find(s => s.id === id);
|
|
2454
|
+
if (matched) {
|
|
2455
|
+
this.sourceClick.emit(matched);
|
|
2456
|
+
}
|
|
2457
|
+
}
|
|
2458
|
+
}
|
|
2459
|
+
submitFeedback(source, type) {
|
|
2460
|
+
if (this.feedbackMap[source.id] === type) {
|
|
2461
|
+
// Toggle off
|
|
2462
|
+
delete this.feedbackMap[source.id];
|
|
2463
|
+
}
|
|
2464
|
+
else {
|
|
2465
|
+
this.feedbackMap[source.id] = type;
|
|
2466
|
+
}
|
|
2467
|
+
this.sourceFeedback.emit({ sourceId: source.id, type });
|
|
2468
|
+
}
|
|
2469
|
+
// Basic HTML text highlight formatter
|
|
2470
|
+
highlightText(text) {
|
|
2471
|
+
const query = this.searchQuery().toLowerCase().trim();
|
|
2472
|
+
if (!text || !query)
|
|
2473
|
+
return this.escapeHtml(text);
|
|
2474
|
+
// Escape code
|
|
2475
|
+
const escaped = this.escapeHtml(text);
|
|
2476
|
+
// Find matches safely and wrap with dynamic class highlight-mark
|
|
2477
|
+
try {
|
|
2478
|
+
// Avoid breaking search if containing regex chars
|
|
2479
|
+
const safeQuery = query.replace(/[-\\/\\\\^$*+?.()|[\\]{}]/g, '\\$&');
|
|
2480
|
+
const regex = new RegExp(`(${safeQuery})`, 'gi');
|
|
2481
|
+
return escaped.replace(regex, '<mark class="highlight-mark">$1</mark>');
|
|
2482
|
+
}
|
|
2483
|
+
catch (e) {
|
|
2484
|
+
return escaped;
|
|
2485
|
+
}
|
|
2486
|
+
}
|
|
2487
|
+
escapeHtml(unsafe) {
|
|
2488
|
+
return unsafe
|
|
2489
|
+
.replace(/&/g, '&')
|
|
2490
|
+
.replace(/</g, '<')
|
|
2491
|
+
.replace(/>/g, '>')
|
|
2492
|
+
.replace(/"/g, '"')
|
|
2493
|
+
.replace(/'/g, ''');
|
|
2494
|
+
}
|
|
2495
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.20", ngImport: i0, type: AIRagInspectorComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
2496
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.20", type: AIRagInspectorComponent, isStandalone: true, selector: "ngx-ai-rag-inspector", inputs: { sources: { classPropertyName: "sources", publicName: "sources", isSignal: true, isRequired: false, transformFunction: null }, title: { classPropertyName: "title", publicName: "title", isSignal: true, isRequired: false, transformFunction: null }, theme: { classPropertyName: "theme", publicName: "theme", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { sourceClick: "sourceClick", sourceFeedback: "sourceFeedback" }, ngImport: i0, template: `
|
|
2497
|
+
<div class="rag-inspector" [class.dark]="theme() === 'dark'">
|
|
2498
|
+
<!-- Header with Search & Title -->
|
|
2499
|
+
<div class="inspector-header">
|
|
2500
|
+
<div class="header-main">
|
|
2501
|
+
<span class="sparkle-icon">🔍</span>
|
|
2502
|
+
<h4 class="title">{{ title() }}</h4>
|
|
2503
|
+
<span class="badge" *ngIf="sources().length > 0">{{ filteredSources().length }} Citations</span>
|
|
2504
|
+
</div>
|
|
2505
|
+
|
|
2506
|
+
<div class="search-box">
|
|
2507
|
+
<input
|
|
2508
|
+
type="text"
|
|
2509
|
+
[ngModel]="searchQuery()"
|
|
2510
|
+
(ngModelChange)="searchQuery.set($event)"
|
|
2511
|
+
placeholder="Search matching snippets..."
|
|
2512
|
+
class="search-input"
|
|
2513
|
+
/>
|
|
2514
|
+
</div>
|
|
2515
|
+
</div>
|
|
2516
|
+
|
|
2517
|
+
<!-- Sources List -->
|
|
2518
|
+
<div class="sources-container">
|
|
2519
|
+
@if (filteredSources().length === 0) {
|
|
2520
|
+
<div class="empty-state">
|
|
2521
|
+
<span class="empty-icon">📂</span>
|
|
2522
|
+
<p class="empty-text">No document citations found for the search query.</p>
|
|
2523
|
+
</div>
|
|
2524
|
+
} @else {
|
|
2525
|
+
<div class="sources-list">
|
|
2526
|
+
@for (src of filteredSources(); track src.id) {
|
|
2527
|
+
<div
|
|
2528
|
+
class="source-card"
|
|
2529
|
+
[class.expanded]="expandedId() === src.id"
|
|
2530
|
+
[class.has-feedback]="feedbackMap[src.id] !== undefined"
|
|
2531
|
+
(click)="toggleExpand(src.id)"
|
|
2532
|
+
>
|
|
2533
|
+
<!-- Card Header -->
|
|
2534
|
+
<div class="card-summary">
|
|
2535
|
+
<div class="source-type-icon" [title]="src.sourceType">
|
|
2536
|
+
@switch (src.sourceType) {
|
|
2537
|
+
@case ('pdf') {
|
|
2538
|
+
<svg viewBox="0 0 24 24" class="svg-icon red"><path d="M20 2H8c-1.1 0-2 .9-2 2v12c0 1.1.9 2 2 2h12c1.1 0 2-.9 2-2V4c0-1.1-.9-2-2-2zm-8.5 7.5c0 .83-.67 1.5-1.5 1.5H9v2H7.5V7H10c.83 0 1.5.67 1.5 1.5v1zm5 2c0 .83-.67 1.5-1.5 1.5h-2.5V7H15c.83 0 1.5.67 1.5 1.5v3zm4-3.5h-3v1.5h2V11h-2v1.5H19V7.5h1.5v1zM4 6H2v14c0 1.1.9 2 2 2h14v-2H4V6zm11 2.5h1v3h-1v-3z"/></svg>
|
|
2539
|
+
}
|
|
2540
|
+
@case ('docx') {
|
|
2541
|
+
<svg viewBox="0 0 24 24" class="svg-icon blue"><path d="M14 2H6c-1.1 0-1.99.9-1.99 2L4 20c0 1.1.89 2 1.99 2H18c1.1 0 2-.9 2-2V8l-6-6zm2 16H8v-2h8v2zm0-4H8v-2h8v2zm-3-5V3.5L18.5 9H13z"/></svg>
|
|
2542
|
+
}
|
|
2543
|
+
@case ('txt') {
|
|
2544
|
+
<svg viewBox="0 0 24 24" class="svg-icon slate"><path d="M14 2H6c-1.1 0-1.99.9-1.99 2L4 20c0 1.1.89 2 1.99 2H18c1.1 0 2-.9 2-2V8l-6-6zm2 16H8v-2h8v2zm0-4H8v-2h8v2zm-3-5V3.5L18.5 9H13z"/></svg>
|
|
2545
|
+
}
|
|
2546
|
+
@case ('csv') {
|
|
2547
|
+
<svg viewBox="0 0 24 24" class="svg-icon green"><path d="M5 4h14a2 2 0 0 1 2 2v12a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2zm0 4h3v3H5V8zm5 0h4v3h-4V8zm9 0v3h-4V8h4zm-9 5h4v3h-4v-3zm9 0v3h-4v-3h4zM5 13h3v3H5v-3z"/></svg>
|
|
2548
|
+
}
|
|
2549
|
+
@case ('web') {
|
|
2550
|
+
<svg viewBox="0 0 24 24" class="svg-icon purple"><path d="M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm-1 17.93c-3.95-.49-7-3.85-7-7.93 0-.62.08-1.21.21-1.79L9 15v1c0 1.1.9 2 2 2v1.93zm6.9-2.53c-.26-.81-1-1.4-1.9-1.4h-1v-3c0-.55-.45-1-1-1h-6v-2h2c.55 0 1-.45 1-1V7h2c1.1 0 2-.9 2-2v-.41c2.93 1.19 5 4.06 5 7.41 0 2.08-.8 3.97-2.1 5.39z"/></svg>
|
|
2551
|
+
}
|
|
2552
|
+
@default {
|
|
2553
|
+
<svg viewBox="0 0 24 24" class="svg-icon gray"><path d="M14 2H6c-1.1 0-1.99.9-1.99 2L4 20c0 1.1.89 2 1.99 2H18c1.1 0 2-.9 2-2V8l-6-6zm2 16H8v-2h8v2zm0-4H8v-2h8v2zm-3-5V3.5L18.5 9H13z"/></svg>
|
|
2554
|
+
}
|
|
2555
|
+
}
|
|
2556
|
+
</div>
|
|
2557
|
+
|
|
2558
|
+
<div class="meta-info">
|
|
2559
|
+
<span class="source-title">{{ src.title }}</span>
|
|
2560
|
+
<div class="badge-row">
|
|
2561
|
+
<span class="meta-badge" *ngIf="src.metadata?.pageNumber">Page {{ src.metadata?.pageNumber }}</span>
|
|
2562
|
+
<span class="meta-badge" *ngIf="src.metadata?.chunkIndex">Chunk #{{ src.metadata?.chunkIndex }}</span>
|
|
2563
|
+
</div>
|
|
2564
|
+
</div>
|
|
2565
|
+
|
|
2566
|
+
<!-- Similarity Bar -->
|
|
2567
|
+
<div class="similarity-score-wrap" (click)="$event.stopPropagation()">
|
|
2568
|
+
<div class="score-label">
|
|
2569
|
+
<span>Match</span>
|
|
2570
|
+
<strong>{{ (src.score * 100).toFixed(0) }}%</strong>
|
|
2571
|
+
</div>
|
|
2572
|
+
<div class="score-bar-track">
|
|
2573
|
+
<div
|
|
2574
|
+
class="score-bar-fill"
|
|
2575
|
+
[style.width.%]="src.score * 100"
|
|
2576
|
+
[class.high]="src.score >= 0.8"
|
|
2577
|
+
[class.medium]="src.score >= 0.5 && src.score < 0.8"
|
|
2578
|
+
[class.low]="src.score < 0.5"
|
|
2579
|
+
></div>
|
|
2580
|
+
</div>
|
|
2581
|
+
</div>
|
|
2582
|
+
|
|
2583
|
+
<!-- Expand Arrow -->
|
|
2584
|
+
<div class="expand-indicator">
|
|
2585
|
+
<svg viewBox="0 0 24 24" class="arrow-icon"><path d="M7 10l5 5 5-5z"/></svg>
|
|
2586
|
+
</div>
|
|
2587
|
+
</div>
|
|
2588
|
+
|
|
2589
|
+
<!-- Expanded Content Area -->
|
|
2590
|
+
<div class="card-details" (click)="$event.stopPropagation()">
|
|
2591
|
+
<div class="snippet-content">
|
|
2592
|
+
<pre class="snippet-text" [innerHTML]="highlightText(src.snippet)"></pre>
|
|
2593
|
+
</div>
|
|
2594
|
+
|
|
2595
|
+
<div class="footer-actions">
|
|
2596
|
+
<!-- Path metadata -->
|
|
2597
|
+
<div class="file-path" *ngIf="src.metadata?.filePath" [title]="src.metadata?.filePath">
|
|
2598
|
+
<span>Path: </span><code>{{ src.metadata?.filePath }}</code>
|
|
2599
|
+
</div>
|
|
2600
|
+
|
|
2601
|
+
<!-- Helpful feedback controls -->
|
|
2602
|
+
<div class="feedback-controls">
|
|
2603
|
+
<span class="feedback-label">Helpful citation?</span>
|
|
2604
|
+
<button
|
|
2605
|
+
class="feedback-btn thumbs-up"
|
|
2606
|
+
[class.selected]="feedbackMap[src.id] === 'up'"
|
|
2607
|
+
(click)="submitFeedback(src, 'up')"
|
|
2608
|
+
title="Yes, helpful"
|
|
2609
|
+
>
|
|
2610
|
+
👍
|
|
2611
|
+
</button>
|
|
2612
|
+
<button
|
|
2613
|
+
class="feedback-btn thumbs-down"
|
|
2614
|
+
[class.selected]="feedbackMap[src.id] === 'down'"
|
|
2615
|
+
(click)="submitFeedback(src, 'down')"
|
|
2616
|
+
title="No, unhelpful"
|
|
2617
|
+
>
|
|
2618
|
+
👎
|
|
2619
|
+
</button>
|
|
2620
|
+
</div>
|
|
2621
|
+
</div>
|
|
2622
|
+
</div>
|
|
2623
|
+
</div>
|
|
2624
|
+
}
|
|
2625
|
+
</div>
|
|
2626
|
+
}
|
|
2627
|
+
</div>
|
|
2628
|
+
</div>
|
|
2629
|
+
`, isInline: true, styles: [":host{display:block;width:100%}.rag-inspector{background:var(--bg-secondary, #ffffff);border:1px solid var(--border-color, #e2e8f0);border-radius:var(--radius-md, 12px);box-shadow:var(--shadow-md, 0 4px 6px -1px rgba(0, 0, 0, .08));display:flex;flex-direction:column;overflow:hidden;font-family:var(--ngx-font-family, system-ui, -apple-system, sans-serif);transition:all .3s ease}.inspector-header{padding:16px 20px;border-bottom:1px solid var(--border-color, #e2e8f0);background:var(--border-light, #f8fafc);display:flex;justify-content:space-between;align-items:center;gap:16px;flex-wrap:wrap}.header-main{display:flex;align-items:center;gap:8px}.sparkle-icon{font-size:16px}.title{margin:0;font-size:15px;font-weight:750;color:var(--text-primary, #0f172a)}.badge{font-size:10px;font-weight:700;background:var(--primary-glow, rgba(79, 70, 229, .15));color:var(--primary-color, #4f46e5);padding:2px 8px;border-radius:9999px}.search-box{min-width:200px;flex:1;max-width:300px}.search-input{width:100%;border:1px solid var(--border-color, #cbd5e1);border-radius:6px;padding:6px 12px;font-size:12px;outline:none;background:var(--bg-primary, #ffffff);color:var(--text-primary, #0f172a);transition:border-color .15s}.search-input:focus{border-color:var(--primary-color, #4f46e5)}.sources-container{padding:16px;overflow-y:auto;max-height:450px;background:var(--bg-primary, #ffffff)}.sources-list{display:flex;flex-direction:column;gap:12px}.source-card{border:1px solid var(--border-color, #e2e8f0);border-radius:8px;background:var(--bg-secondary, #ffffff);overflow:hidden;cursor:pointer;transition:all .2s cubic-bezier(.4,0,.2,1)}.source-card:hover{box-shadow:0 4px 12px #0000000a;border-color:var(--border-color-hover, #cbd5e1);transform:translateY(-1px)}.source-card.expanded{border-color:var(--primary-color, #4f46e5);box-shadow:0 4px 16px var(--primary-glow, rgba(79, 70, 229, .1))}.source-card.has-feedback{background:#f8fafc80}.card-summary{padding:12px 16px;display:flex;align-items:center;gap:16px;flex-wrap:wrap}.source-type-icon{width:32px;height:32px;border-radius:8px;background:var(--border-light, #f1f5f9);display:flex;align-items:center;justify-content:center;flex-shrink:0}.svg-icon{width:20px;height:20px}.svg-icon.red{fill:#ef4444}.svg-icon.blue{fill:#3b82f6}.svg-icon.green{fill:#10b981}.svg-icon.purple{fill:#8b5cf6}.svg-icon.slate{fill:#64748b}.svg-icon.gray{fill:#94a3b8}.meta-info{flex:1;display:flex;flex-direction:column;gap:4px;min-width:150px}.source-title{font-size:13.5px;font-weight:650;color:var(--text-primary, #1e293b);word-break:break-all}.badge-row{display:flex;gap:6px;flex-wrap:wrap}.meta-badge{font-size:10px;background:var(--border-light, #f1f5f9);color:var(--text-secondary, #64748b);padding:1px 6px;border-radius:4px;font-weight:600}.similarity-score-wrap{display:flex;flex-direction:column;gap:4px;width:110px;flex-shrink:0}.score-label{display:flex;justify-content:space-between;font-size:10px;color:var(--text-secondary, #64748b);font-weight:600}.score-bar-track{height:6px;background:var(--border-color, #e2e8f0);border-radius:3px;overflow:hidden}.score-bar-fill{height:100%;border-radius:3px}.score-bar-fill.high{background:#10b981}.score-bar-fill.medium{background:#f59e0b}.score-bar-fill.low{background:#ef4444}.expand-indicator{display:flex;align-items:center;justify-content:center;color:var(--text-muted, #94a3b8);transition:transform .2s ease;flex-shrink:0}.arrow-icon{width:20px;height:20px;fill:currentColor}.source-card.expanded .expand-indicator{transform:rotate(180deg);color:var(--primary-color, #4f46e5)}.card-details{max-height:0;overflow:hidden;transition:max-height .25s cubic-bezier(0,1,0,1);border-top:1px solid transparent;background:#00000003}.source-card.expanded .card-details{max-height:1000px;border-top-color:var(--border-color, #e2e8f0);transition:max-height .3s ease-in}.snippet-content{padding:16px 20px}.snippet-text{margin:0;white-space:pre-wrap;font-family:inherit;font-size:12.5px;line-height:1.6;color:var(--text-primary, #334155)}::ng-deep .highlight-mark{background:#fef08a;color:#854d0e;padding:1px 3px;border-radius:3px;font-weight:600}.footer-actions{padding:12px 20px 16px;display:flex;justify-content:space-between;align-items:center;gap:12px;flex-wrap:wrap;border-top:1px dashed var(--border-color, #e2e8f0);font-size:11px}.file-path{color:var(--text-secondary, #64748b);text-overflow:ellipsis;overflow:hidden;white-space:nowrap;max-width:60%}.file-path code{background:var(--border-light, #f1f5f9);padding:2px 6px;border-radius:4px;font-family:monospace}.feedback-controls{display:flex;align-items:center;gap:8px}.feedback-label{color:var(--text-secondary, #64748b);font-weight:600}.feedback-btn{background:var(--bg-secondary, #ffffff);border:1px solid var(--border-color, #e2e8f0);border-radius:6px;width:28px;height:28px;display:flex;align-items:center;justify-content:center;cursor:pointer;font-size:11px;transition:all .2s}.feedback-btn:hover{border-color:var(--text-secondary, #94a3b8);background:var(--border-light, #f8fafc)}.feedback-btn.selected{border-color:var(--primary-color, #4f46e5);background:var(--primary-glow, rgba(79, 70, 229, .08));transform:scale(1.1)}.empty-state{padding:40px 20px;text-align:center;display:flex;flex-direction:column;align-items:center;justify-content:center}.empty-icon{font-size:32px;margin-bottom:8px;opacity:.6}.empty-text{color:var(--text-secondary, #64748b);font-style:italic;font-size:12px;margin:0}.rag-inspector.dark{background:#0f172a;border-color:#1f2937;box-shadow:0 4px 6px -1px #0006}.rag-inspector.dark .inspector-header{background:#1e293b;border-bottom-color:#1f2937}.rag-inspector.dark .title{color:#f8fafc}.rag-inspector.dark .search-input{border-color:#374151;background:#0b0f19;color:#f8fafc}.rag-inspector.dark .search-input:focus{border-color:var(--primary-color, #6366f1)}.rag-inspector.dark .sources-container{background:#0f172a}.rag-inspector.dark .source-card{border-color:#1f2937;background:#1e293b}.rag-inspector.dark .source-card:hover{border-color:#374151;box-shadow:0 4px 12px #00000040}.rag-inspector.dark .source-card.expanded{border-color:var(--primary-color, #6366f1);box-shadow:0 4px 16px #6366f126}.rag-inspector.dark .source-card.has-feedback{background:#0f172a80}.rag-inspector.dark .source-type-icon{background:#0f172a}.rag-inspector.dark .source-title{color:#f8fafc}.rag-inspector.dark .meta-badge{background:#0f172a;color:#94a3b8}.rag-inspector.dark .score-bar-track{background:#1f2937}.rag-inspector.dark .snippet-text{color:#cbd5e1}.rag-inspector.dark ::ng-deep .highlight-mark{background:#854d0e;color:#fef08a}.rag-inspector.dark .footer-actions{border-top-color:#1f2937}.rag-inspector.dark .file-path{color:#94a3b8}.rag-inspector.dark .file-path code{background:#0f172a;color:#cbd5e1}.rag-inspector.dark .feedback-btn{background:#1e293b;border-color:#374151}.rag-inspector.dark .feedback-btn:hover{background:#1f2937;border-color:#4b5563}.rag-inspector.dark .feedback-btn.selected{border-color:var(--primary-color, #6366f1);background:#6366f126}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "ngmodule", type: FormsModule }, { kind: "directive", type: i2.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: i2.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i2.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }] });
|
|
2630
|
+
}
|
|
2631
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.20", ngImport: i0, type: AIRagInspectorComponent, decorators: [{
|
|
2632
|
+
type: Component,
|
|
2633
|
+
args: [{ selector: 'ngx-ai-rag-inspector', standalone: true, imports: [CommonModule, FormsModule], template: `
|
|
2634
|
+
<div class="rag-inspector" [class.dark]="theme() === 'dark'">
|
|
2635
|
+
<!-- Header with Search & Title -->
|
|
2636
|
+
<div class="inspector-header">
|
|
2637
|
+
<div class="header-main">
|
|
2638
|
+
<span class="sparkle-icon">🔍</span>
|
|
2639
|
+
<h4 class="title">{{ title() }}</h4>
|
|
2640
|
+
<span class="badge" *ngIf="sources().length > 0">{{ filteredSources().length }} Citations</span>
|
|
2641
|
+
</div>
|
|
2642
|
+
|
|
2643
|
+
<div class="search-box">
|
|
2644
|
+
<input
|
|
2645
|
+
type="text"
|
|
2646
|
+
[ngModel]="searchQuery()"
|
|
2647
|
+
(ngModelChange)="searchQuery.set($event)"
|
|
2648
|
+
placeholder="Search matching snippets..."
|
|
2649
|
+
class="search-input"
|
|
2650
|
+
/>
|
|
2651
|
+
</div>
|
|
2652
|
+
</div>
|
|
2653
|
+
|
|
2654
|
+
<!-- Sources List -->
|
|
2655
|
+
<div class="sources-container">
|
|
2656
|
+
@if (filteredSources().length === 0) {
|
|
2657
|
+
<div class="empty-state">
|
|
2658
|
+
<span class="empty-icon">📂</span>
|
|
2659
|
+
<p class="empty-text">No document citations found for the search query.</p>
|
|
2660
|
+
</div>
|
|
2661
|
+
} @else {
|
|
2662
|
+
<div class="sources-list">
|
|
2663
|
+
@for (src of filteredSources(); track src.id) {
|
|
2664
|
+
<div
|
|
2665
|
+
class="source-card"
|
|
2666
|
+
[class.expanded]="expandedId() === src.id"
|
|
2667
|
+
[class.has-feedback]="feedbackMap[src.id] !== undefined"
|
|
2668
|
+
(click)="toggleExpand(src.id)"
|
|
2669
|
+
>
|
|
2670
|
+
<!-- Card Header -->
|
|
2671
|
+
<div class="card-summary">
|
|
2672
|
+
<div class="source-type-icon" [title]="src.sourceType">
|
|
2673
|
+
@switch (src.sourceType) {
|
|
2674
|
+
@case ('pdf') {
|
|
2675
|
+
<svg viewBox="0 0 24 24" class="svg-icon red"><path d="M20 2H8c-1.1 0-2 .9-2 2v12c0 1.1.9 2 2 2h12c1.1 0 2-.9 2-2V4c0-1.1-.9-2-2-2zm-8.5 7.5c0 .83-.67 1.5-1.5 1.5H9v2H7.5V7H10c.83 0 1.5.67 1.5 1.5v1zm5 2c0 .83-.67 1.5-1.5 1.5h-2.5V7H15c.83 0 1.5.67 1.5 1.5v3zm4-3.5h-3v1.5h2V11h-2v1.5H19V7.5h1.5v1zM4 6H2v14c0 1.1.9 2 2 2h14v-2H4V6zm11 2.5h1v3h-1v-3z"/></svg>
|
|
2676
|
+
}
|
|
2677
|
+
@case ('docx') {
|
|
2678
|
+
<svg viewBox="0 0 24 24" class="svg-icon blue"><path d="M14 2H6c-1.1 0-1.99.9-1.99 2L4 20c0 1.1.89 2 1.99 2H18c1.1 0 2-.9 2-2V8l-6-6zm2 16H8v-2h8v2zm0-4H8v-2h8v2zm-3-5V3.5L18.5 9H13z"/></svg>
|
|
2679
|
+
}
|
|
2680
|
+
@case ('txt') {
|
|
2681
|
+
<svg viewBox="0 0 24 24" class="svg-icon slate"><path d="M14 2H6c-1.1 0-1.99.9-1.99 2L4 20c0 1.1.89 2 1.99 2H18c1.1 0 2-.9 2-2V8l-6-6zm2 16H8v-2h8v2zm0-4H8v-2h8v2zm-3-5V3.5L18.5 9H13z"/></svg>
|
|
2682
|
+
}
|
|
2683
|
+
@case ('csv') {
|
|
2684
|
+
<svg viewBox="0 0 24 24" class="svg-icon green"><path d="M5 4h14a2 2 0 0 1 2 2v12a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2zm0 4h3v3H5V8zm5 0h4v3h-4V8zm9 0v3h-4V8h4zm-9 5h4v3h-4v-3zm9 0v3h-4v-3h4zM5 13h3v3H5v-3z"/></svg>
|
|
2685
|
+
}
|
|
2686
|
+
@case ('web') {
|
|
2687
|
+
<svg viewBox="0 0 24 24" class="svg-icon purple"><path d="M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm-1 17.93c-3.95-.49-7-3.85-7-7.93 0-.62.08-1.21.21-1.79L9 15v1c0 1.1.9 2 2 2v1.93zm6.9-2.53c-.26-.81-1-1.4-1.9-1.4h-1v-3c0-.55-.45-1-1-1h-6v-2h2c.55 0 1-.45 1-1V7h2c1.1 0 2-.9 2-2v-.41c2.93 1.19 5 4.06 5 7.41 0 2.08-.8 3.97-2.1 5.39z"/></svg>
|
|
2688
|
+
}
|
|
2689
|
+
@default {
|
|
2690
|
+
<svg viewBox="0 0 24 24" class="svg-icon gray"><path d="M14 2H6c-1.1 0-1.99.9-1.99 2L4 20c0 1.1.89 2 1.99 2H18c1.1 0 2-.9 2-2V8l-6-6zm2 16H8v-2h8v2zm0-4H8v-2h8v2zm-3-5V3.5L18.5 9H13z"/></svg>
|
|
2691
|
+
}
|
|
2692
|
+
}
|
|
2693
|
+
</div>
|
|
2694
|
+
|
|
2695
|
+
<div class="meta-info">
|
|
2696
|
+
<span class="source-title">{{ src.title }}</span>
|
|
2697
|
+
<div class="badge-row">
|
|
2698
|
+
<span class="meta-badge" *ngIf="src.metadata?.pageNumber">Page {{ src.metadata?.pageNumber }}</span>
|
|
2699
|
+
<span class="meta-badge" *ngIf="src.metadata?.chunkIndex">Chunk #{{ src.metadata?.chunkIndex }}</span>
|
|
2700
|
+
</div>
|
|
2701
|
+
</div>
|
|
2702
|
+
|
|
2703
|
+
<!-- Similarity Bar -->
|
|
2704
|
+
<div class="similarity-score-wrap" (click)="$event.stopPropagation()">
|
|
2705
|
+
<div class="score-label">
|
|
2706
|
+
<span>Match</span>
|
|
2707
|
+
<strong>{{ (src.score * 100).toFixed(0) }}%</strong>
|
|
2708
|
+
</div>
|
|
2709
|
+
<div class="score-bar-track">
|
|
2710
|
+
<div
|
|
2711
|
+
class="score-bar-fill"
|
|
2712
|
+
[style.width.%]="src.score * 100"
|
|
2713
|
+
[class.high]="src.score >= 0.8"
|
|
2714
|
+
[class.medium]="src.score >= 0.5 && src.score < 0.8"
|
|
2715
|
+
[class.low]="src.score < 0.5"
|
|
2716
|
+
></div>
|
|
2717
|
+
</div>
|
|
2718
|
+
</div>
|
|
2719
|
+
|
|
2720
|
+
<!-- Expand Arrow -->
|
|
2721
|
+
<div class="expand-indicator">
|
|
2722
|
+
<svg viewBox="0 0 24 24" class="arrow-icon"><path d="M7 10l5 5 5-5z"/></svg>
|
|
2723
|
+
</div>
|
|
2724
|
+
</div>
|
|
2725
|
+
|
|
2726
|
+
<!-- Expanded Content Area -->
|
|
2727
|
+
<div class="card-details" (click)="$event.stopPropagation()">
|
|
2728
|
+
<div class="snippet-content">
|
|
2729
|
+
<pre class="snippet-text" [innerHTML]="highlightText(src.snippet)"></pre>
|
|
2730
|
+
</div>
|
|
2731
|
+
|
|
2732
|
+
<div class="footer-actions">
|
|
2733
|
+
<!-- Path metadata -->
|
|
2734
|
+
<div class="file-path" *ngIf="src.metadata?.filePath" [title]="src.metadata?.filePath">
|
|
2735
|
+
<span>Path: </span><code>{{ src.metadata?.filePath }}</code>
|
|
2736
|
+
</div>
|
|
2737
|
+
|
|
2738
|
+
<!-- Helpful feedback controls -->
|
|
2739
|
+
<div class="feedback-controls">
|
|
2740
|
+
<span class="feedback-label">Helpful citation?</span>
|
|
2741
|
+
<button
|
|
2742
|
+
class="feedback-btn thumbs-up"
|
|
2743
|
+
[class.selected]="feedbackMap[src.id] === 'up'"
|
|
2744
|
+
(click)="submitFeedback(src, 'up')"
|
|
2745
|
+
title="Yes, helpful"
|
|
2746
|
+
>
|
|
2747
|
+
👍
|
|
2748
|
+
</button>
|
|
2749
|
+
<button
|
|
2750
|
+
class="feedback-btn thumbs-down"
|
|
2751
|
+
[class.selected]="feedbackMap[src.id] === 'down'"
|
|
2752
|
+
(click)="submitFeedback(src, 'down')"
|
|
2753
|
+
title="No, unhelpful"
|
|
2754
|
+
>
|
|
2755
|
+
👎
|
|
2756
|
+
</button>
|
|
2757
|
+
</div>
|
|
2758
|
+
</div>
|
|
2759
|
+
</div>
|
|
2760
|
+
</div>
|
|
2761
|
+
}
|
|
2762
|
+
</div>
|
|
2763
|
+
}
|
|
2764
|
+
</div>
|
|
2765
|
+
</div>
|
|
2766
|
+
`, styles: [":host{display:block;width:100%}.rag-inspector{background:var(--bg-secondary, #ffffff);border:1px solid var(--border-color, #e2e8f0);border-radius:var(--radius-md, 12px);box-shadow:var(--shadow-md, 0 4px 6px -1px rgba(0, 0, 0, .08));display:flex;flex-direction:column;overflow:hidden;font-family:var(--ngx-font-family, system-ui, -apple-system, sans-serif);transition:all .3s ease}.inspector-header{padding:16px 20px;border-bottom:1px solid var(--border-color, #e2e8f0);background:var(--border-light, #f8fafc);display:flex;justify-content:space-between;align-items:center;gap:16px;flex-wrap:wrap}.header-main{display:flex;align-items:center;gap:8px}.sparkle-icon{font-size:16px}.title{margin:0;font-size:15px;font-weight:750;color:var(--text-primary, #0f172a)}.badge{font-size:10px;font-weight:700;background:var(--primary-glow, rgba(79, 70, 229, .15));color:var(--primary-color, #4f46e5);padding:2px 8px;border-radius:9999px}.search-box{min-width:200px;flex:1;max-width:300px}.search-input{width:100%;border:1px solid var(--border-color, #cbd5e1);border-radius:6px;padding:6px 12px;font-size:12px;outline:none;background:var(--bg-primary, #ffffff);color:var(--text-primary, #0f172a);transition:border-color .15s}.search-input:focus{border-color:var(--primary-color, #4f46e5)}.sources-container{padding:16px;overflow-y:auto;max-height:450px;background:var(--bg-primary, #ffffff)}.sources-list{display:flex;flex-direction:column;gap:12px}.source-card{border:1px solid var(--border-color, #e2e8f0);border-radius:8px;background:var(--bg-secondary, #ffffff);overflow:hidden;cursor:pointer;transition:all .2s cubic-bezier(.4,0,.2,1)}.source-card:hover{box-shadow:0 4px 12px #0000000a;border-color:var(--border-color-hover, #cbd5e1);transform:translateY(-1px)}.source-card.expanded{border-color:var(--primary-color, #4f46e5);box-shadow:0 4px 16px var(--primary-glow, rgba(79, 70, 229, .1))}.source-card.has-feedback{background:#f8fafc80}.card-summary{padding:12px 16px;display:flex;align-items:center;gap:16px;flex-wrap:wrap}.source-type-icon{width:32px;height:32px;border-radius:8px;background:var(--border-light, #f1f5f9);display:flex;align-items:center;justify-content:center;flex-shrink:0}.svg-icon{width:20px;height:20px}.svg-icon.red{fill:#ef4444}.svg-icon.blue{fill:#3b82f6}.svg-icon.green{fill:#10b981}.svg-icon.purple{fill:#8b5cf6}.svg-icon.slate{fill:#64748b}.svg-icon.gray{fill:#94a3b8}.meta-info{flex:1;display:flex;flex-direction:column;gap:4px;min-width:150px}.source-title{font-size:13.5px;font-weight:650;color:var(--text-primary, #1e293b);word-break:break-all}.badge-row{display:flex;gap:6px;flex-wrap:wrap}.meta-badge{font-size:10px;background:var(--border-light, #f1f5f9);color:var(--text-secondary, #64748b);padding:1px 6px;border-radius:4px;font-weight:600}.similarity-score-wrap{display:flex;flex-direction:column;gap:4px;width:110px;flex-shrink:0}.score-label{display:flex;justify-content:space-between;font-size:10px;color:var(--text-secondary, #64748b);font-weight:600}.score-bar-track{height:6px;background:var(--border-color, #e2e8f0);border-radius:3px;overflow:hidden}.score-bar-fill{height:100%;border-radius:3px}.score-bar-fill.high{background:#10b981}.score-bar-fill.medium{background:#f59e0b}.score-bar-fill.low{background:#ef4444}.expand-indicator{display:flex;align-items:center;justify-content:center;color:var(--text-muted, #94a3b8);transition:transform .2s ease;flex-shrink:0}.arrow-icon{width:20px;height:20px;fill:currentColor}.source-card.expanded .expand-indicator{transform:rotate(180deg);color:var(--primary-color, #4f46e5)}.card-details{max-height:0;overflow:hidden;transition:max-height .25s cubic-bezier(0,1,0,1);border-top:1px solid transparent;background:#00000003}.source-card.expanded .card-details{max-height:1000px;border-top-color:var(--border-color, #e2e8f0);transition:max-height .3s ease-in}.snippet-content{padding:16px 20px}.snippet-text{margin:0;white-space:pre-wrap;font-family:inherit;font-size:12.5px;line-height:1.6;color:var(--text-primary, #334155)}::ng-deep .highlight-mark{background:#fef08a;color:#854d0e;padding:1px 3px;border-radius:3px;font-weight:600}.footer-actions{padding:12px 20px 16px;display:flex;justify-content:space-between;align-items:center;gap:12px;flex-wrap:wrap;border-top:1px dashed var(--border-color, #e2e8f0);font-size:11px}.file-path{color:var(--text-secondary, #64748b);text-overflow:ellipsis;overflow:hidden;white-space:nowrap;max-width:60%}.file-path code{background:var(--border-light, #f1f5f9);padding:2px 6px;border-radius:4px;font-family:monospace}.feedback-controls{display:flex;align-items:center;gap:8px}.feedback-label{color:var(--text-secondary, #64748b);font-weight:600}.feedback-btn{background:var(--bg-secondary, #ffffff);border:1px solid var(--border-color, #e2e8f0);border-radius:6px;width:28px;height:28px;display:flex;align-items:center;justify-content:center;cursor:pointer;font-size:11px;transition:all .2s}.feedback-btn:hover{border-color:var(--text-secondary, #94a3b8);background:var(--border-light, #f8fafc)}.feedback-btn.selected{border-color:var(--primary-color, #4f46e5);background:var(--primary-glow, rgba(79, 70, 229, .08));transform:scale(1.1)}.empty-state{padding:40px 20px;text-align:center;display:flex;flex-direction:column;align-items:center;justify-content:center}.empty-icon{font-size:32px;margin-bottom:8px;opacity:.6}.empty-text{color:var(--text-secondary, #64748b);font-style:italic;font-size:12px;margin:0}.rag-inspector.dark{background:#0f172a;border-color:#1f2937;box-shadow:0 4px 6px -1px #0006}.rag-inspector.dark .inspector-header{background:#1e293b;border-bottom-color:#1f2937}.rag-inspector.dark .title{color:#f8fafc}.rag-inspector.dark .search-input{border-color:#374151;background:#0b0f19;color:#f8fafc}.rag-inspector.dark .search-input:focus{border-color:var(--primary-color, #6366f1)}.rag-inspector.dark .sources-container{background:#0f172a}.rag-inspector.dark .source-card{border-color:#1f2937;background:#1e293b}.rag-inspector.dark .source-card:hover{border-color:#374151;box-shadow:0 4px 12px #00000040}.rag-inspector.dark .source-card.expanded{border-color:var(--primary-color, #6366f1);box-shadow:0 4px 16px #6366f126}.rag-inspector.dark .source-card.has-feedback{background:#0f172a80}.rag-inspector.dark .source-type-icon{background:#0f172a}.rag-inspector.dark .source-title{color:#f8fafc}.rag-inspector.dark .meta-badge{background:#0f172a;color:#94a3b8}.rag-inspector.dark .score-bar-track{background:#1f2937}.rag-inspector.dark .snippet-text{color:#cbd5e1}.rag-inspector.dark ::ng-deep .highlight-mark{background:#854d0e;color:#fef08a}.rag-inspector.dark .footer-actions{border-top-color:#1f2937}.rag-inspector.dark .file-path{color:#94a3b8}.rag-inspector.dark .file-path code{background:#0f172a;color:#cbd5e1}.rag-inspector.dark .feedback-btn{background:#1e293b;border-color:#374151}.rag-inspector.dark .feedback-btn:hover{background:#1f2937;border-color:#4b5563}.rag-inspector.dark .feedback-btn.selected{border-color:var(--primary-color, #6366f1);background:#6366f126}\n"] }]
|
|
2767
|
+
}] });
|
|
2768
|
+
|
|
1907
2769
|
/**
|
|
1908
2770
|
* Generated bundle index. Do not edit.
|
|
1909
2771
|
*/
|
|
1910
2772
|
|
|
1911
|
-
export { AIAudioWaveComponent, AIChatComponent, AIChatWidgetComponent, AICodeEditorComponent, AIModelCompareComponent, AIPromptEditorComponent };
|
|
2773
|
+
export { AIAudioWaveComponent, AIChatComponent, AIChatWidgetComponent, AICodeEditorComponent, AIModelCompareComponent, AIPromptEditorComponent, AIRagInspectorComponent };
|
|
1912
2774
|
//# sourceMappingURL=ngx-core-components-ai.mjs.map
|