mirror of
https://github.com/google-gemini/gemini-cli.git
synced 2026-05-13 05:12:55 -07:00
fix(cli): prevent Thinking... Thinking... duplication in footer
This commit is contained in:
@@ -385,7 +385,7 @@ describe('Composer', () => {
|
|||||||
const { lastFrame } = await renderComposer(uiState, settings);
|
const { lastFrame } = await renderComposer(uiState, settings);
|
||||||
|
|
||||||
const output = lastFrame();
|
const output = lastFrame();
|
||||||
expect(output).toContain('LoadingIndicator: Thinking about code');
|
expect(output).toContain('LoadingIndicator: Thinking...');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('hides shortcuts hint while loading', async () => {
|
it('hides shortcuts hint while loading', async () => {
|
||||||
|
|||||||
@@ -238,7 +238,9 @@ export const Composer = ({ isFocused = true }: { isFocused?: boolean }) => {
|
|||||||
? undefined
|
? undefined
|
||||||
: uiState.currentLoadingPhrase
|
: uiState.currentLoadingPhrase
|
||||||
}
|
}
|
||||||
thoughtLabel={undefined}
|
thoughtLabel={
|
||||||
|
inlineThinkingMode === 'full' ? 'Thinking...' : undefined
|
||||||
|
}
|
||||||
elapsedTime={uiState.elapsedTime}
|
elapsedTime={uiState.elapsedTime}
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
@@ -388,7 +390,7 @@ export const Composer = ({ isFocused = true }: { isFocused?: boolean }) => {
|
|||||||
marginTop={
|
marginTop={
|
||||||
(showApprovalIndicator ||
|
(showApprovalIndicator ||
|
||||||
uiState.shellModeActive) &&
|
uiState.shellModeActive) &&
|
||||||
isNarrow
|
!isNarrow
|
||||||
? 1
|
? 1
|
||||||
: 0
|
: 0
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -258,13 +258,32 @@ describe('<LoadingIndicator />', () => {
|
|||||||
const output = lastFrame();
|
const output = lastFrame();
|
||||||
expect(output).toBeDefined();
|
expect(output).toBeDefined();
|
||||||
if (output) {
|
if (output) {
|
||||||
expect(output).toContain('Thinking... ');
|
// Should NOT contain "Thinking... " prefix because the subject already starts with "Thinking"
|
||||||
|
expect(output).not.toContain('Thinking... Thinking');
|
||||||
expect(output).toContain('Thinking about something...');
|
expect(output).toContain('Thinking about something...');
|
||||||
expect(output).not.toContain('and other stuff.');
|
expect(output).not.toContain('and other stuff.');
|
||||||
}
|
}
|
||||||
unmount();
|
unmount();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('should prepend "Thinking... " if the subject does not start with "Thinking"', async () => {
|
||||||
|
const props = {
|
||||||
|
thought: {
|
||||||
|
subject: 'Planning the response...',
|
||||||
|
description: 'details',
|
||||||
|
},
|
||||||
|
elapsedTime: 5,
|
||||||
|
};
|
||||||
|
const { lastFrame, unmount, waitUntilReady } = renderWithContext(
|
||||||
|
<LoadingIndicator {...props} />,
|
||||||
|
StreamingState.Responding,
|
||||||
|
);
|
||||||
|
await waitUntilReady();
|
||||||
|
const output = lastFrame();
|
||||||
|
expect(output).toContain('Thinking... Planning the response...');
|
||||||
|
unmount();
|
||||||
|
});
|
||||||
|
|
||||||
it('should prioritize thought.subject over currentLoadingPhrase', async () => {
|
it('should prioritize thought.subject over currentLoadingPhrase', async () => {
|
||||||
const props = {
|
const props = {
|
||||||
thought: {
|
thought: {
|
||||||
|
|||||||
@@ -58,7 +58,11 @@ export const LoadingIndicator: React.FC<LoadingIndicatorProps> = ({
|
|||||||
const hasThoughtIndicator =
|
const hasThoughtIndicator =
|
||||||
currentLoadingPhrase !== INTERACTIVE_SHELL_WAITING_PHRASE &&
|
currentLoadingPhrase !== INTERACTIVE_SHELL_WAITING_PHRASE &&
|
||||||
Boolean(thought?.subject?.trim());
|
Boolean(thought?.subject?.trim());
|
||||||
const thinkingIndicator = hasThoughtIndicator ? 'Thinking... ' : '';
|
// Avoid "Thinking... Thinking..." duplication if primaryText already starts with "Thinking"
|
||||||
|
const thinkingIndicator =
|
||||||
|
hasThoughtIndicator && !primaryText?.startsWith('Thinking')
|
||||||
|
? 'Thinking... '
|
||||||
|
: '';
|
||||||
|
|
||||||
const cancelAndTimerContent =
|
const cancelAndTimerContent =
|
||||||
showCancelAndTimer &&
|
showCancelAndTimer &&
|
||||||
|
|||||||
Reference in New Issue
Block a user