feat: 添加上下文按钮和自定义下拉框,优化输入区域样式

This commit is contained in:
Roe-xin
2025-12-28 19:39:49 +08:00
parent 3daa66ea01
commit c050f0e167
2 changed files with 267 additions and 45 deletions

View File

@ -58,25 +58,25 @@ export async function showICHelperPanel(
const historyManager = ChatHistoryManager.getInstance();
const panelId = (panel as any).__uniqueId;
// 在处理消息前,确保面板有任务上下文
// 如果没有,则创建新任务(仅在首次发送消息时)
if (!historyManager.getPanelTask(panelId)) {
const workspacePath = vscode.workspace.workspaceFolders?.[0]?.uri.fsPath;
if (workspacePath) {
try {
const taskMeta = await historyManager.createTask(workspacePath, "新对话");
historyManager.setPanelTask(panelId, taskMeta.taskId, workspacePath);
} catch (error) {
console.error("创建任务失败:", error);
}
}
}
// 切换到当前面板的任务上下文
historyManager.switchToPanelTask(panelId);
switch (message.command) {
case "sendMessage":
// 仅在用户发送消息时,确保面板有任务上下文
// 如果没有,则创建新任务(仅在首次发送消息时)
if (!historyManager.getPanelTask(panelId)) {
const workspacePath = vscode.workspace.workspaceFolders?.[0]?.uri.fsPath;
if (workspacePath) {
try {
const taskMeta = await historyManager.createTask(workspacePath, "新对话");
historyManager.setPanelTask(panelId, taskMeta.taskId, workspacePath);
} catch (error) {
console.error("创建任务失败:", error);
}
}
}
// 切换到当前面板的任务上下文
historyManager.switchToPanelTask(panelId);
handleUserMessage(panel, message.text, context.extensionPath);
break;
case "readFile":