mirror of
https://github.com/QwenLM/qwen-code.git
synced 2025-12-19 09:33:53 +00:00
Optimize CLI version warning to avoid repetitive notifications
- Added tracking mechanism to prevent showing the same version warning multiple times - This resolves the issue where users were getting frequent warnings when opening new sessions - Kept the existing cache mechanism for version detection performance 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -10,6 +10,9 @@ import { CliVersionManager } from './cliVersionManager.js';
|
||||
import { MIN_CLI_VERSION_FOR_SESSION_METHODS } from './cliVersionManager.js';
|
||||
import type { CliVersionInfo } from './cliVersionManager.js';
|
||||
|
||||
// Track which versions have already been warned about to avoid repetitive warnings
|
||||
const warnedVersions = new Set<string>();
|
||||
|
||||
/**
|
||||
* Check CLI version and show warning if below minimum requirement
|
||||
*
|
||||
@@ -23,9 +26,14 @@ export async function checkCliVersionAndWarn(): Promise<void> {
|
||||
cliContextManager.setCurrentVersionInfo(versionInfo);
|
||||
|
||||
if (!versionInfo.isSupported) {
|
||||
vscode.window.showWarningMessage(
|
||||
`Qwen Code CLI version ${versionInfo.version} is below the minimum required version. Some features may not work properly. Please upgrade to version ${MIN_CLI_VERSION_FOR_SESSION_METHODS} or later.`,
|
||||
);
|
||||
// Only show warning if we haven't already warned about this specific version
|
||||
const versionKey = versionInfo.version || 'unknown';
|
||||
if (!warnedVersions.has(versionKey)) {
|
||||
vscode.window.showWarningMessage(
|
||||
`Qwen Code CLI version ${versionInfo.version} is below the minimum required version. Some features may not work properly. Please upgrade to version ${MIN_CLI_VERSION_FOR_SESSION_METHODS} or later.`,
|
||||
);
|
||||
warnedVersions.add(versionKey);
|
||||
}
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('[CliVersionChecker] Failed to check CLI version:', error);
|
||||
|
||||
@@ -27,6 +27,16 @@ export const EmptyState: React.FC<EmptyStateProps> = ({
|
||||
|
||||
return (
|
||||
<div className="flex flex-col items-center justify-center h-full p-5 md:p-10">
|
||||
{/* Loading overlay */}
|
||||
{loadingMessage && (
|
||||
<div className="bg-background/80 absolute inset-0 z-50 flex items-center justify-center backdrop-blur-sm">
|
||||
<div className="text-center">
|
||||
<div className="border-primary mx-auto mb-2 h-8 w-8 animate-spin rounded-full border-b-2"></div>
|
||||
<p className="text-muted-foreground text-sm">{loadingMessage}</p>
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
|
||||
<div className="flex flex-col items-center gap-8 w-full">
|
||||
{/* Qwen Logo */}
|
||||
<div className="flex flex-col items-center gap-6">
|
||||
@@ -39,12 +49,6 @@ export const EmptyState: React.FC<EmptyStateProps> = ({
|
||||
<div className="text-[15px] text-app-primary-foreground leading-normal font-normal max-w-[400px]">
|
||||
{description}
|
||||
</div>
|
||||
{loadingMessage && (
|
||||
<div className="flex items-center justify-center gap-2 mt-4 text-sm text-app-secondary-foreground">
|
||||
<span className="inline-block h-3 w-3 rounded-full border-2 border-app-secondary-foreground/40 border-t-app-primary-foreground animate-spin" />
|
||||
<span>{loadingMessage}</span>
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user