mirror of
https://github.com/QwenLM/qwen-code.git
synced 2025-12-22 17:57:46 +00:00
Fixed unused variable errors in SessionMessageHandler.ts: - Commented out unused conversation and messages variables Also includes previous commits: 1. feat(vscode-ide-companion): add upgrade button to CLI version warning 2. fix(vscode-ide-companion): resolve ESLint errors in InputForm component When the Qwen Code CLI version is below the minimum required version, the warning message now includes an "Upgrade Now" button that opens a terminal and runs the npm install command to upgrade the CLI. Added tests to verify the functionality works correctly.
77 lines
1.8 KiB
TypeScript
77 lines
1.8 KiB
TypeScript
/**
|
|
* @license
|
|
* Copyright 2025 Qwen Team
|
|
* SPDX-License-Identifier: Apache-2.0
|
|
*/
|
|
|
|
import type { QwenAgentManager } from '../services/qwenAgentManager.js';
|
|
import type { ConversationStore } from '../services/conversationStore.js';
|
|
import { MessageRouter } from './handlers/MessageRouter.js';
|
|
|
|
/**
|
|
* MessageHandler (Refactored Version)
|
|
* This is a lightweight wrapper class that internally uses MessageRouter and various sub-handlers
|
|
* Maintains interface compatibility with the original code
|
|
*/
|
|
export class MessageHandler {
|
|
private router: MessageRouter;
|
|
|
|
constructor(
|
|
agentManager: QwenAgentManager,
|
|
conversationStore: ConversationStore,
|
|
currentConversationId: string | null,
|
|
sendToWebView: (message: unknown) => void,
|
|
) {
|
|
this.router = new MessageRouter(
|
|
agentManager,
|
|
conversationStore,
|
|
currentConversationId,
|
|
sendToWebView,
|
|
);
|
|
}
|
|
|
|
/**
|
|
* Route messages to the corresponding handler
|
|
*/
|
|
async route(message: { type: string; data?: unknown }): Promise<void> {
|
|
await this.router.route(message);
|
|
}
|
|
|
|
/**
|
|
* Set current session ID
|
|
*/
|
|
setCurrentConversationId(id: string | null): void {
|
|
this.router.setCurrentConversationId(id);
|
|
}
|
|
|
|
/**
|
|
* Get current session ID
|
|
*/
|
|
getCurrentConversationId(): string | null {
|
|
return this.router.getCurrentConversationId();
|
|
}
|
|
|
|
/**
|
|
* Set permission handler
|
|
*/
|
|
setPermissionHandler(
|
|
handler: (message: { type: string; data: { optionId: string } }) => void,
|
|
): void {
|
|
this.router.setPermissionHandler(handler);
|
|
}
|
|
|
|
/**
|
|
* Set login handler
|
|
*/
|
|
setLoginHandler(handler: () => Promise<void>): void {
|
|
this.router.setLoginHandler(handler);
|
|
}
|
|
|
|
/**
|
|
* Append stream content
|
|
*/
|
|
appendStreamContent(chunk: string): void {
|
|
this.router.appendStreamContent(chunk);
|
|
}
|
|
}
|