feat: 支持服务等级动态切换

- 添加 ServiceTier 类型定义
- 修改 dialogService 接收 serviceTier 参数
- 修改 messageHandler 传递 serviceTier 参数
- 修改 ICHelperPanel 传递 UI 选择的服务等级
This commit is contained in:
XiaoFeng
2026-01-07 16:13:56 +08:00
parent 251289a340
commit 9281d1d724
5 changed files with 37 additions and 11 deletions

View File

@ -19,7 +19,7 @@ import { dialogManager, DialogSession } from "../services/dialogService";
import { userInteractionManager } from "../services/userInteraction";
import { healthCheck } from "../services/apiClient";
import type { RunMode } from "../types/api";
import type { RunMode, ServiceTier } from "../types/api";
/** 是否使用后端服务(可通过配置控制) */
let useBackendService = true;
@ -58,7 +58,8 @@ export async function handleUserMessage(
panel: vscode.WebviewPanel,
text: string,
extensionPath?: string,
mode?: RunMode
mode?: RunMode,
serviceTier?: ServiceTier // 新增:服务等级参数
) {
console.log("收到用户消息:", text);
@ -90,7 +91,7 @@ export async function handleUserMessage(
// 尝试使用后端服务
if (useBackendService && extensionPath) {
try {
await handleUserMessageWithBackend(panel, text, extensionPath, mode);
await handleUserMessageWithBackend(panel, text, extensionPath, mode, undefined, serviceTier);
return;
} catch (error) {
console.error("后端服务不可用:", error);
@ -125,7 +126,8 @@ async function handleUserMessageWithBackend(
text: string,
extensionPath: string,
mode?: RunMode,
reuseTaskId?: string // 可选,复用现有 taskId用于 Plan 模式确认后继续执行)
reuseTaskId?: string, // 可选,复用现有 taskId用于 Plan 模式确认后继续执行)
serviceTier?: ServiceTier // 新增:服务等级参数
): Promise<void> {
const historyManager = ChatHistoryManager.getInstance();
@ -287,7 +289,8 @@ async function handleUserMessageWithBackend(
});
},
},
mode
mode,
serviceTier // 传递服务等级
);
});
}