Skip to content

fix: now reasoning output is rendered in the UI#29

Merged
wasaga merged 2 commits intomainfrom
nickytonline/reasoning-model-output
Jul 2, 2025
Merged

fix: now reasoning output is rendered in the UI#29
wasaga merged 2 commits intomainfrom
nickytonline/reasoning-model-output

Conversation

@nickytonline
Copy link
Copy Markdown
Member

@nickytonline nickytonline commented May 30, 2025

Now reasoning output is rendered in the UI. Currently all the chunks for a reasoning summary get flushed at the same time. We can probably stream those in.

Closes #16

Before

CleanShot 2025-07-02 at 15 14 22

After

CleanShot 2025-07-02 at 15 13 33

@nickytonline nickytonline force-pushed the nickytonline/reasoning-model-output branch from 079b6b1 to 42cb73b Compare May 30, 2025 03:09
@nickytonline nickytonline changed the title feat: now reasoning output is rendered in the UI fix: now reasoning output is rendered in the UI May 30, 2025
Comment thread src/routes/api/chat.ts
@nickytonline nickytonline requested a review from wasaga May 30, 2025 03:13
@nickytonline nickytonline marked this pull request as ready for review May 30, 2025 03:13
@nickytonline nickytonline requested a review from Copilot May 30, 2025 03:27
Copy link
Copy Markdown
Contributor

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 chat API to support streaming reasoning output and adjusts UI components to render that output progressively.

  • Enables streaming of reasoning output when the model starts with "o3"/"o4"
  • Buffers reasoning summary updates and flushes them upon completion
  • Replaces ReactMarkdown with a custom MarkdownContent component in chat-related UI components

Reviewed Changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
src/routes/api/chat.ts Adds reasoning configuration to API request based on model prefix
src/lib/streaming.ts Buffers and flushes reasoning summary text events in the stream
src/components/ReasoningMessage.tsx Creates a dedicated component to render reasoning messages
src/components/MarkdownContent.tsx Extracts markdown rendering into a reusable component
src/components/ChatMessage.tsx Replaces direct ReactMarkdown usage with MarkdownContent
src/components/Chat.tsx Incorporates streaming reasoning events into the chat UI

Comment thread src/lib/streaming.ts Outdated
Comment thread src/components/Chat.tsx Outdated
@nickytonline nickytonline force-pushed the nickytonline/reasoning-model-output branch 2 times, most recently from 1ff6422 to d60c113 Compare June 3, 2025 03:33
@nickytonline
Copy link
Copy Markdown
Member Author

This is good to go. Do you still get crashes with this @wasaga? I was never able to replicate this with the reported crashes.

Also, for

I think we might need to spawn this task with background: true, streaming: true, so that it could run in background - cause i think o3 for example has quotas that it may hit otherwise

it's already set to streaming: true, but do we still want to spawn this task with background: true or do that in a follow up PR?

@nickytonline nickytonline force-pushed the nickytonline/reasoning-model-output branch from d60c113 to 4c5b4f7 Compare June 13, 2025 22:19
@nickytonline nickytonline force-pushed the nickytonline/reasoning-model-output branch from 4c5b4f7 to 6eed40a Compare July 2, 2025 18:59
@netlify
Copy link
Copy Markdown

netlify Bot commented Jul 2, 2025

Deploy Preview for mcp-app-demo ready!

Name Link
🔨 Latest commit 6eed40a
🔍 Latest deploy log https://app.netlify.com/projects/mcp-app-demo/deploys/68658192b91cd4000837ad7f
😎 Deploy Preview https://deploy-preview-29--mcp-app-demo.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@wasaga wasaga merged commit 616f48d into main Jul 2, 2025
6 checks passed
@wasaga wasaga deleted the nickytonline/reasoning-model-output branch July 2, 2025 19:18
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.

reasoning models output are not supported

3 participants