mirror of
https://github.com/QwenLM/qwen-code.git
synced 2025-12-20 08:47:44 +00:00
fix: Ensure user written ! is treated opaquely if not in shell mode\n\n- Addresses an issue where commands prefixed with ! (e.g., !ls) were incorrectly handled by the shell command processor if the ! was added after initially typing the command.\n- Ensures that such commands are correctly forwarded to the Gemini model.\n- Updates useGeminiStream to be aware of shell mode to properly manage streaming state.\n\nFixes https://buganizer.corp.google.com/issues/418761305
This commit is contained in:
committed by
N. Taylor Mullen
parent
a756489f86
commit
323b1298f9
@@ -8,7 +8,6 @@ import { exec as _exec } from 'child_process';
|
||||
import { useCallback } from 'react';
|
||||
import { Config } from '@gemini-code/server';
|
||||
import { type PartListUnion } from '@google/genai';
|
||||
import { getCommandFromQuery } from '../utils/commandUtils.js';
|
||||
import { UseHistoryManagerReturn } from './useHistoryManager.js';
|
||||
import crypto from 'crypto';
|
||||
import path from 'path';
|
||||
@@ -34,10 +33,6 @@ export const useShellCommandProcessor = (
|
||||
return false;
|
||||
}
|
||||
|
||||
const [symbol] = getCommandFromQuery(rawQuery);
|
||||
if (symbol !== '!' && symbol !== '$') {
|
||||
return false;
|
||||
}
|
||||
let commandToExecute = rawQuery.trim().slice(1).trimStart();
|
||||
|
||||
// wrap command to write pwd to temporary file
|
||||
|
||||
@@ -60,6 +60,7 @@ export const useGeminiStream = (
|
||||
config: Config,
|
||||
onDebugMessage: (message: string) => void,
|
||||
handleSlashCommand: (cmd: PartListUnion) => boolean,
|
||||
shellModeActive: boolean,
|
||||
) => {
|
||||
const toolRegistry = config.getToolRegistry();
|
||||
const [initError, setInitError] = useState<string | null>(null);
|
||||
@@ -120,7 +121,7 @@ export const useGeminiStream = (
|
||||
if (handleSlashCommand(trimmedQuery)) {
|
||||
return { queryToSend: null, shouldProceed: false };
|
||||
}
|
||||
if (handleShellCommand(trimmedQuery)) {
|
||||
if (shellModeActive && handleShellCommand(trimmedQuery)) {
|
||||
return { queryToSend: null, shouldProceed: false };
|
||||
}
|
||||
|
||||
@@ -608,6 +609,7 @@ export const useGeminiStream = (
|
||||
isResponding,
|
||||
setShowHelp,
|
||||
handleSlashCommand,
|
||||
shellModeActive,
|
||||
handleShellCommand,
|
||||
config,
|
||||
addItem,
|
||||
|
||||
Reference in New Issue
Block a user