mirror of
https://github.com/QwenLM/qwen-code.git
synced 2025-12-20 16:57:46 +00:00
feat: Add auto-accept indicator and toggle
- This commit introduces a visual indicator in the CLI to show when auto-accept for tool confirmations is enabled. Users can now also toggle this setting on/off using Shift + Tab. - This addresses user feedback for better visibility and control over the auto-accept feature, improving the overall user experience. - This behavior is similar to Claude Code, providing a familiar experience for users transitioning from that environment. - Added tests for the new auto indicator hook. Fixes https://b.corp.google.com/issues/413740468
This commit is contained in:
committed by
N. Taylor Mullen
parent
13a6a9a690
commit
aca27709df
18
packages/cli/src/ui/components/AutoAcceptIndicator.tsx
Normal file
18
packages/cli/src/ui/components/AutoAcceptIndicator.tsx
Normal file
@@ -0,0 +1,18 @@
|
||||
/**
|
||||
* @license
|
||||
* Copyright 2025 Google LLC
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
import React from 'react';
|
||||
import { Box, Text } from 'ink';
|
||||
import { Colors } from '../colors.js';
|
||||
|
||||
export const AutoAcceptIndicator: React.FC = () => (
|
||||
<Box>
|
||||
<Text color={Colors.AccentGreen}>
|
||||
accepting edits
|
||||
<Text color={Colors.SubtleComment}> (shift + tab to disable)</Text>
|
||||
</Text>
|
||||
</Box>
|
||||
);
|
||||
@@ -13,12 +13,14 @@ interface LoadingIndicatorProps {
|
||||
isLoading: boolean;
|
||||
currentLoadingPhrase: string;
|
||||
elapsedTime: number;
|
||||
rightContent?: React.ReactNode;
|
||||
}
|
||||
|
||||
export const LoadingIndicator: React.FC<LoadingIndicatorProps> = ({
|
||||
isLoading,
|
||||
currentLoadingPhrase,
|
||||
elapsedTime,
|
||||
rightContent,
|
||||
}) => {
|
||||
if (!isLoading) {
|
||||
return null; // Don't render anything if not loading
|
||||
@@ -30,10 +32,10 @@ export const LoadingIndicator: React.FC<LoadingIndicatorProps> = ({
|
||||
<Spinner type="dots" />
|
||||
</Box>
|
||||
<Text color={Colors.AccentPurple}>
|
||||
{currentLoadingPhrase} ({elapsedTime}s)
|
||||
{currentLoadingPhrase} (esc to cancel, {elapsedTime}s)
|
||||
</Text>
|
||||
<Box flexGrow={1}>{/* Spacer */}</Box>
|
||||
<Text color={Colors.SubtleComment}>(ESC to cancel)</Text>
|
||||
{rightContent && <Box>{rightContent}</Box>}
|
||||
</Box>
|
||||
);
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user