feat: 设置面板 + Provider 扩展 + 构建脚本
- 设置面板:三步引导 / AI 配置 / API Key / 规则管理 / 连接测试 - Provider 重构:统一 OpenAICompatibleProvider 基类,新增 Gemini/Claude/混元/智谱等 - 审查面板 Webview:三 Tab、统计卡片、问题列表、postMessage 通信 - esbuild 构建脚本 + 生产打包 + PMD 下载 - 保存文件自动静态分析(500ms debounce)
This commit is contained in:
@@ -243,7 +243,7 @@ export abstract class AIProvider {
|
||||
|
||||
constructor(
|
||||
protected apiKey: string,
|
||||
protected endpoint: string
|
||||
protected baseUrl: string
|
||||
) {}
|
||||
|
||||
abstract chat(
|
||||
@@ -258,15 +258,15 @@ export abstract class AIProvider {
|
||||
|
||||
```typescript
|
||||
// factory.ts
|
||||
const registry: Record<string, new (apiKey: string, endpoint: string) => AIProvider> = {
|
||||
const registry: Record<string, new (apiKey: string, baseUrl: string) => AIProvider> = {
|
||||
deepseek: DeepSeekProvider,
|
||||
openai: OpenAIProvider,
|
||||
};
|
||||
|
||||
export function createProvider(providerId: string, apiKey: string, endpoint: string): AIProvider {
|
||||
export function createProvider(providerId: string, apiKey: string, baseUrl: string): AIProvider {
|
||||
const Cls = registry[providerId];
|
||||
if (!Cls) throw new Error(`Unknown provider: ${providerId}`);
|
||||
return new Cls(apiKey, endpoint);
|
||||
return new Cls(apiKey, baseUrl);
|
||||
}
|
||||
```
|
||||
|
||||
@@ -471,7 +471,7 @@ interface AIFinding {
|
||||
|--------|------|--------|------|
|
||||
| `vscode-code-reviewer.ai.provider` | enum | `deepseek` | 模型提供商:`deepseek` / `openai` |
|
||||
| `vscode-code-reviewer.ai.model` | string | `deepseek-chat` | 模型名称 |
|
||||
| `vscode-code-reviewer.ai.endpoint` | string | `https://api.deepseek.com/v1` | API 端点 |
|
||||
| `vscode-code-reviewer.ai.baseUrl` | string | `https://api.deepseek.com/v1` | API Base URL |
|
||||
| `vscode-code-reviewer.ai.temperature` | number | 0.2 | AI 温度参数(建议 0.1-0.3) |
|
||||
| `vscode-code-reviewer.ai.timeout` | number | 300 | AI 请求超时(秒) |
|
||||
| `vscode-code-reviewer.ai.outputLanguage` | string | `zh-CN` | 输出语言:`zh-CN` / `en` / `ja` |
|
||||
@@ -975,7 +975,7 @@ rules:
|
||||
```
|
||||
src/config/
|
||||
├── index.ts # 统一导出
|
||||
├── ai.ts # AI 配置(provider/model/endpoint/temperature/timeout/outputLanguage)
|
||||
├── ai.ts # AI 配置(provider/model/baseUrl/temperature/timeout/outputLanguage)
|
||||
├── linter.ts # Linter 配置(linters.<language>、PMD 路径)
|
||||
├── fixer.ts # 修复器配置(contextLines)
|
||||
└── secret.ts # API Key SecretStorage(get/set/delete/isConfigured)
|
||||
@@ -1047,7 +1047,7 @@ src/config/
|
||||
| 快速开始 | 三步引导(圆形序号,完成变紫色) | — |
|
||||
| 审核引擎 | 三个模块标签(紫/琥珀/绿圆点) | — |
|
||||
| AI 模型配置 | 卡片:提供商下拉框 + 模型下拉框 + 状态标签 | `ai.provider` / `ai.model` |
|
||||
| API Key | 卡片:密码输入框 + Base URL + 状态标签 | SecretStorage / `ai.endpoint` |
|
||||
| API Key | 卡片:密码输入框 + Base URL + 状态标签 | SecretStorage / `ai.baseUrl` |
|
||||
| 输出语言 | 下拉框 | `ai.outputLanguage` |
|
||||
| 自定义规则 | 卡片:开关列表 + 添加行 | `.code-review/config.yaml` |
|
||||
|
||||
|
||||
Reference in New Issue
Block a user