Add Interactive Approval Mode Dialog (#1012)

This commit is contained in:
tanzhenxin 2025-11-13 19:02:53 +08:00 committed by GitHub
parent 0752a31e1e
commit 160b64523e
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
16 changed files with 397 additions and 909 deletions

View file

@ -6,13 +6,20 @@
import { useCallback } from 'react';
import { SettingScope } from '../../config/settings.js';
import type { AuthType } from '@qwen-code/qwen-code-core';
import type { AuthType, ApprovalMode } from '@qwen-code/qwen-code-core';
export interface DialogCloseOptions {
// Theme dialog
isThemeDialogOpen: boolean;
handleThemeSelect: (theme: string | undefined, scope: SettingScope) => void;
// Approval mode dialog
isApprovalModeDialogOpen: boolean;
handleApprovalModeSelect: (
mode: ApprovalMode | undefined,
scope: SettingScope,
) => void;
// Auth dialog
isAuthDialogOpen: boolean;
handleAuthSelect: (
@ -57,6 +64,12 @@ export function useDialogClose(options: DialogCloseOptions) {
return true;
}
if (options.isApprovalModeDialogOpen) {
// Mimic ESC behavior: onSelect(undefined, selectedScope) - keeps current mode
options.handleApprovalModeSelect(undefined, SettingScope.User);
return true;
}
if (options.isEditorDialogOpen) {
// Mimic ESC behavior: call onExit() directly
options.exitEditorDialog();