mirror of
https://github.com/QwenLM/qwen-code.git
synced 2026-04-30 04:30:48 +00:00
feat: to #2767, support verbose and compact mode swither with ctrl-o
This commit is contained in:
parent
1b1a029fd7
commit
b9c17d13ff
17 changed files with 166 additions and 45 deletions
|
|
@ -12,6 +12,7 @@ import { StreamingState, ToolCallStatus } from '../../types.js';
|
|||
import { Text } from 'ink';
|
||||
import { StreamingContext } from '../../contexts/StreamingContext.js';
|
||||
import { SettingsContext } from '../../contexts/SettingsContext.js';
|
||||
import { VerboseModeProvider } from '../../contexts/VerboseModeContext.js';
|
||||
import type {
|
||||
AnsiOutput,
|
||||
AnsiOutputDisplay,
|
||||
|
|
@ -101,18 +102,21 @@ const mockSettings: LoadedSettings = {
|
|||
},
|
||||
} as LoadedSettings;
|
||||
|
||||
// Helper to render with context
|
||||
// Helper to render with context (verbose=true by default to show tool output)
|
||||
const renderWithContext = (
|
||||
ui: React.ReactElement,
|
||||
streamingState: StreamingState,
|
||||
verboseMode = true,
|
||||
) => {
|
||||
const contextValue: StreamingState = streamingState;
|
||||
return render(
|
||||
<SettingsContext.Provider value={mockSettings}>
|
||||
<StreamingContext.Provider value={contextValue}>
|
||||
{ui}
|
||||
</StreamingContext.Provider>
|
||||
</SettingsContext.Provider>,
|
||||
<VerboseModeProvider value={{ verboseMode, frozenSnapshot: null }}>
|
||||
<SettingsContext.Provider value={mockSettings}>
|
||||
<StreamingContext.Provider value={contextValue}>
|
||||
{ui}
|
||||
</StreamingContext.Provider>
|
||||
</SettingsContext.Provider>
|
||||
</VerboseModeProvider>,
|
||||
);
|
||||
};
|
||||
|
||||
|
|
@ -143,6 +147,18 @@ describe('<ToolMessage />', () => {
|
|||
expect(output).toContain('MockMarkdown:Test result');
|
||||
});
|
||||
|
||||
it('hides result output in compact mode (verboseMode=false)', () => {
|
||||
const { lastFrame } = renderWithContext(
|
||||
<ToolMessage {...baseProps} />,
|
||||
StreamingState.Idle,
|
||||
false, // compact mode
|
||||
);
|
||||
const output = lastFrame();
|
||||
expect(output).toContain('✓'); // status indicator still visible
|
||||
expect(output).toContain('test-tool'); // tool name still visible
|
||||
expect(output).not.toContain('MockMarkdown:Test result'); // result hidden
|
||||
});
|
||||
|
||||
describe('ToolStatusIndicator rendering', () => {
|
||||
it('shows ✓ for Success status', () => {
|
||||
const { lastFrame } = renderWithContext(
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue