fix: Plan 模式执行时传递服务等级参数
- planCard.ts: 计划操作时传递 model 参数 - ICHelperPanel.ts: 传递服务等级到 setPendingPlanExecution - messageHandler.ts: 保存并传递服务等级,确保 Plan->Agent 切换时使用相同模型
This commit is contained in:
@ -341,7 +341,8 @@ export async function showICHelperPanel(
|
||||
panel,
|
||||
message.planTitle || "计划",
|
||||
context.extensionPath,
|
||||
taskId
|
||||
taskId,
|
||||
message.model // 传递服务等级
|
||||
);
|
||||
} else {
|
||||
console.warn(
|
||||
|
||||
@ -36,6 +36,7 @@ let pendingPlanExecution: {
|
||||
planTitle: string;
|
||||
extensionPath: string;
|
||||
taskId: string; // 保存 taskId 以便复用
|
||||
serviceTier?: ServiceTier; // 保存服务等级
|
||||
} | null = null;
|
||||
|
||||
/**
|
||||
@ -45,10 +46,11 @@ export function setPendingPlanExecution(
|
||||
panel: vscode.WebviewPanel,
|
||||
planTitle: string,
|
||||
extensionPath: string,
|
||||
taskId: string
|
||||
taskId: string,
|
||||
serviceTier?: ServiceTier
|
||||
): void {
|
||||
pendingPlanExecution = { panel, planTitle, extensionPath, taskId };
|
||||
console.log("[MessageHandler] 设置待执行计划:", planTitle, "taskId:", taskId);
|
||||
pendingPlanExecution = { panel, planTitle, extensionPath, taskId, serviceTier };
|
||||
console.log("[MessageHandler] 设置待执行计划:", planTitle, "taskId:", taskId, "serviceTier:", serviceTier);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -229,13 +231,16 @@ async function handleUserMessageWithBackend(
|
||||
planTitle,
|
||||
extensionPath: execPath,
|
||||
taskId: reuseTaskId,
|
||||
serviceTier: savedServiceTier,
|
||||
} = pendingPlanExecution;
|
||||
pendingPlanExecution = null;
|
||||
console.log(
|
||||
"[MessageHandler] 自动执行计划:",
|
||||
planTitle,
|
||||
"复用 taskId:",
|
||||
reuseTaskId
|
||||
reuseTaskId,
|
||||
"serviceTier:",
|
||||
savedServiceTier
|
||||
);
|
||||
|
||||
// 延迟一小段时间确保当前对话完全结束
|
||||
@ -247,7 +252,8 @@ async function handleUserMessageWithBackend(
|
||||
`请按照刚才的计划执行:${planTitle}`,
|
||||
execPath,
|
||||
"agent",
|
||||
reuseTaskId // 复用 Plan 模式的 taskId
|
||||
reuseTaskId, // 复用 Plan 模式的 taskId
|
||||
savedServiceTier // 传递保存的服务等级
|
||||
);
|
||||
} catch (err) {
|
||||
console.error("[MessageHandler] 自动执行计划失败:", err);
|
||||
@ -400,9 +406,10 @@ export async function handlePlanAction(
|
||||
panel: vscode.WebviewPanel,
|
||||
action: string,
|
||||
planTitle: string,
|
||||
extensionPath: string
|
||||
extensionPath: string,
|
||||
serviceTier?: ServiceTier
|
||||
): Promise<void> {
|
||||
console.log("[handlePlanAction] action:", action, "planTitle:", planTitle);
|
||||
console.log("[handlePlanAction] action:", action, "planTitle:", planTitle, "serviceTier:", serviceTier);
|
||||
|
||||
switch (action) {
|
||||
case "confirm":
|
||||
@ -416,7 +423,8 @@ export async function handlePlanAction(
|
||||
panel,
|
||||
`请按照刚才的计划执行:${planTitle}`,
|
||||
extensionPath,
|
||||
"agent"
|
||||
"agent",
|
||||
serviceTier
|
||||
);
|
||||
break;
|
||||
|
||||
@ -432,7 +440,8 @@ export async function handlePlanAction(
|
||||
panel,
|
||||
`请根据以下建议修改计划:${modification}`,
|
||||
extensionPath,
|
||||
"plan"
|
||||
"plan",
|
||||
serviceTier
|
||||
);
|
||||
}
|
||||
break;
|
||||
|
||||
@ -646,7 +646,8 @@ export function getPlanCardScript(): string {
|
||||
vscode.postMessage({
|
||||
command: 'planAction',
|
||||
action: actionMap[option] || option,
|
||||
planTitle: segment.planTitle
|
||||
planTitle: segment.planTitle,
|
||||
model: getCurrentModel()
|
||||
});
|
||||
});
|
||||
});
|
||||
@ -720,7 +721,8 @@ export function getPlanCardScript(): string {
|
||||
vscode.postMessage({
|
||||
command: 'planAction',
|
||||
action: action,
|
||||
planTitle: segment.planTitle
|
||||
planTitle: segment.planTitle,
|
||||
model: getCurrentModel()
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user