mirror of
https://github.com/QwenLM/qwen-code.git
synced 2025-12-21 01:07:46 +00:00
feat(ui): add /settings command and UI panel (#4738)
Co-authored-by: Jacob Richman <jacob314@gmail.com>
This commit is contained in:
@@ -147,6 +147,7 @@ describe('useSlashCommandProcessor', () => {
|
||||
vi.fn(), // toggleCorgiMode
|
||||
mockSetQuittingMessages,
|
||||
vi.fn(), // openPrivacyNotice
|
||||
vi.fn(), // openSettingsDialog
|
||||
vi.fn(), // toggleVimEnabled
|
||||
setIsProcessing,
|
||||
),
|
||||
@@ -864,6 +865,9 @@ describe('useSlashCommandProcessor', () => {
|
||||
vi.fn(), // toggleCorgiMode
|
||||
mockSetQuittingMessages,
|
||||
vi.fn(), // openPrivacyNotice
|
||||
|
||||
vi.fn(), // openSettingsDialog
|
||||
vi.fn(), // toggleVimEnabled
|
||||
vi.fn().mockResolvedValue(false), // toggleVimEnabled
|
||||
vi.fn(), // setIsProcessing
|
||||
),
|
||||
|
||||
@@ -50,6 +50,7 @@ export const useSlashCommandProcessor = (
|
||||
toggleCorgiMode: () => void,
|
||||
setQuittingMessages: (message: HistoryItem[]) => void,
|
||||
openPrivacyNotice: () => void,
|
||||
openSettingsDialog: () => void,
|
||||
toggleVimEnabled: () => Promise<boolean>,
|
||||
setIsProcessing: (isProcessing: boolean) => void,
|
||||
setGeminiMdFileCount: (count: number) => void,
|
||||
@@ -359,6 +360,11 @@ export const useSlashCommandProcessor = (
|
||||
case 'privacy':
|
||||
openPrivacyNotice();
|
||||
return { type: 'handled' };
|
||||
case 'settings':
|
||||
openSettingsDialog();
|
||||
return { type: 'handled' };
|
||||
case 'help':
|
||||
return { type: 'handled' };
|
||||
default: {
|
||||
const unhandled: never = result.dialog;
|
||||
throw new Error(
|
||||
@@ -512,6 +518,7 @@ export const useSlashCommandProcessor = (
|
||||
openPrivacyNotice,
|
||||
openEditorDialog,
|
||||
setQuittingMessages,
|
||||
openSettingsDialog,
|
||||
setShellConfirmationRequest,
|
||||
setSessionShellAllowlist,
|
||||
setIsProcessing,
|
||||
|
||||
25
packages/cli/src/ui/hooks/useSettingsCommand.ts
Normal file
25
packages/cli/src/ui/hooks/useSettingsCommand.ts
Normal file
@@ -0,0 +1,25 @@
|
||||
/**
|
||||
* @license
|
||||
* Copyright 2025 Google LLC
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
import { useState, useCallback } from 'react';
|
||||
|
||||
export function useSettingsCommand() {
|
||||
const [isSettingsDialogOpen, setIsSettingsDialogOpen] = useState(false);
|
||||
|
||||
const openSettingsDialog = useCallback(() => {
|
||||
setIsSettingsDialogOpen(true);
|
||||
}, []);
|
||||
|
||||
const closeSettingsDialog = useCallback(() => {
|
||||
setIsSettingsDialogOpen(false);
|
||||
}, []);
|
||||
|
||||
return {
|
||||
isSettingsDialogOpen,
|
||||
openSettingsDialog,
|
||||
closeSettingsDialog,
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user