fix: hide thinking indicator for empty thinking content (#11874)

fix: hide thinking indicator when thinking content is empty

Check that resolved thinking content has non-whitespace characters
before rendering the ThinkingBlockPeek component, preventing empty
or whitespace-only thinking blocks from showing in the chat UI.
This commit is contained in:
Dallin Romney 2026-03-25 20:31:44 -07:00 • committed by GitHub
parent e8c88f416f
commit af4563b7b1
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 6 additions and 2 deletions

View file

@ -85,7 +85,7 @@ export default function StepContainer(props: StepContainerProps) {
</pre>
) : (
<>
{props.item.reasoning?.text && (
{props.item.reasoning?.text?.trim() && (
<ThinkingBlockPeek
content={props.item.reasoning.text}
index={props.index}

View file

@ -393,10 +393,14 @@ export function Chat() {
}
if (message.role === "thinking") {
const thinkingContent = renderChatMessage(message);
if (!thinkingContent?.trim()) {
return null;
}
return (
<div className={isBeforeLatestSummary ? "opacity-50" : ""}>
<ThinkingBlockPeek
content={renderChatMessage(message)}
content={thinkingContent}
redactedThinking={message.redactedThinking}
index={index}
prevItem={index > 0 ? history[index - 1] : null}