fix(vscode-ide-companion): 修复新建会话按钮创建新分屏的问题

问题:
- 点击新建会话按钮时,会在 VS Code 中创建一个新的 webview panel(分屏)
- 期望行为是在同一个 panel 内创建新会话,类似 Claude Code 的交互方式

解决方案:
1. 修改 extension.ts 中的 openNewChatTab 命令
   - 检查是否已有 webview panel 打开
   - 如果有,则在现有 panel 中创建新会话
   - 如果没有,才创建新 panel
2. 在 WebViewProvider 中添加 createNewSession 方法
   - 通过 agentManager 创建新会话
   - 清空当前对话 UI
3. 修改 MessageHandler 中的 openNewChatTab 处理
   - 直接调用 handleNewQwenSession 创建新会话
   - 不再执行 VS Code 命令创建新 panel

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
yiliang114
2025-11-20 23:07:56 +08:00
parent 492c56a780
commit 95b67bbebd
3 changed files with 73 additions and 14 deletions

View File

@@ -169,6 +169,11 @@ export class MessageHandler {
);
break;
case 'openNewChatTab':
// Create a new session in the current panel instead of opening a new panel
await this.handleNewQwenSession();
break;
default:
console.warn('[MessageHandler] Unknown message type:', message.type);
break;