tabby-ai-assistant 1.0.8 → 1.0.10
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/dist/components/chat/ai-sidebar.component.d.ts +16 -3
- package/dist/components/chat/chat-input.component.d.ts +4 -0
- package/dist/components/chat/chat-interface.component.d.ts +22 -1
- package/dist/components/chat/chat-settings.component.d.ts +21 -11
- package/dist/components/settings/ai-settings-tab.component.d.ts +14 -4
- package/dist/components/settings/general-settings.component.d.ts +43 -12
- package/dist/components/settings/provider-config.component.d.ts +110 -5
- package/dist/components/settings/security-settings.component.d.ts +14 -4
- package/dist/i18n/index.d.ts +48 -0
- package/dist/i18n/translations/en-US.d.ts +5 -0
- package/dist/i18n/translations/ja-JP.d.ts +5 -0
- package/dist/i18n/translations/zh-CN.d.ts +5 -0
- package/dist/i18n/types.d.ts +198 -0
- package/dist/index.js +1 -1
- package/dist/services/chat/ai-sidebar.service.d.ts +23 -1
- package/dist/services/core/theme.service.d.ts +53 -0
- package/dist/services/core/toast.service.d.ts +15 -0
- package/package.json +1 -1
- package/src/components/chat/ai-sidebar.component.scss +468 -0
- package/src/components/chat/ai-sidebar.component.ts +47 -344
- package/src/components/chat/chat-input.component.scss +2 -2
- package/src/components/chat/chat-input.component.ts +16 -5
- package/src/components/chat/chat-interface.component.html +11 -11
- package/src/components/chat/chat-interface.component.scss +410 -4
- package/src/components/chat/chat-interface.component.ts +105 -14
- package/src/components/chat/chat-message.component.scss +3 -3
- package/src/components/chat/chat-message.component.ts +3 -2
- package/src/components/chat/chat-settings.component.html +95 -61
- package/src/components/chat/chat-settings.component.scss +224 -50
- package/src/components/chat/chat-settings.component.ts +56 -30
- package/src/components/security/risk-confirm-dialog.component.scss +7 -7
- package/src/components/settings/ai-settings-tab.component.html +27 -27
- package/src/components/settings/ai-settings-tab.component.scss +34 -20
- package/src/components/settings/ai-settings-tab.component.ts +59 -20
- package/src/components/settings/general-settings.component.html +69 -40
- package/src/components/settings/general-settings.component.scss +151 -58
- package/src/components/settings/general-settings.component.ts +168 -55
- package/src/components/settings/provider-config.component.html +183 -60
- package/src/components/settings/provider-config.component.scss +332 -153
- package/src/components/settings/provider-config.component.ts +268 -19
- package/src/components/settings/security-settings.component.html +70 -39
- package/src/components/settings/security-settings.component.scss +104 -8
- package/src/components/settings/security-settings.component.ts +48 -10
- package/src/i18n/index.ts +129 -0
- package/src/i18n/translations/en-US.ts +193 -0
- package/src/i18n/translations/ja-JP.ts +193 -0
- package/src/i18n/translations/zh-CN.ts +193 -0
- package/src/i18n/types.ts +224 -0
- package/src/index.ts +6 -0
- package/src/services/chat/ai-sidebar.service.ts +157 -5
- package/src/services/core/theme.service.ts +480 -0
- package/src/services/core/toast.service.ts +36 -0
- package/src/styles/ai-assistant.scss +8 -88
- package/src/styles/themes.scss +161 -0
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { Injectable } from '@angular/core';
|
|
2
|
+
import { Subject } from 'rxjs';
|
|
3
|
+
|
|
4
|
+
export interface ToastMessage {
|
|
5
|
+
id: string;
|
|
6
|
+
type: 'success' | 'error' | 'warning' | 'info';
|
|
7
|
+
message: string;
|
|
8
|
+
duration?: number;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
@Injectable({ providedIn: 'root' })
|
|
12
|
+
export class ToastService {
|
|
13
|
+
private toastSubject = new Subject<ToastMessage>();
|
|
14
|
+
toast$ = this.toastSubject.asObservable();
|
|
15
|
+
|
|
16
|
+
show(type: ToastMessage['type'], message: string, duration = 3000): void {
|
|
17
|
+
const id = `toast-${Date.now()}`;
|
|
18
|
+
this.toastSubject.next({ id, type, message, duration });
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
success(message: string, duration = 3000): void {
|
|
22
|
+
this.show('success', message, duration);
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
error(message: string, duration = 5000): void {
|
|
26
|
+
this.show('error', message, duration);
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
warning(message: string, duration = 4000): void {
|
|
30
|
+
this.show('warning', message, duration);
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
info(message: string, duration = 3000): void {
|
|
34
|
+
this.show('info', message, duration);
|
|
35
|
+
}
|
|
36
|
+
}
|
|
@@ -2,98 +2,18 @@
|
|
|
2
2
|
* Tabby AI Assistant 全局样式
|
|
3
3
|
*/
|
|
4
4
|
|
|
5
|
-
//
|
|
6
|
-
|
|
7
|
-
--ai-primary: #007bff;
|
|
8
|
-
--ai-secondary: #6c757d;
|
|
9
|
-
--ai-success: #28a745;
|
|
10
|
-
--ai-warning: #ffc107;
|
|
11
|
-
--ai-danger: #dc3545;
|
|
12
|
-
--ai-info: #17a2b8;
|
|
13
|
-
--ai-light: #f8f9fa;
|
|
14
|
-
--ai-dark: #343a40;
|
|
15
|
-
|
|
16
|
-
// 风险级别颜色
|
|
17
|
-
--ai-risk-low: #28a745;
|
|
18
|
-
--ai-risk-medium: #ffc107;
|
|
19
|
-
--ai-risk-high: #fd7e14;
|
|
20
|
-
--ai-risk-critical: #dc3545;
|
|
21
|
-
|
|
22
|
-
// 聊天消息颜色
|
|
23
|
-
--ai-user-message: #e3f2fd;
|
|
24
|
-
--ai-assistant-message: #f5f5f5;
|
|
25
|
-
--ai-system-message: #fff3cd;
|
|
26
|
-
|
|
27
|
-
// 背景和边框
|
|
28
|
-
--ai-bg-primary: #ffffff;
|
|
29
|
-
--ai-bg-secondary: #f8f9fa;
|
|
30
|
-
--ai-border: #dee2e6;
|
|
31
|
-
--ai-border-radius: 0.375rem;
|
|
32
|
-
--ai-box-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075);
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
// 深色主题 - 支持多种类名
|
|
36
|
-
.dark-theme,
|
|
37
|
-
.ai-theme-dark,
|
|
38
|
-
body.ai-theme-dark {
|
|
39
|
-
--ai-primary: #4dabf7;
|
|
40
|
-
--ai-secondary: #adb5bd;
|
|
41
|
-
--ai-success: #51cf66;
|
|
42
|
-
--ai-warning: #fcc419;
|
|
43
|
-
--ai-danger: #ff6b6b;
|
|
44
|
-
--ai-info: #22b8cf;
|
|
45
|
-
--ai-light: #343a40;
|
|
46
|
-
--ai-dark: #f8f9fa;
|
|
47
|
-
|
|
48
|
-
--ai-risk-low: #51cf66;
|
|
49
|
-
--ai-risk-medium: #fcc419;
|
|
50
|
-
--ai-risk-high: #ff922b;
|
|
51
|
-
--ai-risk-critical: #ff6b6b;
|
|
52
|
-
|
|
53
|
-
--ai-user-message: #1e3a5f;
|
|
54
|
-
--ai-assistant-message: #2d3748;
|
|
55
|
-
--ai-system-message: #3a3a3a;
|
|
56
|
-
|
|
57
|
-
--ai-bg-primary: #1a1a1a;
|
|
58
|
-
--ai-bg-secondary: #2d2d2d;
|
|
59
|
-
--ai-border: #4a4a4a;
|
|
60
|
-
--ai-box-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.3);
|
|
61
|
-
}
|
|
5
|
+
// 导入主题系统
|
|
6
|
+
@import 'themes';
|
|
62
7
|
|
|
63
|
-
//
|
|
64
|
-
|
|
65
|
-
.ai-theme-light,
|
|
66
|
-
body.ai-theme-light {
|
|
67
|
-
--ai-primary: #007bff;
|
|
68
|
-
--ai-secondary: #6c757d;
|
|
69
|
-
--ai-success: #28a745;
|
|
70
|
-
--ai-warning: #ffc107;
|
|
71
|
-
--ai-danger: #dc3545;
|
|
72
|
-
--ai-info: #17a2b8;
|
|
73
|
-
--ai-light: #f8f9fa;
|
|
74
|
-
--ai-dark: #343a40;
|
|
75
|
-
|
|
76
|
-
--ai-risk-low: #28a745;
|
|
77
|
-
--ai-risk-medium: #ffc107;
|
|
78
|
-
--ai-risk-high: #fd7e14;
|
|
79
|
-
--ai-risk-critical: #dc3545;
|
|
80
|
-
|
|
81
|
-
--ai-user-message: #e3f2fd;
|
|
82
|
-
--ai-assistant-message: #f5f5f5;
|
|
83
|
-
--ai-system-message: #fff3cd;
|
|
84
|
-
|
|
85
|
-
--ai-bg-primary: #ffffff;
|
|
86
|
-
--ai-bg-secondary: #f8f9fa;
|
|
87
|
-
--ai-border: #dee2e6;
|
|
88
|
-
--ai-box-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075);
|
|
89
|
-
}
|
|
8
|
+
// 主题颜色变量已移至 themes.scss
|
|
9
|
+
// 这里只保留通用样式和组件样式
|
|
90
10
|
|
|
91
11
|
// 通用样式
|
|
92
12
|
.ai-assistant {
|
|
93
13
|
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
|
|
94
14
|
font-size: 14px;
|
|
95
15
|
line-height: 1.5;
|
|
96
|
-
color: var(--ai-
|
|
16
|
+
color: var(--ai-text-primary);
|
|
97
17
|
background-color: var(--ai-bg-primary);
|
|
98
18
|
|
|
99
19
|
* {
|
|
@@ -208,7 +128,7 @@ body.ai-theme-light {
|
|
|
208
128
|
font-size: 14px;
|
|
209
129
|
line-height: 1.5;
|
|
210
130
|
background-color: var(--ai-bg-primary);
|
|
211
|
-
color: var(--ai-
|
|
131
|
+
color: var(--ai-text-primary);
|
|
212
132
|
|
|
213
133
|
&:focus {
|
|
214
134
|
outline: none;
|
|
@@ -363,7 +283,7 @@ body.ai-theme-light {
|
|
|
363
283
|
border: 1px solid var(--ai-border);
|
|
364
284
|
border-radius: var(--ai-border-radius);
|
|
365
285
|
background-color: var(--ai-bg-primary);
|
|
366
|
-
color: var(--ai-
|
|
286
|
+
color: var(--ai-text-primary);
|
|
367
287
|
|
|
368
288
|
&:focus {
|
|
369
289
|
outline: none;
|
|
@@ -451,7 +371,7 @@ body.ai-theme-light {
|
|
|
451
371
|
left: 50%;
|
|
452
372
|
transform: translateX(-50%);
|
|
453
373
|
padding: 0.5rem;
|
|
454
|
-
background-color: var(--ai-
|
|
374
|
+
background-color: var(--ai-text-primary);
|
|
455
375
|
color: var(--ai-light);
|
|
456
376
|
border-radius: var(--ai-border-radius);
|
|
457
377
|
font-size: 0.875rem;
|
|
@@ -0,0 +1,161 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* AI Assistant 主题系统 - 静态样式
|
|
3
|
+
* CSS 变量由 ThemeService 动态注入到 <style> 元素
|
|
4
|
+
* 此文件仅包含主题预览和静态样式
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
// ============================================
|
|
8
|
+
// 主题预览方块样式
|
|
9
|
+
// ============================================
|
|
10
|
+
.theme-preview {
|
|
11
|
+
width: 64px;
|
|
12
|
+
height: 64px;
|
|
13
|
+
border-radius: 8px;
|
|
14
|
+
transition: all 0.3s ease;
|
|
15
|
+
position: relative;
|
|
16
|
+
overflow: hidden;
|
|
17
|
+
|
|
18
|
+
// 浅色
|
|
19
|
+
&[data-theme="light"] {
|
|
20
|
+
background: linear-gradient(135deg, #ffffff 0%, #f0f0f0 100%) !important;
|
|
21
|
+
border: 1px solid #e0e0e0 !important;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
// 深色
|
|
25
|
+
&[data-theme="dark"] {
|
|
26
|
+
background: linear-gradient(135deg, #1a1a1a 0%, #2d2d2d 100%) !important;
|
|
27
|
+
border: 1px solid #4a4a4a !important;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
// 跟随系统
|
|
31
|
+
&[data-theme="auto"] {
|
|
32
|
+
background: linear-gradient(135deg, #f5f5f5 50%, #1a1a1a 50%) !important;
|
|
33
|
+
position: relative;
|
|
34
|
+
|
|
35
|
+
&::after {
|
|
36
|
+
content: '';
|
|
37
|
+
position: absolute;
|
|
38
|
+
top: 50%;
|
|
39
|
+
left: 50%;
|
|
40
|
+
transform: translate(-50%, -50%);
|
|
41
|
+
width: 24px;
|
|
42
|
+
height: 24px;
|
|
43
|
+
background: linear-gradient(135deg, #fff 50%, #333 50%) !important;
|
|
44
|
+
border-radius: 50% !important;
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
// 像素风格
|
|
49
|
+
&[data-theme="pixel"] {
|
|
50
|
+
background: #0f380f !important;
|
|
51
|
+
border: 4px solid #9bbc0f !important;
|
|
52
|
+
border-radius: 0 !important;
|
|
53
|
+
|
|
54
|
+
// 像素网格效果
|
|
55
|
+
background-image:
|
|
56
|
+
linear-gradient(90deg, rgba(155, 188, 15, 0.1) 1px, transparent 1px),
|
|
57
|
+
linear-gradient(rgba(155, 188, 15, 0.1) 1px, transparent 1px) !important;
|
|
58
|
+
background-size: 8px 8px !important;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
// 科技风格
|
|
62
|
+
&[data-theme="tech"] {
|
|
63
|
+
background: #0a0a0f !important;
|
|
64
|
+
border: 1px solid #00fff9 !important;
|
|
65
|
+
box-shadow: 0 0 10px rgba(0, 255, 249, 0.4) !important;
|
|
66
|
+
|
|
67
|
+
// 扫描线效果
|
|
68
|
+
&::after {
|
|
69
|
+
content: '';
|
|
70
|
+
position: absolute;
|
|
71
|
+
top: 0;
|
|
72
|
+
left: 0;
|
|
73
|
+
right: 0;
|
|
74
|
+
bottom: 0;
|
|
75
|
+
background: repeating-linear-gradient(
|
|
76
|
+
0deg,
|
|
77
|
+
transparent,
|
|
78
|
+
transparent 2px,
|
|
79
|
+
rgba(0, 255, 249, 0.1) 2px,
|
|
80
|
+
rgba(0, 255, 249, 0.1) 4px
|
|
81
|
+
) !important;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
// 角落装饰
|
|
85
|
+
&::before {
|
|
86
|
+
content: '';
|
|
87
|
+
position: absolute;
|
|
88
|
+
top: 4px;
|
|
89
|
+
left: 4px;
|
|
90
|
+
width: 12px;
|
|
91
|
+
height: 12px;
|
|
92
|
+
border-top: 2px solid #00fff9 !important;
|
|
93
|
+
border-left: 2px solid #00fff9 !important;
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
&:hover {
|
|
98
|
+
transform: scale(1.05) !important;
|
|
99
|
+
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2) !important;
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
&.active {
|
|
103
|
+
box-shadow: 0 0 0 2px var(--ai-primary, #007bff) !important;
|
|
104
|
+
transform: scale(1.1) !important;
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
// ============================================
|
|
109
|
+
// 主题选择器样式
|
|
110
|
+
// ============================================
|
|
111
|
+
.theme-selector {
|
|
112
|
+
display: flex;
|
|
113
|
+
gap: 0.75rem;
|
|
114
|
+
flex-wrap: wrap;
|
|
115
|
+
|
|
116
|
+
.theme-btn {
|
|
117
|
+
display: flex;
|
|
118
|
+
flex-direction: column;
|
|
119
|
+
align-items: center;
|
|
120
|
+
gap: 0.5rem;
|
|
121
|
+
padding: 0.5rem;
|
|
122
|
+
border: 2px solid var(--ai-border, #dee2e6) !important;
|
|
123
|
+
border-radius: var(--ai-border-radius, 0.375rem) !important;
|
|
124
|
+
background: var(--ai-bg-primary, #ffffff) !important;
|
|
125
|
+
cursor: pointer;
|
|
126
|
+
transition: all 0.2s ease !important;
|
|
127
|
+
|
|
128
|
+
&:hover {
|
|
129
|
+
border-color: var(--ai-primary, #007bff) !important;
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
&.active {
|
|
133
|
+
border-color: var(--ai-primary, #007bff) !important;
|
|
134
|
+
background: var(--ai-bg-secondary, #f8f9fa) !important;
|
|
135
|
+
box-shadow: 0 0 0 2px rgba(var(--ai-primary, #007bff), 0.2) !important;
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
span {
|
|
139
|
+
font-size: 0.75rem;
|
|
140
|
+
color: var(--ai-text-primary, #212529) !important;
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
// ============================================
|
|
146
|
+
// 响应式设计
|
|
147
|
+
// ============================================
|
|
148
|
+
@media (max-width: 768px) {
|
|
149
|
+
.theme-selector {
|
|
150
|
+
justify-content: center;
|
|
151
|
+
|
|
152
|
+
.theme-btn {
|
|
153
|
+
padding: 0.375rem;
|
|
154
|
+
|
|
155
|
+
.theme-preview {
|
|
156
|
+
width: 48px !important;
|
|
157
|
+
height: 48px !important;
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
}
|