Merge pull request #1824 from QwenLM/mingholy/fix/esc-interrupt

refactor(cli): unify Escape key handling in AppContainer
This commit is contained in:
Mingholy 2026-02-13 21:39:11 +08:00 committed by GitHub
commit ffa2d89ecd
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 74 additions and 51 deletions

View file

@ -63,7 +63,6 @@ import {
import { promises as fs } from 'node:fs';
import path from 'node:path';
import { useSessionStats } from '../contexts/SessionContext.js';
import { useKeypress } from './useKeypress.js';
import type { LoadedSettings } from '../../config/settings.js';
import { t } from '../../i18n/index.js';
@ -116,7 +115,6 @@ export const useGeminiStream = (
persistSessionModel?: string;
showGuidance?: boolean;
}>,
isShellFocused?: boolean,
) => {
const [initError, setInitError] = useState<string | null>(null);
const abortControllerRef = useRef<AbortController | null>(null);
@ -385,15 +383,6 @@ export const useGeminiStream = (
getPromptCount,
]);
useKeypress(
(key) => {
if (key.name === 'escape' && !isShellFocused) {
cancelOngoingRequest();
}
},
{ isActive: streamingState === StreamingState.Responding },
);
const prepareQueryForGemini = useCallback(
async (
query: PartListUnion,