mirror of
https://github.com/QwenLM/qwen-code.git
synced 2025-12-19 09:33:53 +00:00
Fix: Resolve CLI version reporting in /bug command (#455)
This commit is contained in:
@@ -28,10 +28,10 @@ import { Tips } from './components/Tips.js';
|
|||||||
import { ConsoleOutput } from './components/ConsolePatcher.js';
|
import { ConsoleOutput } from './components/ConsolePatcher.js';
|
||||||
import { HistoryItemDisplay } from './components/HistoryItemDisplay.js';
|
import { HistoryItemDisplay } from './components/HistoryItemDisplay.js';
|
||||||
import { useHistory } from './hooks/useHistoryManager.js';
|
import { useHistory } from './hooks/useHistoryManager.js';
|
||||||
import { useLogger } from './hooks/useLogger.js';
|
|
||||||
import process from 'node:process';
|
import process from 'node:process';
|
||||||
import { MessageType } from './types.js';
|
import { MessageType } from './types.js';
|
||||||
import { getErrorMessage, type Config } from '@gemini-code/server';
|
import { getErrorMessage, type Config } from '@gemini-code/server';
|
||||||
|
import { useLogger } from './hooks/useLogger.js';
|
||||||
|
|
||||||
interface AppProps {
|
interface AppProps {
|
||||||
config: Config;
|
config: Config;
|
||||||
@@ -53,7 +53,7 @@ export const App = ({
|
|||||||
setStaticKey((prev) => prev + 1);
|
setStaticKey((prev) => prev + 1);
|
||||||
}, [setStaticKey]);
|
}, [setStaticKey]);
|
||||||
|
|
||||||
const [geminiMdFileCount, setGeminiMdFileCount] = useState<number>(0); // Added for memory file count
|
const [geminiMdFileCount, setGeminiMdFileCount] = useState<number>(0);
|
||||||
const [debugMessage, setDebugMessage] = useState<string>('');
|
const [debugMessage, setDebugMessage] = useState<string>('');
|
||||||
const [showHelp, setShowHelp] = useState<boolean>(false);
|
const [showHelp, setShowHelp] = useState<boolean>(false);
|
||||||
const [themeError, setThemeError] = useState<string | null>(null);
|
const [themeError, setThemeError] = useState<string | null>(null);
|
||||||
@@ -131,6 +131,7 @@ export const App = ({
|
|||||||
openThemeDialog,
|
openThemeDialog,
|
||||||
performMemoryRefresh,
|
performMemoryRefresh,
|
||||||
toggleCorgiMode,
|
toggleCorgiMode,
|
||||||
|
cliVersion,
|
||||||
);
|
);
|
||||||
|
|
||||||
const { streamingState, submitQuery, initError, pendingHistoryItem } =
|
const { streamingState, submitQuery, initError, pendingHistoryItem } =
|
||||||
|
|||||||
@@ -102,6 +102,7 @@ describe('useSlashCommandProcessor', () => {
|
|||||||
mockOpenThemeDialog,
|
mockOpenThemeDialog,
|
||||||
mockPerformMemoryRefresh,
|
mockPerformMemoryRefresh,
|
||||||
mockCorgiMode,
|
mockCorgiMode,
|
||||||
|
'test-version',
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
return result.current;
|
return result.current;
|
||||||
@@ -248,7 +249,7 @@ describe('useSlashCommandProcessor', () => {
|
|||||||
sandboxEnvVar?: string,
|
sandboxEnvVar?: string,
|
||||||
seatbeltProfileVar?: string,
|
seatbeltProfileVar?: string,
|
||||||
) => {
|
) => {
|
||||||
const cliVersion = process.env.npm_package_version || 'Unknown';
|
const cliVersion = 'test-version';
|
||||||
const osVersion = `${process.platform} ${process.version}`;
|
const osVersion = `${process.platform} ${process.version}`;
|
||||||
let sandboxEnvStr = 'no sandbox';
|
let sandboxEnvStr = 'no sandbox';
|
||||||
if (sandboxEnvVar && sandboxEnvVar !== 'sandbox-exec') {
|
if (sandboxEnvVar && sandboxEnvVar !== 'sandbox-exec') {
|
||||||
|
|||||||
@@ -24,15 +24,16 @@ export interface SlashCommand {
|
|||||||
* Hook to define and process slash commands (e.g., /help, /clear).
|
* Hook to define and process slash commands (e.g., /help, /clear).
|
||||||
*/
|
*/
|
||||||
export const useSlashCommandProcessor = (
|
export const useSlashCommandProcessor = (
|
||||||
config: Config | null, // Add config here
|
config: Config | null,
|
||||||
addItem: UseHistoryManagerReturn['addItem'],
|
addItem: UseHistoryManagerReturn['addItem'],
|
||||||
clearItems: UseHistoryManagerReturn['clearItems'],
|
clearItems: UseHistoryManagerReturn['clearItems'],
|
||||||
refreshStatic: () => void,
|
refreshStatic: () => void,
|
||||||
setShowHelp: React.Dispatch<React.SetStateAction<boolean>>,
|
setShowHelp: React.Dispatch<React.SetStateAction<boolean>>,
|
||||||
onDebugMessage: (message: string) => void,
|
onDebugMessage: (message: string) => void,
|
||||||
openThemeDialog: () => void,
|
openThemeDialog: () => void,
|
||||||
performMemoryRefresh: () => Promise<void>, // Add performMemoryRefresh prop
|
performMemoryRefresh: () => Promise<void>,
|
||||||
toggleCorgiMode: () => void,
|
toggleCorgiMode: () => void,
|
||||||
|
cliVersion: string,
|
||||||
) => {
|
) => {
|
||||||
const addMessage = useCallback(
|
const addMessage = useCallback(
|
||||||
(message: Message) => {
|
(message: Message) => {
|
||||||
@@ -149,7 +150,6 @@ export const useSlashCommandProcessor = (
|
|||||||
}
|
}
|
||||||
bugDescription = bugDescription.trim();
|
bugDescription = bugDescription.trim();
|
||||||
|
|
||||||
const cliVersion = process.env.npm_package_version || 'Unknown';
|
|
||||||
const osVersion = `${process.platform} ${process.version}`;
|
const osVersion = `${process.platform} ${process.version}`;
|
||||||
let sandboxEnv = 'no sandbox';
|
let sandboxEnv = 'no sandbox';
|
||||||
if (process.env.SANDBOX && process.env.SANDBOX !== 'sandbox-exec') {
|
if (process.env.SANDBOX && process.env.SANDBOX !== 'sandbox-exec') {
|
||||||
@@ -226,6 +226,7 @@ Add any other context about the problem here.
|
|||||||
addMessage,
|
addMessage,
|
||||||
toggleCorgiMode,
|
toggleCorgiMode,
|
||||||
config, // Added config to dependency array
|
config, // Added config to dependency array
|
||||||
|
cliVersion,
|
||||||
],
|
],
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user