mirror of
https://github.com/QwenLM/qwen-code.git
synced 2025-12-20 08:47:44 +00:00
feat(cli): 添加 CLI 版本检测和会话验证功能
- 新增 CLI 版本检测功能,支持检测 CLI 版本并缓存结果 - 实现会话验证方法,用于检查当前会话是否有效 - 在连接处理中集成 CLI 版本检测和会话验证逻辑 - 优化 WebViewProvider 中的初始化流程,支持背景初始化 - 更新消息处理逻辑,增加与 CLI 相关的错误处理
This commit is contained in:
@@ -146,6 +146,41 @@ export const useWebViewMessages = ({
|
||||
break;
|
||||
}
|
||||
|
||||
// case 'cliNotInstalled': {
|
||||
// // Show CLI not installed message
|
||||
// const errorMsg =
|
||||
// (message?.data?.error as string) ||
|
||||
// 'Qwen Code CLI is not installed. Please install it to enable full functionality.';
|
||||
|
||||
// handlers.messageHandling.addMessage({
|
||||
// role: 'assistant',
|
||||
// content: `Qwen CLI is not installed. Please install it to enable full functionality.\n\nError: ${errorMsg}\n\nInstallation instructions:\n1. Install via npm:\n npm install -g @qwen-code/qwen-code@latest\n\n2. After installation, reload VS Code or restart the extension.`,
|
||||
// timestamp: Date.now(),
|
||||
// });
|
||||
// break;
|
||||
// }
|
||||
|
||||
// case 'agentConnected': {
|
||||
// // Agent connected successfully
|
||||
// handlers.messageHandling.clearWaitingForResponse();
|
||||
// break;
|
||||
// }
|
||||
|
||||
// case 'agentConnectionError': {
|
||||
// // Agent connection failed
|
||||
// handlers.messageHandling.clearWaitingForResponse();
|
||||
// const errorMsg =
|
||||
// (message?.data?.message as string) ||
|
||||
// 'Failed to connect to Qwen agent.';
|
||||
|
||||
// handlers.messageHandling.addMessage({
|
||||
// role: 'assistant',
|
||||
// content: `Failed to connect to Qwen agent: ${errorMsg}\nYou can still use the chat UI, but messages won't be sent to AI.`,
|
||||
// timestamp: Date.now(),
|
||||
// });
|
||||
// break;
|
||||
// }
|
||||
|
||||
case 'loginError': {
|
||||
// Clear loading state and show error notice
|
||||
handlers.messageHandling.clearWaitingForResponse();
|
||||
|
||||
Reference in New Issue
Block a user