tabby-ai-assistant 1.0.4 → 1.0.6
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 +147 -0
- package/dist/components/chat/chat-interface.component.d.ts +38 -6
- package/dist/components/settings/general-settings.component.d.ts +6 -3
- package/dist/components/settings/provider-config.component.d.ts +25 -12
- package/dist/components/terminal/command-preview.component.d.ts +38 -0
- package/dist/index-full.d.ts +8 -0
- package/dist/index-minimal.d.ts +3 -0
- package/dist/index.d.ts +7 -3
- package/dist/index.js +1 -2
- package/dist/providers/tabby/ai-config.provider.d.ts +57 -5
- package/dist/providers/tabby/ai-hotkey.provider.d.ts +8 -14
- package/dist/providers/tabby/ai-toolbar-button.provider.d.ts +8 -9
- package/dist/services/chat/ai-sidebar.service.d.ts +89 -0
- package/dist/services/chat/chat-history.service.d.ts +78 -0
- package/dist/services/chat/chat-session.service.d.ts +57 -2
- package/dist/services/context/compaction.d.ts +90 -0
- package/dist/services/context/manager.d.ts +69 -0
- package/dist/services/context/memory.d.ts +116 -0
- package/dist/services/context/token-budget.d.ts +105 -0
- package/dist/services/core/ai-assistant.service.d.ts +40 -1
- package/dist/services/core/checkpoint.service.d.ts +130 -0
- package/dist/services/platform/escape-sequence.service.d.ts +132 -0
- package/dist/services/platform/platform-detection.service.d.ts +146 -0
- package/dist/services/providers/anthropic-provider.service.d.ts +5 -0
- package/dist/services/providers/base-provider.service.d.ts +6 -1
- package/dist/services/providers/glm-provider.service.d.ts +5 -0
- package/dist/services/providers/minimax-provider.service.d.ts +10 -1
- package/dist/services/providers/ollama-provider.service.d.ts +76 -0
- package/dist/services/providers/openai-compatible.service.d.ts +5 -0
- package/dist/services/providers/openai-provider.service.d.ts +5 -0
- package/dist/services/providers/vllm-provider.service.d.ts +82 -0
- package/dist/services/terminal/buffer-analyzer.service.d.ts +128 -0
- package/dist/services/terminal/terminal-manager.service.d.ts +185 -0
- package/dist/services/terminal/terminal-tools.service.d.ts +79 -0
- package/dist/types/ai.types.d.ts +92 -0
- package/dist/types/provider.types.d.ts +1 -1
- package/package.json +7 -10
- package/src/components/chat/ai-sidebar.component.ts +945 -0
- package/src/components/chat/chat-input.component.html +9 -24
- package/src/components/chat/chat-input.component.scss +3 -2
- package/src/components/chat/chat-interface.component.html +77 -69
- package/src/components/chat/chat-interface.component.scss +54 -4
- package/src/components/chat/chat-interface.component.ts +250 -34
- package/src/components/chat/chat-settings.component.scss +4 -4
- package/src/components/chat/chat-settings.component.ts +22 -11
- package/src/components/common/error-message.component.html +15 -0
- package/src/components/common/error-message.component.scss +77 -0
- package/src/components/common/error-message.component.ts +2 -96
- package/src/components/common/loading-spinner.component.html +4 -0
- package/src/components/common/loading-spinner.component.scss +57 -0
- package/src/components/common/loading-spinner.component.ts +2 -63
- package/src/components/security/consent-dialog.component.html +22 -0
- package/src/components/security/consent-dialog.component.scss +34 -0
- package/src/components/security/consent-dialog.component.ts +2 -55
- package/src/components/security/password-prompt.component.html +19 -0
- package/src/components/security/password-prompt.component.scss +30 -0
- package/src/components/security/password-prompt.component.ts +2 -54
- package/src/components/security/risk-confirm-dialog.component.html +8 -12
- package/src/components/security/risk-confirm-dialog.component.scss +8 -5
- package/src/components/security/risk-confirm-dialog.component.ts +6 -6
- package/src/components/settings/ai-settings-tab.component.html +16 -20
- package/src/components/settings/ai-settings-tab.component.scss +8 -5
- package/src/components/settings/ai-settings-tab.component.ts +12 -12
- package/src/components/settings/general-settings.component.html +8 -17
- package/src/components/settings/general-settings.component.scss +6 -3
- package/src/components/settings/general-settings.component.ts +62 -22
- package/src/components/settings/provider-config.component.html +19 -39
- package/src/components/settings/provider-config.component.scss +182 -39
- package/src/components/settings/provider-config.component.ts +119 -7
- package/src/components/settings/security-settings.component.scss +1 -1
- package/src/components/terminal/ai-toolbar-button.component.html +8 -0
- package/src/components/terminal/ai-toolbar-button.component.scss +20 -0
- package/src/components/terminal/ai-toolbar-button.component.ts +2 -30
- package/src/components/terminal/command-preview.component.html +61 -0
- package/src/components/terminal/command-preview.component.scss +72 -0
- package/src/components/terminal/command-preview.component.ts +127 -140
- package/src/components/terminal/command-suggestion.component.html +23 -0
- package/src/components/terminal/command-suggestion.component.scss +55 -0
- package/src/components/terminal/command-suggestion.component.ts +2 -77
- package/src/index-minimal.ts +32 -0
- package/src/index.ts +94 -11
- package/src/index.ts.backup +165 -0
- package/src/providers/tabby/ai-config.provider.ts +60 -51
- package/src/providers/tabby/ai-hotkey.provider.ts +23 -39
- package/src/providers/tabby/ai-settings-tab.provider.ts +2 -2
- package/src/providers/tabby/ai-toolbar-button.provider.ts +29 -24
- package/src/services/chat/ai-sidebar.service.ts +258 -0
- package/src/services/chat/chat-history.service.ts +308 -0
- package/src/services/chat/chat-history.service.ts.backup +239 -0
- package/src/services/chat/chat-session.service.ts +276 -3
- package/src/services/context/compaction.ts +483 -0
- package/src/services/context/manager.ts +442 -0
- package/src/services/context/memory.ts +519 -0
- package/src/services/context/token-budget.ts +422 -0
- package/src/services/core/ai-assistant.service.ts +280 -5
- package/src/services/core/ai-provider-manager.service.ts +2 -2
- package/src/services/core/checkpoint.service.ts +619 -0
- package/src/services/platform/escape-sequence.service.ts +499 -0
- package/src/services/platform/platform-detection.service.ts +494 -0
- package/src/services/providers/anthropic-provider.service.ts +28 -1
- package/src/services/providers/base-provider.service.ts +7 -1
- package/src/services/providers/glm-provider.service.ts +28 -1
- package/src/services/providers/minimax-provider.service.ts +209 -11
- package/src/services/providers/ollama-provider.service.ts +445 -0
- package/src/services/providers/openai-compatible.service.ts +9 -0
- package/src/services/providers/openai-provider.service.ts +9 -0
- package/src/services/providers/vllm-provider.service.ts +463 -0
- package/src/services/security/risk-assessment.service.ts +6 -2
- package/src/services/terminal/buffer-analyzer.service.ts +594 -0
- package/src/services/terminal/terminal-manager.service.ts +748 -0
- package/src/services/terminal/terminal-tools.service.ts +441 -0
- package/src/styles/ai-assistant.scss +78 -6
- package/src/types/ai.types.ts +144 -0
- package/src/types/provider.types.ts +1 -1
- package/src/utils/encryption.utils.ts +18 -8
- package/tsconfig.json +9 -9
- package/webpack.config.js +28 -6
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
import { OnInit, OnDestroy, ElementRef, AfterViewChecked } from '@angular/core';
|
|
2
|
+
import { ChatMessage } from '../../types/ai.types';
|
|
3
|
+
import { AiAssistantService } from '../../services/core/ai-assistant.service';
|
|
4
|
+
import { ConfigProviderService } from '../../services/core/config-provider.service';
|
|
5
|
+
import { LoggerService } from '../../services/core/logger.service';
|
|
6
|
+
import { ChatHistoryService } from '../../services/chat/chat-history.service';
|
|
7
|
+
import { AiSidebarService } from '../../services/chat/ai-sidebar.service';
|
|
8
|
+
/**
|
|
9
|
+
* AI Sidebar 组件 - 替代 ChatInterfaceComponent
|
|
10
|
+
* 使用内联模板和样式,支持 Tabby 主题
|
|
11
|
+
*/
|
|
12
|
+
export declare class AiSidebarComponent implements OnInit, OnDestroy, AfterViewChecked {
|
|
13
|
+
private aiService;
|
|
14
|
+
private config;
|
|
15
|
+
private logger;
|
|
16
|
+
private chatHistory;
|
|
17
|
+
chatContainerRef: ElementRef;
|
|
18
|
+
textInput: ElementRef<HTMLTextAreaElement>;
|
|
19
|
+
sidebarService: AiSidebarService;
|
|
20
|
+
messages: ChatMessage[];
|
|
21
|
+
isLoading: boolean;
|
|
22
|
+
currentProvider: string;
|
|
23
|
+
currentSessionId: string;
|
|
24
|
+
showScrollTop: boolean;
|
|
25
|
+
showScrollBottom: boolean;
|
|
26
|
+
inputValue: string;
|
|
27
|
+
isComposing: boolean;
|
|
28
|
+
charLimit: number;
|
|
29
|
+
private destroy$;
|
|
30
|
+
private shouldScrollToBottom;
|
|
31
|
+
constructor(aiService: AiAssistantService, config: ConfigProviderService, logger: LoggerService, chatHistory: ChatHistoryService);
|
|
32
|
+
ngOnInit(): void;
|
|
33
|
+
ngOnDestroy(): void;
|
|
34
|
+
ngAfterViewChecked(): void;
|
|
35
|
+
/**
|
|
36
|
+
* 加载当前提供商信息
|
|
37
|
+
*/
|
|
38
|
+
private loadCurrentProvider;
|
|
39
|
+
/**
|
|
40
|
+
* 加载聊天历史
|
|
41
|
+
*/
|
|
42
|
+
private loadChatHistory;
|
|
43
|
+
/**
|
|
44
|
+
* 发送欢迎消息
|
|
45
|
+
*/
|
|
46
|
+
private sendWelcomeMessage;
|
|
47
|
+
/**
|
|
48
|
+
* 处理发送消息
|
|
49
|
+
*/
|
|
50
|
+
onSendMessage(content: string): Promise<void>;
|
|
51
|
+
/**
|
|
52
|
+
* 清空聊天记录
|
|
53
|
+
*/
|
|
54
|
+
clearChat(): void;
|
|
55
|
+
/**
|
|
56
|
+
* 导出聊天记录
|
|
57
|
+
*/
|
|
58
|
+
exportChat(): void;
|
|
59
|
+
/**
|
|
60
|
+
* 切换提供商
|
|
61
|
+
*/
|
|
62
|
+
switchProvider(): Promise<void>;
|
|
63
|
+
/**
|
|
64
|
+
* 隐藏侧边栏
|
|
65
|
+
*/
|
|
66
|
+
hideSidebar(): void;
|
|
67
|
+
/**
|
|
68
|
+
* 滚动到底部(公开方法)
|
|
69
|
+
*/
|
|
70
|
+
scrollToBottom(): void;
|
|
71
|
+
/**
|
|
72
|
+
* 滚动到顶部
|
|
73
|
+
*/
|
|
74
|
+
scrollToTop(): void;
|
|
75
|
+
/**
|
|
76
|
+
* 实际执行滚动到底部
|
|
77
|
+
*/
|
|
78
|
+
private performScrollToBottom;
|
|
79
|
+
/**
|
|
80
|
+
* 处理滚动事件
|
|
81
|
+
*/
|
|
82
|
+
onScroll(event: Event): void;
|
|
83
|
+
/**
|
|
84
|
+
* 检查滚动状态(初始化时调用)
|
|
85
|
+
*/
|
|
86
|
+
private checkScrollState;
|
|
87
|
+
/**
|
|
88
|
+
* 更新滚动按钮显示状态
|
|
89
|
+
*/
|
|
90
|
+
private updateScrollButtons;
|
|
91
|
+
/**
|
|
92
|
+
* 保存聊天历史
|
|
93
|
+
*/
|
|
94
|
+
private saveChatHistory;
|
|
95
|
+
/**
|
|
96
|
+
* 生成会话 ID
|
|
97
|
+
*/
|
|
98
|
+
private generateSessionId;
|
|
99
|
+
/**
|
|
100
|
+
* 生成唯一ID
|
|
101
|
+
*/
|
|
102
|
+
private generateId;
|
|
103
|
+
/**
|
|
104
|
+
* 获取消息时间格式
|
|
105
|
+
*/
|
|
106
|
+
formatTimestamp(timestamp: Date): string;
|
|
107
|
+
/**
|
|
108
|
+
* 格式化消息内容(支持换行和基本格式化)
|
|
109
|
+
*/
|
|
110
|
+
formatMessage(content: string): string;
|
|
111
|
+
/**
|
|
112
|
+
* 检查是否为今天的消息
|
|
113
|
+
*/
|
|
114
|
+
isToday(date: Date): boolean;
|
|
115
|
+
/**
|
|
116
|
+
* 检查是否为同一天的消息
|
|
117
|
+
*/
|
|
118
|
+
isSameDay(date1: Date, date2: Date): boolean;
|
|
119
|
+
/**
|
|
120
|
+
* 处理键盘事件
|
|
121
|
+
*/
|
|
122
|
+
onKeydown(event: KeyboardEvent): void;
|
|
123
|
+
/**
|
|
124
|
+
* 处理输入事件
|
|
125
|
+
*/
|
|
126
|
+
onInput(event: Event): void;
|
|
127
|
+
/**
|
|
128
|
+
* 提交消息
|
|
129
|
+
*/
|
|
130
|
+
submit(): void;
|
|
131
|
+
/**
|
|
132
|
+
* 自动调整输入框高度
|
|
133
|
+
*/
|
|
134
|
+
private autoResize;
|
|
135
|
+
/**
|
|
136
|
+
* 获取字符计数
|
|
137
|
+
*/
|
|
138
|
+
getCharCount(): number;
|
|
139
|
+
/**
|
|
140
|
+
* 检查是否接近限制
|
|
141
|
+
*/
|
|
142
|
+
isNearLimit(): boolean;
|
|
143
|
+
/**
|
|
144
|
+
* 检查是否超过限制
|
|
145
|
+
*/
|
|
146
|
+
isOverLimit(): boolean;
|
|
147
|
+
}
|
|
@@ -1,21 +1,29 @@
|
|
|
1
|
-
import { OnInit, OnDestroy } from '@angular/core';
|
|
1
|
+
import { OnInit, OnDestroy, ElementRef, AfterViewChecked } 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
|
+
import { ChatHistoryService } from '../../services/chat/chat-history.service';
|
|
6
7
|
import { NgbModal } from '@ng-bootstrap/ng-bootstrap';
|
|
7
|
-
export declare class ChatInterfaceComponent implements OnInit, OnDestroy {
|
|
8
|
+
export declare class ChatInterfaceComponent implements OnInit, OnDestroy, AfterViewChecked {
|
|
8
9
|
private aiService;
|
|
9
10
|
private config;
|
|
10
11
|
private logger;
|
|
11
12
|
private modal;
|
|
13
|
+
private chatHistory;
|
|
14
|
+
chatContainerRef: ElementRef;
|
|
12
15
|
messages: ChatMessage[];
|
|
13
16
|
isLoading: boolean;
|
|
14
17
|
currentProvider: string;
|
|
18
|
+
currentSessionId: string;
|
|
19
|
+
showScrollTop: boolean;
|
|
20
|
+
showScrollBottom: boolean;
|
|
15
21
|
private destroy$;
|
|
16
|
-
|
|
22
|
+
private shouldScrollToBottom;
|
|
23
|
+
constructor(aiService: AiAssistantService, config: ConfigProviderService, logger: LoggerService, modal: NgbModal, chatHistory: ChatHistoryService);
|
|
17
24
|
ngOnInit(): void;
|
|
18
25
|
ngOnDestroy(): void;
|
|
26
|
+
ngAfterViewChecked(): void;
|
|
19
27
|
/**
|
|
20
28
|
* 加载当前提供商信息
|
|
21
29
|
*/
|
|
@@ -43,15 +51,39 @@ export declare class ChatInterfaceComponent implements OnInit, OnDestroy {
|
|
|
43
51
|
/**
|
|
44
52
|
* 切换提供商
|
|
45
53
|
*/
|
|
46
|
-
switchProvider(): void
|
|
54
|
+
switchProvider(): Promise<void>;
|
|
47
55
|
/**
|
|
48
|
-
*
|
|
56
|
+
* 滚动到底部(公开方法)
|
|
49
57
|
*/
|
|
50
|
-
|
|
58
|
+
scrollToBottom(): void;
|
|
59
|
+
/**
|
|
60
|
+
* 滚动到顶部
|
|
61
|
+
*/
|
|
62
|
+
scrollToTop(): void;
|
|
63
|
+
/**
|
|
64
|
+
* 实际执行滚动到底部
|
|
65
|
+
*/
|
|
66
|
+
private performScrollToBottom;
|
|
67
|
+
/**
|
|
68
|
+
* 处理滚动事件
|
|
69
|
+
*/
|
|
70
|
+
onScroll(event: Event): void;
|
|
71
|
+
/**
|
|
72
|
+
* 检查滚动状态(初始化时调用)
|
|
73
|
+
*/
|
|
74
|
+
private checkScrollState;
|
|
75
|
+
/**
|
|
76
|
+
* 更新滚动按钮显示状态
|
|
77
|
+
*/
|
|
78
|
+
private updateScrollButtons;
|
|
51
79
|
/**
|
|
52
80
|
* 保存聊天历史
|
|
53
81
|
*/
|
|
54
82
|
private saveChatHistory;
|
|
83
|
+
/**
|
|
84
|
+
* 生成会话 ID
|
|
85
|
+
*/
|
|
86
|
+
private generateSessionId;
|
|
55
87
|
/**
|
|
56
88
|
* 生成唯一ID
|
|
57
89
|
*/
|
|
@@ -2,9 +2,11 @@ import { EventEmitter, OnInit } 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 { ConfigService } from 'tabby-core';
|
|
5
6
|
export declare class GeneralSettingsComponent implements OnInit {
|
|
6
7
|
private aiService;
|
|
7
8
|
private config;
|
|
9
|
+
private tabbyConfig;
|
|
8
10
|
private logger;
|
|
9
11
|
providerChanged: EventEmitter<string>;
|
|
10
12
|
availableProviders: any[];
|
|
@@ -20,14 +22,15 @@ export declare class GeneralSettingsComponent implements OnInit {
|
|
|
20
22
|
value: string;
|
|
21
23
|
label: string;
|
|
22
24
|
}[];
|
|
23
|
-
|
|
25
|
+
private providerNames;
|
|
26
|
+
constructor(aiService: AiAssistantService, config: ConfigProviderService, tabbyConfig: ConfigService, logger: LoggerService);
|
|
24
27
|
ngOnInit(): void;
|
|
25
28
|
/**
|
|
26
29
|
* 加载设置
|
|
27
30
|
*/
|
|
28
31
|
private loadSettings;
|
|
29
32
|
/**
|
|
30
|
-
* 加载可用提供商
|
|
33
|
+
* 加载可用提供商 - 从配置服务读取已配置的提供商
|
|
31
34
|
*/
|
|
32
35
|
private loadProviders;
|
|
33
36
|
/**
|
|
@@ -47,7 +50,7 @@ export declare class GeneralSettingsComponent implements OnInit {
|
|
|
47
50
|
*/
|
|
48
51
|
updateTheme(theme: string): void;
|
|
49
52
|
/**
|
|
50
|
-
* 应用主题
|
|
53
|
+
* 应用主题 - 同步 Tabby 主题或手动设置
|
|
51
54
|
*/
|
|
52
55
|
private applyTheme;
|
|
53
56
|
/**
|
|
@@ -7,6 +7,7 @@ export declare class ProviderConfigComponent implements OnInit {
|
|
|
7
7
|
providerStatus: any;
|
|
8
8
|
refreshStatus: EventEmitter<void>;
|
|
9
9
|
switchProvider: EventEmitter<string>;
|
|
10
|
+
Object: ObjectConstructor;
|
|
10
11
|
selectedProvider: string;
|
|
11
12
|
configs: {
|
|
12
13
|
[key: string]: any;
|
|
@@ -21,21 +22,21 @@ export declare class ProviderConfigComponent implements OnInit {
|
|
|
21
22
|
type: string;
|
|
22
23
|
required: boolean;
|
|
23
24
|
default?: undefined;
|
|
24
|
-
|
|
25
|
+
placeholder?: undefined;
|
|
25
26
|
} | {
|
|
26
27
|
key: string;
|
|
27
28
|
label: string;
|
|
28
29
|
type: string;
|
|
29
30
|
default: string;
|
|
30
31
|
required: boolean;
|
|
31
|
-
|
|
32
|
+
placeholder?: undefined;
|
|
32
33
|
} | {
|
|
33
34
|
key: string;
|
|
34
35
|
label: string;
|
|
35
36
|
type: string;
|
|
36
|
-
options: string[];
|
|
37
37
|
default: string;
|
|
38
38
|
required: boolean;
|
|
39
|
+
placeholder: string;
|
|
39
40
|
})[];
|
|
40
41
|
};
|
|
41
42
|
anthropic: {
|
|
@@ -47,21 +48,21 @@ export declare class ProviderConfigComponent implements OnInit {
|
|
|
47
48
|
type: string;
|
|
48
49
|
required: boolean;
|
|
49
50
|
default?: undefined;
|
|
50
|
-
|
|
51
|
+
placeholder?: undefined;
|
|
51
52
|
} | {
|
|
52
53
|
key: string;
|
|
53
54
|
label: string;
|
|
54
55
|
type: string;
|
|
55
56
|
default: string;
|
|
56
57
|
required: boolean;
|
|
57
|
-
|
|
58
|
+
placeholder?: undefined;
|
|
58
59
|
} | {
|
|
59
60
|
key: string;
|
|
60
61
|
label: string;
|
|
61
62
|
type: string;
|
|
62
|
-
options: string[];
|
|
63
63
|
default: string;
|
|
64
64
|
required: boolean;
|
|
65
|
+
placeholder: string;
|
|
65
66
|
})[];
|
|
66
67
|
};
|
|
67
68
|
minimax: {
|
|
@@ -73,21 +74,21 @@ export declare class ProviderConfigComponent implements OnInit {
|
|
|
73
74
|
type: string;
|
|
74
75
|
required: boolean;
|
|
75
76
|
default?: undefined;
|
|
76
|
-
|
|
77
|
+
placeholder?: undefined;
|
|
77
78
|
} | {
|
|
78
79
|
key: string;
|
|
79
80
|
label: string;
|
|
80
81
|
type: string;
|
|
81
82
|
default: string;
|
|
82
83
|
required: boolean;
|
|
83
|
-
|
|
84
|
+
placeholder?: undefined;
|
|
84
85
|
} | {
|
|
85
86
|
key: string;
|
|
86
87
|
label: string;
|
|
87
88
|
type: string;
|
|
88
|
-
options: string[];
|
|
89
89
|
default: string;
|
|
90
90
|
required: boolean;
|
|
91
|
+
placeholder: string;
|
|
91
92
|
})[];
|
|
92
93
|
};
|
|
93
94
|
glm: {
|
|
@@ -99,21 +100,21 @@ export declare class ProviderConfigComponent implements OnInit {
|
|
|
99
100
|
type: string;
|
|
100
101
|
required: boolean;
|
|
101
102
|
default?: undefined;
|
|
102
|
-
|
|
103
|
+
placeholder?: undefined;
|
|
103
104
|
} | {
|
|
104
105
|
key: string;
|
|
105
106
|
label: string;
|
|
106
107
|
type: string;
|
|
107
108
|
default: string;
|
|
108
109
|
required: boolean;
|
|
109
|
-
|
|
110
|
+
placeholder?: undefined;
|
|
110
111
|
} | {
|
|
111
112
|
key: string;
|
|
112
113
|
label: string;
|
|
113
114
|
type: string;
|
|
114
|
-
options: string[];
|
|
115
115
|
default: string;
|
|
116
116
|
required: boolean;
|
|
117
|
+
placeholder: string;
|
|
117
118
|
})[];
|
|
118
119
|
};
|
|
119
120
|
};
|
|
@@ -143,6 +144,18 @@ export declare class ProviderConfigComponent implements OnInit {
|
|
|
143
144
|
* 测试连接
|
|
144
145
|
*/
|
|
145
146
|
testConnection(providerName: string): Promise<void>;
|
|
147
|
+
/**
|
|
148
|
+
* 获取测试端点
|
|
149
|
+
*/
|
|
150
|
+
private getTestEndpoint;
|
|
151
|
+
/**
|
|
152
|
+
* 获取测试请求头
|
|
153
|
+
*/
|
|
154
|
+
private getTestHeaders;
|
|
155
|
+
/**
|
|
156
|
+
* 获取测试请求体
|
|
157
|
+
*/
|
|
158
|
+
private getTestBody;
|
|
146
159
|
/**
|
|
147
160
|
* 创建默认配置
|
|
148
161
|
*/
|
|
@@ -1,15 +1,53 @@
|
|
|
1
1
|
import { EventEmitter } from '@angular/core';
|
|
2
2
|
import { CommandResponse } from '../../types/ai.types';
|
|
3
3
|
import { RiskLevel } from '../../types/security.types';
|
|
4
|
+
import { TerminalManagerService, TerminalInfo } from '../../services/terminal/terminal-manager.service';
|
|
5
|
+
import { LoggerService } from '../../services/core/logger.service';
|
|
4
6
|
export declare class CommandPreviewComponent {
|
|
7
|
+
private terminalManager;
|
|
8
|
+
private logger;
|
|
5
9
|
command: CommandResponse | null;
|
|
6
10
|
riskLevel: RiskLevel;
|
|
7
11
|
executed: EventEmitter<CommandResponse>;
|
|
8
12
|
closed: EventEmitter<void>;
|
|
13
|
+
terminals: TerminalInfo[];
|
|
14
|
+
selectedTerminalIndex: number;
|
|
15
|
+
showTerminalSelector: boolean;
|
|
16
|
+
executionStatus: 'idle' | 'executing' | 'success' | 'error';
|
|
17
|
+
statusMessage: string;
|
|
18
|
+
constructor(terminalManager: TerminalManagerService, logger: LoggerService);
|
|
19
|
+
/**
|
|
20
|
+
* 加载可用终端列表
|
|
21
|
+
*/
|
|
22
|
+
loadTerminals(): void;
|
|
9
23
|
getRiskText(): string;
|
|
10
24
|
getRiskIcon(): string;
|
|
25
|
+
/**
|
|
26
|
+
* 复制命令到剪贴板
|
|
27
|
+
*/
|
|
11
28
|
copyCommand(): void;
|
|
29
|
+
/**
|
|
30
|
+
* 执行命令到终端
|
|
31
|
+
*/
|
|
12
32
|
execute(): void;
|
|
33
|
+
/**
|
|
34
|
+
* 仅插入命令(不执行)
|
|
35
|
+
*/
|
|
36
|
+
insertOnly(): void;
|
|
37
|
+
/**
|
|
38
|
+
* 切换终端选择器
|
|
39
|
+
*/
|
|
40
|
+
toggleTerminalSelector(): void;
|
|
41
|
+
/**
|
|
42
|
+
* 选择终端
|
|
43
|
+
*/
|
|
44
|
+
selectTerminal(index: number): void;
|
|
45
|
+
/**
|
|
46
|
+
* 关闭预览
|
|
47
|
+
*/
|
|
13
48
|
close(): void;
|
|
49
|
+
/**
|
|
50
|
+
* 选择替代命令
|
|
51
|
+
*/
|
|
14
52
|
selectAlternative(alt: any): void;
|
|
15
53
|
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { AiAssistantService } from './services/core/ai-assistant.service';
|
|
2
|
+
import { ConfigProviderService } from './services/core/config-provider.service';
|
|
3
|
+
export default class AiAssistantModule {
|
|
4
|
+
private app;
|
|
5
|
+
private aiService;
|
|
6
|
+
private config;
|
|
7
|
+
constructor(app: any, aiService: AiAssistantService, config: ConfigProviderService);
|
|
8
|
+
}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,8 +1,12 @@
|
|
|
1
|
+
import './styles/ai-assistant.scss';
|
|
2
|
+
import { AppService, ConfigService, HotkeysService } from 'tabby-core';
|
|
1
3
|
import { AiAssistantService } from './services/core/ai-assistant.service';
|
|
2
|
-
import {
|
|
4
|
+
import { AiSidebarService } from './services/chat/ai-sidebar.service';
|
|
3
5
|
export default class AiAssistantModule {
|
|
4
6
|
private app;
|
|
5
|
-
private aiService;
|
|
6
7
|
private config;
|
|
7
|
-
|
|
8
|
+
private aiService;
|
|
9
|
+
private sidebarService;
|
|
10
|
+
constructor(app: AppService, config: ConfigService, aiService: AiAssistantService, sidebarService: AiSidebarService, hotkeys: HotkeysService);
|
|
8
11
|
}
|
|
12
|
+
export declare const forRoot: () => typeof AiAssistantModule;
|