feat: 添加上下文按钮和自定义下拉框,优化输入区域样式
This commit is contained in:
@ -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":
|
||||
|
||||
Reference in New Issue
Block a user