mirror of
https://github.com/google-gemini/gemini-cli.git
synced 2026-05-03 00:14:28 -07:00
Stop suppressing thoughts and text in model response (#25073)
This commit is contained in:
committed by
GitHub
parent
26f04c9d9a
commit
a5f7b453ca
@@ -50,7 +50,6 @@ interface HistoryItemDisplayProps {
|
|||||||
isFirstThinking?: boolean;
|
isFirstThinking?: boolean;
|
||||||
isFirstAfterThinking?: boolean;
|
isFirstAfterThinking?: boolean;
|
||||||
isToolGroupBoundary?: boolean;
|
isToolGroupBoundary?: boolean;
|
||||||
suppressNarration?: boolean;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export const HistoryItemDisplay: React.FC<HistoryItemDisplayProps> = ({
|
export const HistoryItemDisplay: React.FC<HistoryItemDisplayProps> = ({
|
||||||
@@ -64,7 +63,6 @@ export const HistoryItemDisplay: React.FC<HistoryItemDisplayProps> = ({
|
|||||||
isFirstThinking = false,
|
isFirstThinking = false,
|
||||||
isFirstAfterThinking = false,
|
isFirstAfterThinking = false,
|
||||||
isToolGroupBoundary = false,
|
isToolGroupBoundary = false,
|
||||||
suppressNarration = false,
|
|
||||||
}) => {
|
}) => {
|
||||||
const settings = useSettings();
|
const settings = useSettings();
|
||||||
const inlineThinkingMode = getInlineThinkingMode(settings);
|
const inlineThinkingMode = getInlineThinkingMode(settings);
|
||||||
@@ -75,17 +73,6 @@ export const HistoryItemDisplay: React.FC<HistoryItemDisplayProps> = ({
|
|||||||
isToolGroupBoundary
|
isToolGroupBoundary
|
||||||
);
|
);
|
||||||
|
|
||||||
// If there's a topic update in this turn, we suppress the regular narration
|
|
||||||
// and thoughts as they are being "replaced" by the update_topic tool.
|
|
||||||
if (
|
|
||||||
suppressNarration &&
|
|
||||||
(itemForDisplay.type === 'thinking' ||
|
|
||||||
itemForDisplay.type === 'gemini' ||
|
|
||||||
itemForDisplay.type === 'gemini_content')
|
|
||||||
) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Box
|
<Box
|
||||||
flexDirection="column"
|
flexDirection="column"
|
||||||
@@ -205,7 +192,6 @@ export const HistoryItemDisplay: React.FC<HistoryItemDisplayProps> = ({
|
|||||||
borderTop={itemForDisplay.borderTop}
|
borderTop={itemForDisplay.borderTop}
|
||||||
borderBottom={itemForDisplay.borderBottom}
|
borderBottom={itemForDisplay.borderBottom}
|
||||||
isExpandable={isExpandable}
|
isExpandable={isExpandable}
|
||||||
isToolGroupBoundary={isToolGroupBoundary}
|
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
{itemForDisplay.type === 'subagent' && (
|
{itemForDisplay.type === 'subagent' && (
|
||||||
|
|||||||
@@ -7,7 +7,6 @@
|
|||||||
import { Box, Static } from 'ink';
|
import { Box, Static } from 'ink';
|
||||||
import { HistoryItemDisplay } from './HistoryItemDisplay.js';
|
import { HistoryItemDisplay } from './HistoryItemDisplay.js';
|
||||||
import { useUIState } from '../contexts/UIStateContext.js';
|
import { useUIState } from '../contexts/UIStateContext.js';
|
||||||
import { useSettings } from '../contexts/SettingsContext.js';
|
|
||||||
import { useAppContext } from '../contexts/AppContext.js';
|
import { useAppContext } from '../contexts/AppContext.js';
|
||||||
import { AppHeader } from './AppHeader.js';
|
import { AppHeader } from './AppHeader.js';
|
||||||
|
|
||||||
@@ -22,7 +21,6 @@ import { useMemo, memo, useCallback, useEffect, useRef } from 'react';
|
|||||||
import { MAX_GEMINI_MESSAGE_LINES } from '../constants.js';
|
import { MAX_GEMINI_MESSAGE_LINES } from '../constants.js';
|
||||||
import { useConfirmingTool } from '../hooks/useConfirmingTool.js';
|
import { useConfirmingTool } from '../hooks/useConfirmingTool.js';
|
||||||
import { ToolConfirmationQueue } from './ToolConfirmationQueue.js';
|
import { ToolConfirmationQueue } from './ToolConfirmationQueue.js';
|
||||||
import { isTopicTool } from './messages/TopicMessage.js';
|
|
||||||
import { appEvents, AppEvent } from '../../utils/events.js';
|
import { appEvents, AppEvent } from '../../utils/events.js';
|
||||||
|
|
||||||
const MemoizedHistoryItemDisplay = memo(HistoryItemDisplay);
|
const MemoizedHistoryItemDisplay = memo(HistoryItemDisplay);
|
||||||
@@ -82,35 +80,6 @@ export const MainContent = () => {
|
|||||||
return -1;
|
return -1;
|
||||||
}, [uiState.history]);
|
}, [uiState.history]);
|
||||||
|
|
||||||
const settings = useSettings();
|
|
||||||
const topicUpdateNarrationEnabled =
|
|
||||||
settings.merged.experimental?.topicUpdateNarration === true;
|
|
||||||
|
|
||||||
const suppressNarrationFlags = useMemo(() => {
|
|
||||||
const combinedHistory = [...uiState.history, ...pendingHistoryItems];
|
|
||||||
const flags = new Array<boolean>(combinedHistory.length).fill(false);
|
|
||||||
|
|
||||||
if (topicUpdateNarrationEnabled) {
|
|
||||||
let toolGroupInTurn = false;
|
|
||||||
for (let i = combinedHistory.length - 1; i >= 0; i--) {
|
|
||||||
const item = combinedHistory[i];
|
|
||||||
if (item.type === 'user' || item.type === 'user_shell') {
|
|
||||||
toolGroupInTurn = false;
|
|
||||||
} else if (item.type === 'tool_group') {
|
|
||||||
toolGroupInTurn = item.tools.some((t) => isTopicTool(t.name));
|
|
||||||
} else if (
|
|
||||||
(item.type === 'thinking' ||
|
|
||||||
item.type === 'gemini' ||
|
|
||||||
item.type === 'gemini_content') &&
|
|
||||||
toolGroupInTurn
|
|
||||||
) {
|
|
||||||
flags[i] = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return flags;
|
|
||||||
}, [uiState.history, pendingHistoryItems, topicUpdateNarrationEnabled]);
|
|
||||||
|
|
||||||
const augmentedHistory = useMemo(
|
const augmentedHistory = useMemo(
|
||||||
() =>
|
() =>
|
||||||
uiState.history.map((item, i) => {
|
uiState.history.map((item, i) => {
|
||||||
@@ -129,10 +98,9 @@ export const MainContent = () => {
|
|||||||
isFirstThinking,
|
isFirstThinking,
|
||||||
isFirstAfterThinking,
|
isFirstAfterThinking,
|
||||||
isToolGroupBoundary,
|
isToolGroupBoundary,
|
||||||
suppressNarration: suppressNarrationFlags[i] ?? false,
|
|
||||||
};
|
};
|
||||||
}),
|
}),
|
||||||
[uiState.history, lastUserPromptIndex, suppressNarrationFlags],
|
[uiState.history, lastUserPromptIndex],
|
||||||
);
|
);
|
||||||
|
|
||||||
const historyItems = useMemo(
|
const historyItems = useMemo(
|
||||||
@@ -144,7 +112,6 @@ export const MainContent = () => {
|
|||||||
isFirstThinking,
|
isFirstThinking,
|
||||||
isFirstAfterThinking,
|
isFirstAfterThinking,
|
||||||
isToolGroupBoundary,
|
isToolGroupBoundary,
|
||||||
suppressNarration,
|
|
||||||
}) => (
|
}) => (
|
||||||
<MemoizedHistoryItemDisplay
|
<MemoizedHistoryItemDisplay
|
||||||
terminalWidth={mainAreaWidth}
|
terminalWidth={mainAreaWidth}
|
||||||
@@ -162,7 +129,6 @@ export const MainContent = () => {
|
|||||||
isFirstThinking={isFirstThinking}
|
isFirstThinking={isFirstThinking}
|
||||||
isFirstAfterThinking={isFirstAfterThinking}
|
isFirstAfterThinking={isFirstAfterThinking}
|
||||||
isToolGroupBoundary={isToolGroupBoundary}
|
isToolGroupBoundary={isToolGroupBoundary}
|
||||||
suppressNarration={suppressNarration}
|
|
||||||
/>
|
/>
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@@ -201,9 +167,6 @@ export const MainContent = () => {
|
|||||||
(item.type !== 'tool_group' && prevType === 'tool_group') ||
|
(item.type !== 'tool_group' && prevType === 'tool_group') ||
|
||||||
(item.type === 'tool_group' && prevType !== 'tool_group');
|
(item.type === 'tool_group' && prevType !== 'tool_group');
|
||||||
|
|
||||||
const suppressNarration =
|
|
||||||
suppressNarrationFlags[uiState.history.length + i] ?? false;
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<HistoryItemDisplay
|
<HistoryItemDisplay
|
||||||
key={`pending-${i}`}
|
key={`pending-${i}`}
|
||||||
@@ -217,7 +180,6 @@ export const MainContent = () => {
|
|||||||
isFirstThinking={isFirstThinking}
|
isFirstThinking={isFirstThinking}
|
||||||
isFirstAfterThinking={isFirstAfterThinking}
|
isFirstAfterThinking={isFirstAfterThinking}
|
||||||
isToolGroupBoundary={isToolGroupBoundary}
|
isToolGroupBoundary={isToolGroupBoundary}
|
||||||
suppressNarration={suppressNarration}
|
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
})}
|
})}
|
||||||
@@ -237,7 +199,6 @@ export const MainContent = () => {
|
|||||||
showConfirmationQueue,
|
showConfirmationQueue,
|
||||||
confirmingTool,
|
confirmingTool,
|
||||||
uiState.history,
|
uiState.history,
|
||||||
suppressNarrationFlags,
|
|
||||||
],
|
],
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|||||||
@@ -102,7 +102,6 @@ interface ToolGroupMessageProps {
|
|||||||
borderTop?: boolean;
|
borderTop?: boolean;
|
||||||
borderBottom?: boolean;
|
borderBottom?: boolean;
|
||||||
isExpandable?: boolean;
|
isExpandable?: boolean;
|
||||||
isToolGroupBoundary?: boolean;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Main component renders the border and maps the tools using ToolMessage
|
// Main component renders the border and maps the tools using ToolMessage
|
||||||
@@ -116,7 +115,6 @@ export const ToolGroupMessage: React.FC<ToolGroupMessageProps> = ({
|
|||||||
borderTop: borderTopOverride,
|
borderTop: borderTopOverride,
|
||||||
borderBottom: borderBottomOverride,
|
borderBottom: borderBottomOverride,
|
||||||
isExpandable,
|
isExpandable,
|
||||||
isToolGroupBoundary,
|
|
||||||
}) => {
|
}) => {
|
||||||
const settings = useSettings();
|
const settings = useSettings();
|
||||||
const isLowErrorVerbosity = settings.merged.ui?.errorVerbosity !== 'full';
|
const isLowErrorVerbosity = settings.merged.ui?.errorVerbosity !== 'full';
|
||||||
@@ -248,11 +246,11 @@ export const ToolGroupMessage: React.FC<ToolGroupMessageProps> = ({
|
|||||||
(showClosingBorder ? 1 : 0);
|
(showClosingBorder ? 1 : 0);
|
||||||
} else if (isTopicToolCall) {
|
} else if (isTopicToolCall) {
|
||||||
// Topic Message Spacing Breakdown:
|
// Topic Message Spacing Breakdown:
|
||||||
// 1. Top Margin (1): Present unless it's the very first item following a boundary.
|
// 1. Top Margin (1): Always present for spacing.
|
||||||
// 2. Topic Content (1).
|
// 2. Topic Content (1).
|
||||||
// 3. Bottom Margin (1): Always present around TopicMessage for breathing room.
|
// 3. Bottom Margin (1): Always present around TopicMessage for breathing room.
|
||||||
const hasTopMargin = !(isFirst && isToolGroupBoundary);
|
// 4. Closing Border (1): Added if transition logic (showClosingBorder) requires it.
|
||||||
height += (hasTopMargin ? 1 : 0) + 1 + 1;
|
height += 1 + 1 + 1 + (showClosingBorder ? 1 : 0);
|
||||||
} else if (isCompact) {
|
} else if (isCompact) {
|
||||||
// Compact Tool: Always renders as a single dense line.
|
// Compact Tool: Always renders as a single dense line.
|
||||||
height += 1;
|
height += 1;
|
||||||
@@ -273,12 +271,7 @@ export const ToolGroupMessage: React.FC<ToolGroupMessageProps> = ({
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
return height;
|
return height;
|
||||||
}, [
|
}, [groupedTools, isCompactModeEnabled, borderTopOverride]);
|
||||||
groupedTools,
|
|
||||||
isCompactModeEnabled,
|
|
||||||
borderTopOverride,
|
|
||||||
isToolGroupBoundary,
|
|
||||||
]);
|
|
||||||
|
|
||||||
let countToolCallsWithResults = 0;
|
let countToolCallsWithResults = 0;
|
||||||
for (const tool of visibleToolCalls) {
|
for (const tool of visibleToolCalls) {
|
||||||
@@ -446,10 +439,7 @@ export const ToolGroupMessage: React.FC<ToolGroupMessageProps> = ({
|
|||||||
{isCompact ? (
|
{isCompact ? (
|
||||||
<DenseToolMessage {...commonProps} />
|
<DenseToolMessage {...commonProps} />
|
||||||
) : isTopicToolCall ? (
|
) : isTopicToolCall ? (
|
||||||
<Box
|
<Box marginTop={1} marginBottom={1}>
|
||||||
marginTop={isFirst && isToolGroupBoundary ? 0 : 1}
|
|
||||||
marginBottom={1}
|
|
||||||
>
|
|
||||||
<TopicMessage {...commonProps} />
|
<TopicMessage {...commonProps} />
|
||||||
</Box>
|
</Box>
|
||||||
) : isShellToolCall ? (
|
) : isShellToolCall ? (
|
||||||
|
|||||||
Reference in New Issue
Block a user