ngx-core-components 0.3.21 → 0.3.23
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-chat/ai-chat.component.d.ts +2 -1
- package/ai/ngx-web-llm.service.d.ts +22 -0
- package/ai/public-api.d.ts +2 -0
- package/charts/gantt-chart/gantt-chart.component.d.ts +4 -1
- package/charts/line-chart/line-chart.component.d.ts +19 -1
- package/fesm2022/ngx-core-components-ai.mjs +173 -9
- package/fesm2022/ngx-core-components-ai.mjs.map +1 -1
- package/fesm2022/ngx-core-components-charts.mjs +119 -12
- package/fesm2022/ngx-core-components-charts.mjs.map +1 -1
- package/fesm2022/ngx-core-components-grid.mjs +119 -38
- package/fesm2022/ngx-core-components-grid.mjs.map +1 -1
- package/fesm2022/ngx-core-components-inputs.mjs +714 -3
- package/fesm2022/ngx-core-components-inputs.mjs.map +1 -1
- package/fesm2022/ngx-core-components-navigation.mjs +19 -13
- package/fesm2022/ngx-core-components-navigation.mjs.map +1 -1
- package/fesm2022/ngx-core-components.mjs +2 -2
- package/fesm2022/ngx-core-components.mjs.map +1 -1
- package/grid/data-grid/data-grid.component.d.ts +40 -1
- package/inputs/form-builder/form-builder.component.d.ts +20 -0
- package/inputs/form-builder/form-designer.component.d.ts +42 -0
- package/inputs/public-api.d.ts +1 -0
- package/package.json +5 -5
- package/public-api.d.ts +3 -1
- package/themes/theme.css +22 -0
|
@@ -9,6 +9,7 @@ export declare class AIChatComponent {
|
|
|
9
9
|
agentAvatarUrl: import("@angular/core").InputSignal<string>;
|
|
10
10
|
isOnline: import("@angular/core").InputSignal<boolean>;
|
|
11
11
|
isTyping: import("@angular/core").InputSignal<boolean>;
|
|
12
|
+
isStreaming: import("@angular/core").InputSignal<boolean>;
|
|
12
13
|
showSenderNames: import("@angular/core").InputSignal<boolean>;
|
|
13
14
|
theme: import("@angular/core").InputSignal<"light" | "dark">;
|
|
14
15
|
placeholder: import("@angular/core").InputSignal<string>;
|
|
@@ -60,5 +61,5 @@ export declare class AIChatComponent {
|
|
|
60
61
|
scrollToBottom(): void;
|
|
61
62
|
formatMessage(content: string): SafeHtml;
|
|
62
63
|
static ɵfac: i0.ɵɵFactoryDeclaration<AIChatComponent, never>;
|
|
63
|
-
static ɵcmp: i0.ɵɵComponentDeclaration<AIChatComponent, "ngx-ai-chat", never, { "messages": { "alias": "messages"; "required": false; "isSignal": true; }; "agentName": { "alias": "agentName"; "required": false; "isSignal": true; }; "agentAvatarUrl": { "alias": "agentAvatarUrl"; "required": false; "isSignal": true; }; "isOnline": { "alias": "isOnline"; "required": false; "isSignal": true; }; "isTyping": { "alias": "isTyping"; "required": false; "isSignal": true; }; "showSenderNames": { "alias": "showSenderNames"; "required": false; "isSignal": true; }; "theme": { "alias": "theme"; "required": false; "isSignal": true; }; "placeholder": { "alias": "placeholder"; "required": false; "isSignal": true; }; "disabled": { "alias": "disabled"; "required": false; "isSignal": true; }; "quickReplies": { "alias": "quickReplies"; "required": false; "isSignal": true; }; "avatarBg": { "alias": "avatarBg"; "required": false; "isSignal": true; }; }, { "sendMessage": "sendMessage"; "quickReplyClick": "quickReplyClick"; "cardActionClick": "cardActionClick"; "clearHistory": "clearHistory"; "messageFeedback": "messageFeedback"; "fileAttached": "fileAttached"; "messageSent": "messageSent"; }, never, never, true, never>;
|
|
64
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<AIChatComponent, "ngx-ai-chat", never, { "messages": { "alias": "messages"; "required": false; "isSignal": true; }; "agentName": { "alias": "agentName"; "required": false; "isSignal": true; }; "agentAvatarUrl": { "alias": "agentAvatarUrl"; "required": false; "isSignal": true; }; "isOnline": { "alias": "isOnline"; "required": false; "isSignal": true; }; "isTyping": { "alias": "isTyping"; "required": false; "isSignal": true; }; "isStreaming": { "alias": "isStreaming"; "required": false; "isSignal": true; }; "showSenderNames": { "alias": "showSenderNames"; "required": false; "isSignal": true; }; "theme": { "alias": "theme"; "required": false; "isSignal": true; }; "placeholder": { "alias": "placeholder"; "required": false; "isSignal": true; }; "disabled": { "alias": "disabled"; "required": false; "isSignal": true; }; "quickReplies": { "alias": "quickReplies"; "required": false; "isSignal": true; }; "avatarBg": { "alias": "avatarBg"; "required": false; "isSignal": true; }; }, { "sendMessage": "sendMessage"; "quickReplyClick": "quickReplyClick"; "cardActionClick": "cardActionClick"; "clearHistory": "clearHistory"; "messageFeedback": "messageFeedback"; "fileAttached": "fileAttached"; "messageSent": "messageSent"; }, never, never, true, never>;
|
|
64
65
|
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import * as i0 from "@angular/core";
|
|
2
|
+
export interface WebLlmMessage {
|
|
3
|
+
role: 'user' | 'assistant' | 'system';
|
|
4
|
+
content: string;
|
|
5
|
+
}
|
|
6
|
+
export declare class NgxWebLlmService {
|
|
7
|
+
private engine;
|
|
8
|
+
status: import("@angular/core").WritableSignal<string>;
|
|
9
|
+
progress: import("@angular/core").WritableSignal<number>;
|
|
10
|
+
isReady: import("@angular/core").WritableSignal<boolean>;
|
|
11
|
+
error: import("@angular/core").WritableSignal<string | null>;
|
|
12
|
+
isGpuSupported(): boolean;
|
|
13
|
+
init(modelId?: string, onProgress?: (val: number, msg: string) => void): Promise<void>;
|
|
14
|
+
private simulateLoading;
|
|
15
|
+
generate(messages: WebLlmMessage[], onToken?: (text: string) => void, options?: {
|
|
16
|
+
max_tokens?: number;
|
|
17
|
+
temperature?: number;
|
|
18
|
+
}): Promise<string>;
|
|
19
|
+
reset(): void;
|
|
20
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<NgxWebLlmService, never>;
|
|
21
|
+
static ɵprov: i0.ɵɵInjectableDeclaration<NgxWebLlmService>;
|
|
22
|
+
}
|
package/ai/public-api.d.ts
CHANGED
|
@@ -9,3 +9,5 @@ export { AIModelCompareComponent } from './ai-model-compare/ai-model-compare.com
|
|
|
9
9
|
export type { AIModel } from './ai-model-compare/ai-model-compare.component';
|
|
10
10
|
export { AIRagInspectorComponent } from './ai-rag-inspector/ai-rag-inspector.component';
|
|
11
11
|
export type { RAGSource } from './ai-rag-inspector/models';
|
|
12
|
+
export { NgxWebLlmService } from './ngx-web-llm.service';
|
|
13
|
+
export type { WebLlmMessage } from './ngx-web-llm.service';
|
|
@@ -72,7 +72,10 @@ export declare class GanttChartComponent {
|
|
|
72
72
|
} | null>;
|
|
73
73
|
private linkDragSource;
|
|
74
74
|
private tableDragSourceRow;
|
|
75
|
-
|
|
75
|
+
virtualRange: import("@angular/core").WritableSignal<{
|
|
76
|
+
start: number;
|
|
77
|
+
end: number;
|
|
78
|
+
}>;
|
|
76
79
|
isAreaZoomMode: import("@angular/core").WritableSignal<boolean>;
|
|
77
80
|
zoomStart: import("@angular/core").WritableSignal<Date | null>;
|
|
78
81
|
zoomEnd: import("@angular/core").WritableSignal<Date | null>;
|
|
@@ -24,6 +24,8 @@ export declare class LineChartComponent {
|
|
|
24
24
|
}[]>;
|
|
25
25
|
labelFormatter: import("@angular/core").InputSignal<((v: number) => string) | undefined>;
|
|
26
26
|
tooltipTemplate: import("@angular/core").InputSignal<TemplateRef<any> | null>;
|
|
27
|
+
zoomEnabled: import("@angular/core").InputSignal<boolean>;
|
|
28
|
+
panEnabled: import("@angular/core").InputSignal<boolean>;
|
|
27
29
|
pointClick: import("@angular/core").OutputEmitterRef<{
|
|
28
30
|
category: string;
|
|
29
31
|
value: number;
|
|
@@ -33,6 +35,11 @@ export declare class LineChartComponent {
|
|
|
33
35
|
exportMenuOpen: import("@angular/core").WritableSignal<boolean>;
|
|
34
36
|
animateState: import("@angular/core").WritableSignal<boolean>;
|
|
35
37
|
containerWidth: import("@angular/core").WritableSignal<number>;
|
|
38
|
+
zoomScale: import("@angular/core").WritableSignal<number>;
|
|
39
|
+
panOffset: import("@angular/core").WritableSignal<{
|
|
40
|
+
x: number;
|
|
41
|
+
y: number;
|
|
42
|
+
}>;
|
|
36
43
|
crosshair: import("@angular/core").WritableSignal<{
|
|
37
44
|
x: number;
|
|
38
45
|
} | null>;
|
|
@@ -61,6 +68,17 @@ export declare class LineChartComponent {
|
|
|
61
68
|
linePath(s: ChartSeries): string;
|
|
62
69
|
areaPath(s: ChartSeries): string;
|
|
63
70
|
onMouseMove(event: MouseEvent): void;
|
|
71
|
+
isPanning: boolean;
|
|
72
|
+
panStart: {
|
|
73
|
+
x: number;
|
|
74
|
+
y: number;
|
|
75
|
+
};
|
|
76
|
+
onWheel(event: WheelEvent): void;
|
|
77
|
+
onMouseDown(event: MouseEvent): void;
|
|
78
|
+
onSvgMouseMove(event: MouseEvent): void;
|
|
79
|
+
onMouseUp(): void;
|
|
80
|
+
onMouseLeaveChart(): void;
|
|
81
|
+
resetZoom(): void;
|
|
64
82
|
onPointClick(ci: number, si: number, v: number): void;
|
|
65
83
|
onMouseLeave(): void;
|
|
66
84
|
toggleExportMenu(event: MouseEvent): void;
|
|
@@ -71,5 +89,5 @@ export declare class LineChartComponent {
|
|
|
71
89
|
exportToSvg(): void;
|
|
72
90
|
readonly fmtNum: typeof fmtNum;
|
|
73
91
|
static ɵfac: i0.ɵɵFactoryDeclaration<LineChartComponent, never>;
|
|
74
|
-
static ɵcmp: i0.ɵɵComponentDeclaration<LineChartComponent, "ngx-line-chart", never, { "series": { "alias": "series"; "required": false; "isSignal": true; }; "categories": { "alias": "categories"; "required": false; "isSignal": true; }; "height": { "alias": "height"; "required": false; "isSignal": true; }; "showGrid": { "alias": "showGrid"; "required": false; "isSignal": true; }; "showArea": { "alias": "showArea"; "required": false; "isSignal": true; }; "showMarkers": { "alias": "showMarkers"; "required": false; "isSignal": true; }; "showLegend": { "alias": "showLegend"; "required": false; "isSignal": true; }; "colors": { "alias": "colors"; "required": false; "isSignal": true; }; "showExport": { "alias": "showExport"; "required": false; "isSignal": true; }; "showLabels": { "alias": "showLabels"; "required": false; "isSignal": true; }; "referenceLines": { "alias": "referenceLines"; "required": false; "isSignal": true; }; "labelFormatter": { "alias": "labelFormatter"; "required": false; "isSignal": true; }; "tooltipTemplate": { "alias": "tooltipTemplate"; "required": false; "isSignal": true; }; }, { "pointClick": "pointClick"; }, never, never, true, never>;
|
|
92
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<LineChartComponent, "ngx-line-chart", never, { "series": { "alias": "series"; "required": false; "isSignal": true; }; "categories": { "alias": "categories"; "required": false; "isSignal": true; }; "height": { "alias": "height"; "required": false; "isSignal": true; }; "showGrid": { "alias": "showGrid"; "required": false; "isSignal": true; }; "showArea": { "alias": "showArea"; "required": false; "isSignal": true; }; "showMarkers": { "alias": "showMarkers"; "required": false; "isSignal": true; }; "showLegend": { "alias": "showLegend"; "required": false; "isSignal": true; }; "colors": { "alias": "colors"; "required": false; "isSignal": true; }; "showExport": { "alias": "showExport"; "required": false; "isSignal": true; }; "showLabels": { "alias": "showLabels"; "required": false; "isSignal": true; }; "referenceLines": { "alias": "referenceLines"; "required": false; "isSignal": true; }; "labelFormatter": { "alias": "labelFormatter"; "required": false; "isSignal": true; }; "tooltipTemplate": { "alias": "tooltipTemplate"; "required": false; "isSignal": true; }; "zoomEnabled": { "alias": "zoomEnabled"; "required": false; "isSignal": true; }; "panEnabled": { "alias": "panEnabled"; "required": false; "isSignal": true; }; }, { "pointClick": "pointClick"; }, never, never, true, never>;
|
|
75
93
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as i0 from '@angular/core';
|
|
2
|
-
import { inject, input, output, viewChild, signal, effect, HostListener, Component, ViewChild, computed } from '@angular/core';
|
|
2
|
+
import { inject, input, output, viewChild, signal, effect, HostListener, Component, ViewChild, computed, Injectable } 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';
|
|
@@ -13,6 +13,7 @@ class AIChatComponent {
|
|
|
13
13
|
agentAvatarUrl = input('');
|
|
14
14
|
isOnline = input(true);
|
|
15
15
|
isTyping = input(false);
|
|
16
|
+
isStreaming = input(false);
|
|
16
17
|
showSenderNames = input(false);
|
|
17
18
|
theme = input('light');
|
|
18
19
|
placeholder = input('Type a message...');
|
|
@@ -137,6 +138,21 @@ class AIChatComponent {
|
|
|
137
138
|
.replace(/&/g, '&')
|
|
138
139
|
.replace(/</g, '<')
|
|
139
140
|
.replace(/>/g, '>');
|
|
141
|
+
// Handle unclosed triple backticks (code blocks) during streaming
|
|
142
|
+
const codeBlockCount = (formatted.match(/```/g) || []).length;
|
|
143
|
+
if (codeBlockCount % 2 !== 0) {
|
|
144
|
+
formatted += '\n```';
|
|
145
|
+
}
|
|
146
|
+
// Handle unclosed bold markers during streaming
|
|
147
|
+
const boldCount = (formatted.match(/\*\*/g) || []).length;
|
|
148
|
+
if (boldCount % 2 !== 0) {
|
|
149
|
+
formatted += '**';
|
|
150
|
+
}
|
|
151
|
+
// Handle unclosed inline code backticks during streaming
|
|
152
|
+
const inlineCodeCount = (formatted.match(/`/g) || []).length;
|
|
153
|
+
if (inlineCodeCount % 2 !== 0) {
|
|
154
|
+
formatted += '`';
|
|
155
|
+
}
|
|
140
156
|
// Bold markdown helper
|
|
141
157
|
formatted = formatted.replace(/\*\*(.*?)\*\*/g, '<strong>$1</strong>');
|
|
142
158
|
// Code blocks helper
|
|
@@ -159,7 +175,7 @@ class AIChatComponent {
|
|
|
159
175
|
return this.sanitizer.bypassSecurityTrustHtml(formatted);
|
|
160
176
|
}
|
|
161
177
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.20", ngImport: i0, type: AIChatComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
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: `
|
|
178
|
+
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 }, isStreaming: { classPropertyName: "isStreaming", publicName: "isStreaming", 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: `
|
|
163
179
|
<div class="ngx-ai-chat-container" [class.dark-mode]="theme() === 'dark'">
|
|
164
180
|
<!-- Chat Header -->
|
|
165
181
|
<div class="ngx-ai-chat-header">
|
|
@@ -185,7 +201,7 @@ class AIChatComponent {
|
|
|
185
201
|
<!-- Messages Thread -->
|
|
186
202
|
<div class="ngx-ai-chat-body" #chatBody>
|
|
187
203
|
<div class="messages-list">
|
|
188
|
-
@for (msg of messages(); track msg.id) {
|
|
204
|
+
@for (msg of messages(); track msg.id; let isLast = $last) {
|
|
189
205
|
<div class="message-wrapper" [class.user-msg]="msg.role === 'user'" [class.assistant-msg]="msg.role === 'assistant'">
|
|
190
206
|
<!-- Avatar -->
|
|
191
207
|
@if (msg.role !== 'user') {
|
|
@@ -207,7 +223,12 @@ class AIChatComponent {
|
|
|
207
223
|
|
|
208
224
|
<div class="msg-bubble">
|
|
209
225
|
<!-- Text Content -->
|
|
210
|
-
<div class="msg-text"
|
|
226
|
+
<div class="msg-text">
|
|
227
|
+
<span [innerHTML]="formatMessage(msg.content)"></span>
|
|
228
|
+
@if (isStreaming() && isLast && msg.role === 'assistant') {
|
|
229
|
+
<span class="streaming-cursor"></span>
|
|
230
|
+
}
|
|
231
|
+
</div>
|
|
211
232
|
|
|
212
233
|
<!-- Agent Steps (Accordion) -->
|
|
213
234
|
@if (msg.steps && msg.steps.length > 0) {
|
|
@@ -402,7 +423,7 @@ class AIChatComponent {
|
|
|
402
423
|
</form>
|
|
403
424
|
</div>
|
|
404
425
|
</div>
|
|
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"] }] });
|
|
426
|
+
`, 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)}}.streaming-cursor{display:inline-block;width:6px;height:14px;background-color:var(--ngx-ai-chat-primary, #3b82f6);margin-left:4px;animation:blink-cursor 1s step-end infinite;vertical-align:middle}@keyframes blink-cursor{0%,to{background-color:transparent}50%{background-color:var(--ngx-ai-chat-primary, #3b82f6)}}.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"] }] });
|
|
406
427
|
}
|
|
407
428
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.20", ngImport: i0, type: AIChatComponent, decorators: [{
|
|
408
429
|
type: Component,
|
|
@@ -432,7 +453,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.20", ngImpo
|
|
|
432
453
|
<!-- Messages Thread -->
|
|
433
454
|
<div class="ngx-ai-chat-body" #chatBody>
|
|
434
455
|
<div class="messages-list">
|
|
435
|
-
@for (msg of messages(); track msg.id) {
|
|
456
|
+
@for (msg of messages(); track msg.id; let isLast = $last) {
|
|
436
457
|
<div class="message-wrapper" [class.user-msg]="msg.role === 'user'" [class.assistant-msg]="msg.role === 'assistant'">
|
|
437
458
|
<!-- Avatar -->
|
|
438
459
|
@if (msg.role !== 'user') {
|
|
@@ -454,7 +475,12 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.20", ngImpo
|
|
|
454
475
|
|
|
455
476
|
<div class="msg-bubble">
|
|
456
477
|
<!-- Text Content -->
|
|
457
|
-
<div class="msg-text"
|
|
478
|
+
<div class="msg-text">
|
|
479
|
+
<span [innerHTML]="formatMessage(msg.content)"></span>
|
|
480
|
+
@if (isStreaming() && isLast && msg.role === 'assistant') {
|
|
481
|
+
<span class="streaming-cursor"></span>
|
|
482
|
+
}
|
|
483
|
+
</div>
|
|
458
484
|
|
|
459
485
|
<!-- Agent Steps (Accordion) -->
|
|
460
486
|
@if (msg.steps && msg.steps.length > 0) {
|
|
@@ -649,7 +675,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.20", ngImpo
|
|
|
649
675
|
</form>
|
|
650
676
|
</div>
|
|
651
677
|
</div>
|
|
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"] }]
|
|
678
|
+
`, 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)}}.streaming-cursor{display:inline-block;width:6px;height:14px;background-color:var(--ngx-ai-chat-primary, #3b82f6);margin-left:4px;animation:blink-cursor 1s step-end infinite;vertical-align:middle}@keyframes blink-cursor{0%,to{background-color:transparent}50%{background-color:var(--ngx-ai-chat-primary, #3b82f6)}}.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
679
|
}], ctorParameters: () => [], propDecorators: { onHostClick: [{
|
|
654
680
|
type: HostListener,
|
|
655
681
|
args: ['click', ['$event']]
|
|
@@ -2766,9 +2792,147 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.20", ngImpo
|
|
|
2766
2792
|
`, 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
2793
|
}] });
|
|
2768
2794
|
|
|
2795
|
+
class NgxWebLlmService {
|
|
2796
|
+
engine = null;
|
|
2797
|
+
status = signal('idle');
|
|
2798
|
+
progress = signal(0);
|
|
2799
|
+
isReady = signal(false);
|
|
2800
|
+
error = signal(null);
|
|
2801
|
+
isGpuSupported() {
|
|
2802
|
+
return typeof navigator !== 'undefined' && 'gpu' in navigator && !!navigator.gpu;
|
|
2803
|
+
}
|
|
2804
|
+
async init(modelId = 'Qwen2.5-0.5B-Instruct', onProgress) {
|
|
2805
|
+
if (this.isReady())
|
|
2806
|
+
return;
|
|
2807
|
+
this.status.set('loading_scripts');
|
|
2808
|
+
this.error.set(null);
|
|
2809
|
+
// If GPU is not supported, simulate model loading (useful for testing or fallback dev setups)
|
|
2810
|
+
if (!this.isGpuSupported()) {
|
|
2811
|
+
console.warn('WebGPU is not supported in this browser environment. Simulating fallback WebLLM Engine.');
|
|
2812
|
+
await this.simulateLoading(onProgress);
|
|
2813
|
+
return;
|
|
2814
|
+
}
|
|
2815
|
+
try {
|
|
2816
|
+
// Dynamic import of web-llm from CDN. Using type casting to bypass TS compilation lookup checks
|
|
2817
|
+
const webLlmModule = await import('https://cdn.jsdelivr.net/npm/@mlc-ai/web-llm@0.2.46/+esm');
|
|
2818
|
+
this.status.set('downloading_model');
|
|
2819
|
+
this.progress.set(0);
|
|
2820
|
+
const engine = await webLlmModule.CreateWebGPUEngine(modelId, {
|
|
2821
|
+
initProgressCallback: (report) => {
|
|
2822
|
+
const val = report.progress;
|
|
2823
|
+
this.progress.set(Math.round(val * 100));
|
|
2824
|
+
this.status.set(`loading_model: ${report.text}`);
|
|
2825
|
+
if (onProgress) {
|
|
2826
|
+
onProgress(val, report.text);
|
|
2827
|
+
}
|
|
2828
|
+
}
|
|
2829
|
+
});
|
|
2830
|
+
this.engine = engine;
|
|
2831
|
+
this.isReady.set(true);
|
|
2832
|
+
this.status.set('ready');
|
|
2833
|
+
}
|
|
2834
|
+
catch (err) {
|
|
2835
|
+
const errMsg = err.message || String(err);
|
|
2836
|
+
this.status.set('error');
|
|
2837
|
+
this.error.set(errMsg);
|
|
2838
|
+
throw new Error(`WebLLM Initialization failed: ${errMsg}`);
|
|
2839
|
+
}
|
|
2840
|
+
}
|
|
2841
|
+
async simulateLoading(onProgress) {
|
|
2842
|
+
const steps = [
|
|
2843
|
+
{ progress: 0.1, text: 'Fetching model config...' },
|
|
2844
|
+
{ progress: 0.3, text: 'Loading WebGPU device adapter...' },
|
|
2845
|
+
{ progress: 0.6, text: 'Downloading model weights (simulated)...' },
|
|
2846
|
+
{ progress: 0.9, text: 'Warming up runtime execution pipeline...' },
|
|
2847
|
+
{ progress: 1.0, text: 'Finished warming up' }
|
|
2848
|
+
];
|
|
2849
|
+
for (const step of steps) {
|
|
2850
|
+
await new Promise(resolve => setTimeout(resolve, 100));
|
|
2851
|
+
this.progress.set(Math.round(step.progress * 100));
|
|
2852
|
+
this.status.set(`loading_model: ${step.text}`);
|
|
2853
|
+
if (onProgress) {
|
|
2854
|
+
onProgress(step.progress, step.text);
|
|
2855
|
+
}
|
|
2856
|
+
}
|
|
2857
|
+
this.engine = {
|
|
2858
|
+
chat: {
|
|
2859
|
+
completions: {
|
|
2860
|
+
create: async (params) => {
|
|
2861
|
+
// Return an async iterable stream simulator
|
|
2862
|
+
const responseText = `[Simulated WebLLM response to: "${params.messages[params.messages.length - 1]?.content}"] This is a locally generated streaming response using simulated model weights, as WebGPU is not supported on this device.`;
|
|
2863
|
+
const tokens = responseText.split(' ');
|
|
2864
|
+
return (async function* () {
|
|
2865
|
+
for (const token of tokens) {
|
|
2866
|
+
await new Promise(resolve => setTimeout(resolve, 40));
|
|
2867
|
+
yield {
|
|
2868
|
+
choices: [
|
|
2869
|
+
{
|
|
2870
|
+
delta: {
|
|
2871
|
+
content: token + ' '
|
|
2872
|
+
}
|
|
2873
|
+
}
|
|
2874
|
+
]
|
|
2875
|
+
};
|
|
2876
|
+
}
|
|
2877
|
+
})();
|
|
2878
|
+
}
|
|
2879
|
+
}
|
|
2880
|
+
}
|
|
2881
|
+
};
|
|
2882
|
+
this.isReady.set(true);
|
|
2883
|
+
this.status.set('ready');
|
|
2884
|
+
}
|
|
2885
|
+
async generate(messages, onToken, options) {
|
|
2886
|
+
if (!this.engine) {
|
|
2887
|
+
throw new Error('WebLLM Engine is not initialized. Call init() first.');
|
|
2888
|
+
}
|
|
2889
|
+
this.status.set('generating');
|
|
2890
|
+
try {
|
|
2891
|
+
let fullText = '';
|
|
2892
|
+
const reply = await this.engine.chat.completions.create({
|
|
2893
|
+
messages,
|
|
2894
|
+
stream: true,
|
|
2895
|
+
max_tokens: options?.max_tokens ?? 1024,
|
|
2896
|
+
temperature: options?.temperature ?? 0.7
|
|
2897
|
+
});
|
|
2898
|
+
for await (const chunk of reply) {
|
|
2899
|
+
const delta = chunk.choices[0]?.delta?.content || '';
|
|
2900
|
+
if (delta) {
|
|
2901
|
+
fullText += delta;
|
|
2902
|
+
if (onToken) {
|
|
2903
|
+
onToken(fullText);
|
|
2904
|
+
}
|
|
2905
|
+
}
|
|
2906
|
+
}
|
|
2907
|
+
this.status.set('ready');
|
|
2908
|
+
return fullText;
|
|
2909
|
+
}
|
|
2910
|
+
catch (err) {
|
|
2911
|
+
this.status.set('error');
|
|
2912
|
+
this.error.set(err.message || String(err));
|
|
2913
|
+
throw err;
|
|
2914
|
+
}
|
|
2915
|
+
}
|
|
2916
|
+
reset() {
|
|
2917
|
+
this.engine = null;
|
|
2918
|
+
this.isReady.set(false);
|
|
2919
|
+
this.status.set('idle');
|
|
2920
|
+
this.progress.set(0);
|
|
2921
|
+
this.error.set(null);
|
|
2922
|
+
}
|
|
2923
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.20", ngImport: i0, type: NgxWebLlmService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
2924
|
+
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.2.20", ngImport: i0, type: NgxWebLlmService, providedIn: 'root' });
|
|
2925
|
+
}
|
|
2926
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.20", ngImport: i0, type: NgxWebLlmService, decorators: [{
|
|
2927
|
+
type: Injectable,
|
|
2928
|
+
args: [{
|
|
2929
|
+
providedIn: 'root'
|
|
2930
|
+
}]
|
|
2931
|
+
}] });
|
|
2932
|
+
|
|
2769
2933
|
/**
|
|
2770
2934
|
* Generated bundle index. Do not edit.
|
|
2771
2935
|
*/
|
|
2772
2936
|
|
|
2773
|
-
export { AIAudioWaveComponent, AIChatComponent, AIChatWidgetComponent, AICodeEditorComponent, AIModelCompareComponent, AIPromptEditorComponent, AIRagInspectorComponent };
|
|
2937
|
+
export { AIAudioWaveComponent, AIChatComponent, AIChatWidgetComponent, AICodeEditorComponent, AIModelCompareComponent, AIPromptEditorComponent, AIRagInspectorComponent, NgxWebLlmService };
|
|
2774
2938
|
//# sourceMappingURL=ngx-core-components-ai.mjs.map
|