feat(cli): overhaul thinking UI (#18725)

This commit is contained in:
Keith Guerin
2026-03-06 20:20:27 -08:00
committed by GitHub
parent 9455ecd78c
commit e5d58c2b5a
29 changed files with 763 additions and 184 deletions
@@ -2824,7 +2824,6 @@ describe('useGeminiStream', () => {
type: 'thinking',
thought: expect.objectContaining({ subject: 'Full thought' }),
}),
expect.any(Number),
);
});
+5 -8
View File
@@ -905,17 +905,14 @@ export const useGeminiStream = (
);
const handleThoughtEvent = useCallback(
(eventValue: ThoughtSummary, userMessageTimestamp: number) => {
(eventValue: ThoughtSummary, _userMessageTimestamp: number) => {
setThought(eventValue);
if (getInlineThinkingMode(settings) === 'full') {
addItem(
{
type: 'thinking',
thought: eventValue,
} as HistoryItemThinking,
userMessageTimestamp,
);
addItem({
type: 'thinking',
thought: eventValue,
} as HistoryItemThinking);
}
},
[addItem, settings, setThought],
@@ -190,6 +190,37 @@ describe('convertSessionToHistoryFormats', () => {
});
});
it('should convert thinking tokens (thoughts) to thinking history items', () => {
const messages: MessageRecord[] = [
{
type: 'gemini',
content: 'Hi there',
thoughts: [
{
subject: 'Thinking...',
description: 'I should say hello.',
timestamp: new Date().toISOString(),
},
],
} as MessageRecord,
];
const result = convertSessionToHistoryFormats(messages);
expect(result.uiHistory).toHaveLength(2);
expect(result.uiHistory[0]).toMatchObject({
type: 'thinking',
thought: {
subject: 'Thinking...',
description: 'I should say hello.',
},
});
expect(result.uiHistory[1]).toMatchObject({
type: 'gemini',
text: 'Hi there',
});
});
it('should prioritize displayContent for UI history but use content for client history', () => {
const messages: MessageRecord[] = [
{