Skip to content

Render MessageReasoning only if text is present #1082

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jul 5, 2025
Merged

Conversation

haydenbleasel
Copy link
Contributor

Updated the condition to render the MessageReasoning component only when the part type is 'reasoning' and part.text exists. This prevents rendering empty reasoning components.

Updated the condition to render the MessageReasoning component only when the part type is 'reasoning' and part.text exists. This prevents rendering empty reasoning components.
Copy link

vercel bot commented Jul 5, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
ai-chatbot ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jul 5, 2025 8:47am

Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR updates the rendering logic for the MessageReasoning component so it only appears when the message part is of type reasoning and actually contains text.

  • Added an extra part.text check to prevent empty reasoning blocks from rendering.
Comments suppressed due to low confidence (1)

components/message.tsx:106

  • Add a unit test to verify that MessageReasoning is not rendered when part.text is empty, undefined, or only whitespace to prevent regressions in rendering logic.
              if (type === 'reasoning' && part.text) {

@haydenbleasel haydenbleasel merged commit a54dca0 into main Jul 5, 2025
5 checks passed
@haydenbleasel haydenbleasel deleted the patch-reasoning branch July 5, 2025 08:58
lemeb pushed a commit to lemeb/ai-chatbot that referenced this pull request Jul 14, 2025
lemeb pushed a commit to lemeb/ai-chatbot that referenced this pull request Jul 14, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant