tabby-ai-assistant 1.0.7 → 1.0.9
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/README.md +0 -6
- 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 +83 -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/package.json +2 -2
- 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 +149 -60
- package/src/components/settings/provider-config.component.scss +273 -153
- package/src/components/settings/provider-config.component.ts +177 -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/styles/ai-assistant.scss +8 -88
- package/src/styles/themes.scss +161 -0
package/README.md
CHANGED
|
@@ -217,15 +217,9 @@ interface TerminalContext {
|
|
|
217
217
|
|
|
218
218
|
- [Tabby](https://tabby.sh/) - 强大的终端模拟器
|
|
219
219
|
- [tabby-vscode-agent](https://github.com/SteffMet/tabby-vscode-agent) - 参考架构
|
|
220
|
-
- [Anthropic Claude](https://www.anthropic.com/) - AI提供商
|
|
221
220
|
- [Minimax](https://minimaxi.com/) - AI服务
|
|
222
221
|
- [GLM](https://open.bigmodel.cn/) - 智谱AI
|
|
223
222
|
|
|
224
|
-
## 📞 联系方式
|
|
225
|
-
|
|
226
|
-
- 项目主页: https://github.com/your-username/tabby-ai-assistant
|
|
227
|
-
- 问题反馈: https://github.com/your-username/tabby-ai-assistant/issues
|
|
228
|
-
- 邮箱: your-email@example.com
|
|
229
223
|
|
|
230
224
|
---
|
|
231
225
|
|
|
@@ -1,19 +1,26 @@
|
|
|
1
|
-
import { OnInit, OnDestroy, ElementRef, AfterViewChecked } from '@angular/core';
|
|
1
|
+
import { OnInit, OnDestroy, ElementRef, AfterViewChecked, AfterViewInit } from '@angular/core';
|
|
2
2
|
import { ChatMessage } from '../../types/ai.types';
|
|
3
3
|
import { AiAssistantService } from '../../services/core/ai-assistant.service';
|
|
4
4
|
import { ConfigProviderService } from '../../services/core/config-provider.service';
|
|
5
5
|
import { LoggerService } from '../../services/core/logger.service';
|
|
6
6
|
import { ChatHistoryService } from '../../services/chat/chat-history.service';
|
|
7
7
|
import { AiSidebarService } from '../../services/chat/ai-sidebar.service';
|
|
8
|
+
import { ThemeService } from '../../services/core/theme.service';
|
|
8
9
|
/**
|
|
9
10
|
* AI Sidebar 组件 - 替代 ChatInterfaceComponent
|
|
10
11
|
* 使用内联模板和样式,支持 Tabby 主题
|
|
11
12
|
*/
|
|
12
|
-
export declare class AiSidebarComponent implements OnInit, OnDestroy, AfterViewChecked {
|
|
13
|
+
export declare class AiSidebarComponent implements OnInit, OnDestroy, AfterViewChecked, AfterViewInit {
|
|
13
14
|
private aiService;
|
|
14
15
|
private config;
|
|
15
16
|
private logger;
|
|
16
17
|
private chatHistory;
|
|
18
|
+
private themeService;
|
|
19
|
+
displayStyle: string;
|
|
20
|
+
flexDirection: string;
|
|
21
|
+
heightStyle: string;
|
|
22
|
+
widthStyle: string;
|
|
23
|
+
overflowStyle: string;
|
|
17
24
|
chatContainerRef: ElementRef;
|
|
18
25
|
textInput: ElementRef<HTMLTextAreaElement>;
|
|
19
26
|
sidebarService: AiSidebarService;
|
|
@@ -28,9 +35,15 @@ export declare class AiSidebarComponent implements OnInit, OnDestroy, AfterViewC
|
|
|
28
35
|
charLimit: number;
|
|
29
36
|
private destroy$;
|
|
30
37
|
private shouldScrollToBottom;
|
|
31
|
-
constructor(aiService: AiAssistantService, config: ConfigProviderService, logger: LoggerService, chatHistory: ChatHistoryService);
|
|
38
|
+
constructor(aiService: AiAssistantService, config: ConfigProviderService, logger: LoggerService, chatHistory: ChatHistoryService, themeService: ThemeService);
|
|
32
39
|
ngOnInit(): void;
|
|
33
40
|
ngOnDestroy(): void;
|
|
41
|
+
ngAfterViewInit(): void;
|
|
42
|
+
/**
|
|
43
|
+
* 强制设置滚动容器样式
|
|
44
|
+
* 使用 JavaScript 直接设置,优先级最高
|
|
45
|
+
*/
|
|
46
|
+
private forceScrollStyles;
|
|
34
47
|
ngAfterViewChecked(): void;
|
|
35
48
|
/**
|
|
36
49
|
* 加载当前提供商信息
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import { EventEmitter, ElementRef, OnInit, OnDestroy } from '@angular/core';
|
|
2
|
+
import { ConfigProviderService } from '../../services/core/config-provider.service';
|
|
2
3
|
export declare class ChatInputComponent implements OnInit, OnDestroy {
|
|
4
|
+
private config;
|
|
3
5
|
disabled: boolean;
|
|
4
6
|
placeholder: string;
|
|
5
7
|
send: EventEmitter<string>;
|
|
@@ -8,6 +10,8 @@ export declare class ChatInputComponent implements OnInit, OnDestroy {
|
|
|
8
10
|
private inputSubject;
|
|
9
11
|
private destroy$;
|
|
10
12
|
isComposing: boolean;
|
|
13
|
+
enterToSend: boolean;
|
|
14
|
+
constructor(config: ConfigProviderService);
|
|
11
15
|
ngOnInit(): void;
|
|
12
16
|
ngOnDestroy(): void;
|
|
13
17
|
/**
|
|
@@ -5,12 +5,14 @@ import { ConfigProviderService } from '../../services/core/config-provider.servi
|
|
|
5
5
|
import { LoggerService } from '../../services/core/logger.service';
|
|
6
6
|
import { ChatHistoryService } from '../../services/chat/chat-history.service';
|
|
7
7
|
import { NgbModal } from '@ng-bootstrap/ng-bootstrap';
|
|
8
|
+
import { TranslateService } from '../../i18n';
|
|
8
9
|
export declare class ChatInterfaceComponent implements OnInit, OnDestroy, AfterViewChecked {
|
|
9
10
|
private aiService;
|
|
10
11
|
private config;
|
|
11
12
|
private logger;
|
|
12
13
|
private modal;
|
|
13
14
|
private chatHistory;
|
|
15
|
+
private translate;
|
|
14
16
|
chatContainerRef: ElementRef;
|
|
15
17
|
messages: ChatMessage[];
|
|
16
18
|
isLoading: boolean;
|
|
@@ -18,10 +20,25 @@ export declare class ChatInterfaceComponent implements OnInit, OnDestroy, AfterV
|
|
|
18
20
|
currentSessionId: string;
|
|
19
21
|
showScrollTop: boolean;
|
|
20
22
|
showScrollBottom: boolean;
|
|
23
|
+
showTimestamps: boolean;
|
|
24
|
+
showAvatars: boolean;
|
|
25
|
+
soundEnabled: boolean;
|
|
26
|
+
compactMode: boolean;
|
|
27
|
+
fontSize: number;
|
|
28
|
+
t: any;
|
|
21
29
|
private destroy$;
|
|
22
30
|
private shouldScrollToBottom;
|
|
23
|
-
|
|
31
|
+
private notificationSound;
|
|
32
|
+
constructor(aiService: AiAssistantService, config: ConfigProviderService, logger: LoggerService, modal: NgbModal, chatHistory: ChatHistoryService, translate: TranslateService);
|
|
24
33
|
ngOnInit(): void;
|
|
34
|
+
/**
|
|
35
|
+
* 加载 UI 设置
|
|
36
|
+
*/
|
|
37
|
+
private loadUISettings;
|
|
38
|
+
/**
|
|
39
|
+
* 应用存储的 UI 设置
|
|
40
|
+
*/
|
|
41
|
+
private applyStoredSettings;
|
|
25
42
|
ngOnDestroy(): void;
|
|
26
43
|
ngAfterViewChecked(): void;
|
|
27
44
|
/**
|
|
@@ -92,6 +109,10 @@ export declare class ChatInterfaceComponent implements OnInit, OnDestroy, AfterV
|
|
|
92
109
|
* 获取消息时间格式
|
|
93
110
|
*/
|
|
94
111
|
formatTimestamp(timestamp: Date): string;
|
|
112
|
+
/**
|
|
113
|
+
* 播放提示音
|
|
114
|
+
*/
|
|
115
|
+
private playNotificationSound;
|
|
95
116
|
/**
|
|
96
117
|
* 检查是否为今天的消息
|
|
97
118
|
*/
|
|
@@ -1,9 +1,13 @@
|
|
|
1
|
-
import { OnInit } from '@angular/core';
|
|
1
|
+
import { OnInit, OnDestroy } from '@angular/core';
|
|
2
2
|
import { ConfigProviderService } from '../../services/core/config-provider.service';
|
|
3
3
|
import { LoggerService } from '../../services/core/logger.service';
|
|
4
|
-
|
|
4
|
+
import { ThemeService } from '../../services/core/theme.service';
|
|
5
|
+
import { TranslateService } from '../../i18n';
|
|
6
|
+
export declare class ChatSettingsComponent implements OnInit, OnDestroy {
|
|
5
7
|
private config;
|
|
6
8
|
private logger;
|
|
9
|
+
private translate;
|
|
10
|
+
private themeService;
|
|
7
11
|
settings: {
|
|
8
12
|
chatHistoryEnabled: boolean;
|
|
9
13
|
maxChatHistory: number;
|
|
@@ -16,13 +20,23 @@ export declare class ChatSettingsComponent implements OnInit {
|
|
|
16
20
|
enterToSend: boolean;
|
|
17
21
|
soundEnabled: boolean;
|
|
18
22
|
};
|
|
19
|
-
|
|
20
|
-
value: string;
|
|
21
|
-
label: string;
|
|
22
|
-
}[];
|
|
23
|
+
t: any;
|
|
23
24
|
fontSizes: number[];
|
|
24
|
-
|
|
25
|
+
private destroy$;
|
|
26
|
+
constructor(config: ConfigProviderService, logger: LoggerService, translate: TranslateService, themeService: ThemeService);
|
|
25
27
|
ngOnInit(): void;
|
|
28
|
+
ngOnDestroy(): void;
|
|
29
|
+
/**
|
|
30
|
+
* 更新主题标签翻译
|
|
31
|
+
*/
|
|
32
|
+
private updateThemeLabels;
|
|
33
|
+
/**
|
|
34
|
+
* 获取主题选项
|
|
35
|
+
*/
|
|
36
|
+
get themes(): {
|
|
37
|
+
value: string;
|
|
38
|
+
label: any;
|
|
39
|
+
}[];
|
|
26
40
|
/**
|
|
27
41
|
* 加载设置
|
|
28
42
|
*/
|
|
@@ -35,10 +49,6 @@ export declare class ChatSettingsComponent implements OnInit {
|
|
|
35
49
|
* 更新主题
|
|
36
50
|
*/
|
|
37
51
|
updateTheme(theme: string): void;
|
|
38
|
-
/**
|
|
39
|
-
* 应用主题
|
|
40
|
-
*/
|
|
41
|
-
private applyTheme;
|
|
42
52
|
/**
|
|
43
53
|
* 更新字体大小
|
|
44
54
|
*/
|
|
@@ -1,22 +1,32 @@
|
|
|
1
|
-
import { OnInit } from '@angular/core';
|
|
1
|
+
import { OnInit, OnDestroy } from '@angular/core';
|
|
2
2
|
import { AiAssistantService } from '../../services/core/ai-assistant.service';
|
|
3
3
|
import { ConfigProviderService } from '../../services/core/config-provider.service';
|
|
4
4
|
import { LoggerService } from '../../services/core/logger.service';
|
|
5
|
-
|
|
5
|
+
import { TranslateService } from '../../i18n';
|
|
6
|
+
export declare class AiSettingsTabComponent implements OnInit, OnDestroy {
|
|
6
7
|
private aiService;
|
|
7
8
|
private config;
|
|
8
9
|
private logger;
|
|
10
|
+
private translate;
|
|
9
11
|
activeTab: string;
|
|
10
12
|
isEnabled: boolean;
|
|
11
13
|
currentProvider: string;
|
|
12
14
|
providerStatus: any;
|
|
15
|
+
pluginVersion: string;
|
|
16
|
+
t: any;
|
|
13
17
|
tabs: {
|
|
14
18
|
id: string;
|
|
15
|
-
|
|
19
|
+
labelKey: string;
|
|
16
20
|
icon: string;
|
|
17
21
|
}[];
|
|
18
|
-
|
|
22
|
+
private destroy$;
|
|
23
|
+
constructor(aiService: AiAssistantService, config: ConfigProviderService, logger: LoggerService, translate: TranslateService);
|
|
19
24
|
ngOnInit(): void;
|
|
25
|
+
ngOnDestroy(): void;
|
|
26
|
+
/**
|
|
27
|
+
* 更新 Tab 标签
|
|
28
|
+
*/
|
|
29
|
+
private updateTabLabels;
|
|
20
30
|
/**
|
|
21
31
|
* 加载设置
|
|
22
32
|
*/
|
|
@@ -1,38 +1,76 @@
|
|
|
1
|
-
import { EventEmitter, OnInit } from '@angular/core';
|
|
1
|
+
import { EventEmitter, OnInit, OnDestroy } from '@angular/core';
|
|
2
2
|
import { AiAssistantService } from '../../services/core/ai-assistant.service';
|
|
3
3
|
import { ConfigProviderService } from '../../services/core/config-provider.service';
|
|
4
4
|
import { LoggerService } from '../../services/core/logger.service';
|
|
5
|
+
import { ThemeService } from '../../services/core/theme.service';
|
|
5
6
|
import { ConfigService } from 'tabby-core';
|
|
6
|
-
|
|
7
|
+
import { TranslateService } from '../../i18n';
|
|
8
|
+
export declare class GeneralSettingsComponent implements OnInit, OnDestroy {
|
|
7
9
|
private aiService;
|
|
8
10
|
private config;
|
|
9
11
|
private tabbyConfig;
|
|
10
12
|
private logger;
|
|
13
|
+
private translate;
|
|
14
|
+
private themeService;
|
|
11
15
|
providerChanged: EventEmitter<string>;
|
|
12
16
|
availableProviders: any[];
|
|
13
17
|
selectedProvider: string;
|
|
14
18
|
isEnabled: boolean;
|
|
15
19
|
language: string;
|
|
16
20
|
theme: string;
|
|
21
|
+
t: any;
|
|
22
|
+
private localProviderStatus;
|
|
23
|
+
private readonly statusCacheDuration;
|
|
24
|
+
private destroy$;
|
|
17
25
|
languages: {
|
|
18
26
|
value: string;
|
|
19
27
|
label: string;
|
|
28
|
+
flag: string;
|
|
20
29
|
}[];
|
|
21
30
|
themes: {
|
|
22
31
|
value: string;
|
|
23
32
|
label: string;
|
|
24
33
|
}[];
|
|
25
34
|
private providerNames;
|
|
26
|
-
constructor(aiService: AiAssistantService, config: ConfigProviderService, tabbyConfig: ConfigService, logger: LoggerService);
|
|
35
|
+
constructor(aiService: AiAssistantService, config: ConfigProviderService, tabbyConfig: ConfigService, logger: LoggerService, translate: TranslateService, themeService: ThemeService);
|
|
27
36
|
ngOnInit(): void;
|
|
37
|
+
ngOnDestroy(): void;
|
|
38
|
+
/**
|
|
39
|
+
* 更新主题标签翻译
|
|
40
|
+
*/
|
|
41
|
+
private updateThemeLabels;
|
|
28
42
|
/**
|
|
29
43
|
* 加载设置
|
|
30
44
|
*/
|
|
31
45
|
private loadSettings;
|
|
32
46
|
/**
|
|
33
|
-
* 加载可用提供商 -
|
|
47
|
+
* 加载可用提供商 - 支持云端和本地供应商
|
|
34
48
|
*/
|
|
35
49
|
private loadProviders;
|
|
50
|
+
/**
|
|
51
|
+
* 获取供应商描述
|
|
52
|
+
*/
|
|
53
|
+
private getProviderDescription;
|
|
54
|
+
/**
|
|
55
|
+
* 获取云端提供商状态(同步返回)
|
|
56
|
+
*/
|
|
57
|
+
getProviderStatus(providerName: string): {
|
|
58
|
+
text: string;
|
|
59
|
+
color: string;
|
|
60
|
+
icon: string;
|
|
61
|
+
};
|
|
62
|
+
/**
|
|
63
|
+
* 检测本地供应商状态(异步)
|
|
64
|
+
*/
|
|
65
|
+
private checkLocalProviderStatus;
|
|
66
|
+
/**
|
|
67
|
+
* 获取本地供应商状态(同步返回,异步更新缓存)
|
|
68
|
+
*/
|
|
69
|
+
getLocalProviderStatus(providerName: string): {
|
|
70
|
+
text: string;
|
|
71
|
+
color: string;
|
|
72
|
+
icon: string;
|
|
73
|
+
};
|
|
36
74
|
/**
|
|
37
75
|
* 更新默认提供商
|
|
38
76
|
*/
|
|
@@ -50,14 +88,7 @@ export declare class GeneralSettingsComponent implements OnInit {
|
|
|
50
88
|
*/
|
|
51
89
|
updateTheme(theme: string): void;
|
|
52
90
|
/**
|
|
53
|
-
* 应用主题 -
|
|
91
|
+
* 应用主题 - 使用 ThemeService
|
|
54
92
|
*/
|
|
55
93
|
private applyTheme;
|
|
56
|
-
/**
|
|
57
|
-
* 获取提供商状态
|
|
58
|
-
*/
|
|
59
|
-
getProviderStatus(providerName: string): {
|
|
60
|
-
text: string;
|
|
61
|
-
color: string;
|
|
62
|
-
};
|
|
63
94
|
}
|
|
@@ -1,9 +1,11 @@
|
|
|
1
|
-
import { EventEmitter, OnInit } from '@angular/core';
|
|
1
|
+
import { EventEmitter, OnInit, OnDestroy } from '@angular/core';
|
|
2
2
|
import { ConfigProviderService } from '../../services/core/config-provider.service';
|
|
3
3
|
import { LoggerService } from '../../services/core/logger.service';
|
|
4
|
-
|
|
4
|
+
import { TranslateService } from '../../i18n';
|
|
5
|
+
export declare class ProviderConfigComponent implements OnInit, OnDestroy {
|
|
5
6
|
private config;
|
|
6
7
|
private logger;
|
|
8
|
+
private translate;
|
|
7
9
|
providerStatus: any;
|
|
8
10
|
refreshStatus: EventEmitter<void>;
|
|
9
11
|
switchProvider: EventEmitter<string>;
|
|
@@ -12,10 +14,17 @@ export declare class ProviderConfigComponent implements OnInit {
|
|
|
12
14
|
configs: {
|
|
13
15
|
[key: string]: any;
|
|
14
16
|
};
|
|
15
|
-
|
|
17
|
+
expandedProvider: string;
|
|
18
|
+
localStatus: {
|
|
19
|
+
[key: string]: boolean;
|
|
20
|
+
};
|
|
21
|
+
t: any;
|
|
22
|
+
private destroy$;
|
|
23
|
+
cloudProviderTemplates: {
|
|
16
24
|
openai: {
|
|
17
25
|
name: string;
|
|
18
26
|
description: string;
|
|
27
|
+
icon: string;
|
|
19
28
|
fields: ({
|
|
20
29
|
key: string;
|
|
21
30
|
label: string;
|
|
@@ -42,6 +51,7 @@ export declare class ProviderConfigComponent implements OnInit {
|
|
|
42
51
|
anthropic: {
|
|
43
52
|
name: string;
|
|
44
53
|
description: string;
|
|
54
|
+
icon: string;
|
|
45
55
|
fields: ({
|
|
46
56
|
key: string;
|
|
47
57
|
label: string;
|
|
@@ -68,6 +78,7 @@ export declare class ProviderConfigComponent implements OnInit {
|
|
|
68
78
|
minimax: {
|
|
69
79
|
name: string;
|
|
70
80
|
description: string;
|
|
81
|
+
icon: string;
|
|
71
82
|
fields: ({
|
|
72
83
|
key: string;
|
|
73
84
|
label: string;
|
|
@@ -94,6 +105,7 @@ export declare class ProviderConfigComponent implements OnInit {
|
|
|
94
105
|
glm: {
|
|
95
106
|
name: string;
|
|
96
107
|
description: string;
|
|
108
|
+
icon: string;
|
|
97
109
|
fields: ({
|
|
98
110
|
key: string;
|
|
99
111
|
label: string;
|
|
@@ -118,12 +130,74 @@ export declare class ProviderConfigComponent implements OnInit {
|
|
|
118
130
|
})[];
|
|
119
131
|
};
|
|
120
132
|
};
|
|
121
|
-
|
|
133
|
+
localProviderTemplates: {
|
|
134
|
+
ollama: {
|
|
135
|
+
name: string;
|
|
136
|
+
description: string;
|
|
137
|
+
icon: string;
|
|
138
|
+
defaultURL: string;
|
|
139
|
+
fields: {
|
|
140
|
+
key: string;
|
|
141
|
+
label: string;
|
|
142
|
+
type: string;
|
|
143
|
+
default: string;
|
|
144
|
+
required: boolean;
|
|
145
|
+
placeholder: string;
|
|
146
|
+
}[];
|
|
147
|
+
};
|
|
148
|
+
vllm: {
|
|
149
|
+
name: string;
|
|
150
|
+
description: string;
|
|
151
|
+
icon: string;
|
|
152
|
+
defaultURL: string;
|
|
153
|
+
fields: ({
|
|
154
|
+
key: string;
|
|
155
|
+
label: string;
|
|
156
|
+
type: string;
|
|
157
|
+
default: string;
|
|
158
|
+
required: boolean;
|
|
159
|
+
placeholder: string;
|
|
160
|
+
} | {
|
|
161
|
+
key: string;
|
|
162
|
+
label: string;
|
|
163
|
+
type: string;
|
|
164
|
+
required: boolean;
|
|
165
|
+
default?: undefined;
|
|
166
|
+
placeholder?: undefined;
|
|
167
|
+
})[];
|
|
168
|
+
};
|
|
169
|
+
};
|
|
170
|
+
constructor(config: ConfigProviderService, logger: LoggerService, translate: TranslateService);
|
|
122
171
|
ngOnInit(): void;
|
|
172
|
+
ngOnDestroy(): void;
|
|
123
173
|
/**
|
|
124
174
|
* 加载配置
|
|
125
175
|
*/
|
|
126
176
|
private loadConfigs;
|
|
177
|
+
/**
|
|
178
|
+
* 切换展开/折叠
|
|
179
|
+
*/
|
|
180
|
+
toggleExpand(providerName: string): void;
|
|
181
|
+
/**
|
|
182
|
+
* 检查是否是本地提供商
|
|
183
|
+
*/
|
|
184
|
+
isLocalProvider(providerName: string): boolean;
|
|
185
|
+
/**
|
|
186
|
+
* 检测本地供应商状态
|
|
187
|
+
*/
|
|
188
|
+
private checkLocalProviderStatus;
|
|
189
|
+
/**
|
|
190
|
+
* 获取本地供应商在线状态
|
|
191
|
+
*/
|
|
192
|
+
getLocalStatus(providerName: string): {
|
|
193
|
+
text: string;
|
|
194
|
+
color: string;
|
|
195
|
+
icon: string;
|
|
196
|
+
};
|
|
197
|
+
/**
|
|
198
|
+
* 测试本地提供商连接
|
|
199
|
+
*/
|
|
200
|
+
testLocalProvider(providerName: string): Promise<void>;
|
|
127
201
|
/**
|
|
128
202
|
* 保存配置
|
|
129
203
|
*/
|
|
@@ -177,9 +251,13 @@ export declare class ProviderConfigComponent implements OnInit {
|
|
|
177
251
|
*/
|
|
178
252
|
isRequired(field: any): boolean;
|
|
179
253
|
/**
|
|
180
|
-
*
|
|
254
|
+
* 获取提供商模板(支持云端和本地)
|
|
181
255
|
*/
|
|
182
256
|
getProviderTemplate(providerName: string): any;
|
|
257
|
+
/**
|
|
258
|
+
* 获取提供商图标
|
|
259
|
+
*/
|
|
260
|
+
getProviderIcon(providerName: string): string;
|
|
183
261
|
/**
|
|
184
262
|
* 检查是否有配置
|
|
185
263
|
*/
|
|
@@ -1,23 +1,33 @@
|
|
|
1
|
-
import { OnInit } from '@angular/core';
|
|
1
|
+
import { OnInit, OnDestroy } from '@angular/core';
|
|
2
2
|
import { ConfigProviderService } from '../../services/core/config-provider.service';
|
|
3
3
|
import { LoggerService } from '../../services/core/logger.service';
|
|
4
|
-
|
|
4
|
+
import { TranslateService } from '../../i18n';
|
|
5
|
+
export declare class SecuritySettingsComponent implements OnInit, OnDestroy {
|
|
5
6
|
private config;
|
|
6
7
|
private logger;
|
|
8
|
+
private translate;
|
|
7
9
|
settings: {
|
|
8
10
|
enablePasswordProtection: boolean;
|
|
11
|
+
enableRiskAssessment: boolean;
|
|
12
|
+
defaultRiskLevel: string;
|
|
13
|
+
enableConsentPersistence: boolean;
|
|
9
14
|
consentExpiryDays: number;
|
|
10
15
|
autoApproveLowRisk: boolean;
|
|
11
16
|
promptForMediumRisk: boolean;
|
|
12
17
|
requirePasswordForHighRisk: boolean;
|
|
13
|
-
enableRiskAssessment: boolean;
|
|
14
18
|
};
|
|
19
|
+
password: string;
|
|
20
|
+
newPattern: string;
|
|
15
21
|
dangerousPatterns: string[];
|
|
16
|
-
|
|
22
|
+
t: any;
|
|
23
|
+
private destroy$;
|
|
24
|
+
constructor(config: ConfigProviderService, logger: LoggerService, translate: TranslateService);
|
|
17
25
|
ngOnInit(): void;
|
|
26
|
+
ngOnDestroy(): void;
|
|
18
27
|
private loadSettings;
|
|
19
28
|
updateSetting(key: string, value: any): void;
|
|
20
29
|
addDangerousPattern(pattern: string): void;
|
|
21
30
|
removeDangerousPattern(index: number): void;
|
|
31
|
+
saveSettings(): void;
|
|
22
32
|
resetToDefaults(): void;
|
|
23
33
|
}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { Observable } from 'rxjs';
|
|
2
|
+
import { TranslationKeys, SupportedLanguage, LanguageConfig } from './types';
|
|
3
|
+
import { ConfigProviderService } from '../services/core/config-provider.service';
|
|
4
|
+
export declare const languageConfigs: LanguageConfig[];
|
|
5
|
+
export { TranslationKeys, SupportedLanguage, LanguageConfig } from './types';
|
|
6
|
+
export declare class TranslateService {
|
|
7
|
+
private config;
|
|
8
|
+
private currentLang$;
|
|
9
|
+
private currentTranslation$;
|
|
10
|
+
constructor(config: ConfigProviderService);
|
|
11
|
+
/**
|
|
12
|
+
* 获取当前语言
|
|
13
|
+
*/
|
|
14
|
+
get currentLanguage(): SupportedLanguage;
|
|
15
|
+
/**
|
|
16
|
+
* 监听语言变化
|
|
17
|
+
*/
|
|
18
|
+
get language$(): Observable<SupportedLanguage>;
|
|
19
|
+
/**
|
|
20
|
+
* 获取翻译对象
|
|
21
|
+
*/
|
|
22
|
+
get t(): TranslationKeys;
|
|
23
|
+
/**
|
|
24
|
+
* 监听翻译变化
|
|
25
|
+
*/
|
|
26
|
+
get translation$(): Observable<TranslationKeys>;
|
|
27
|
+
/**
|
|
28
|
+
* 获取所有语言配置
|
|
29
|
+
*/
|
|
30
|
+
get languages(): LanguageConfig[];
|
|
31
|
+
/**
|
|
32
|
+
* 设置语言
|
|
33
|
+
*/
|
|
34
|
+
setLanguage(lang: SupportedLanguage): void;
|
|
35
|
+
/**
|
|
36
|
+
* 获取翻译 - 支持插值
|
|
37
|
+
* 例如: translate('general.providerCount', { count: 3 })
|
|
38
|
+
*/
|
|
39
|
+
translate(key: string, params?: Record<string, any>): string;
|
|
40
|
+
/**
|
|
41
|
+
* 简写方法
|
|
42
|
+
*/
|
|
43
|
+
_(key: string, params?: Record<string, any>): string;
|
|
44
|
+
/**
|
|
45
|
+
* 获取指定语言的翻译
|
|
46
|
+
*/
|
|
47
|
+
getTranslationForLang(lang: SupportedLanguage): TranslationKeys;
|
|
48
|
+
}
|