Skip to content

Conversation

nickytonline
Copy link
Member

@nickytonline nickytonline commented Oct 10, 2025

Summary

This PR fixes the issue where user and assistant messages were not being properly sent to the chat API, ensuring correct message handling and conversation flow. Prior to this fix, since only user messages were sent to the chat api, the llm answered previously answered questions.

Related Issues

Fixes #166

@Copilot Copilot AI review requested due to automatic review settings October 10, 2025 19:37
Copy link

netlify bot commented Oct 10, 2025

Deploy Preview for mcp-storybook ready!

Name Link
🔨 Latest commit 2126087
🔍 Latest deploy log https://app.netlify.com/projects/mcp-storybook/deploys/68e96093f8023100087eff47
😎 Deploy Preview https://deploy-preview-167--mcp-storybook.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.

@nickytonline nickytonline requested a review from wasaga October 10, 2025 19:38
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 fixes a critical bug in the chat component where user and assistant messages were not being properly synchronized with the chat API's message state. The fix ensures that both streaming assistant responses and user messages are correctly maintained in the chat history.

Key changes:

  • Added proper message synchronization logic using useEffect to merge assistant messages from the stream buffer into the main messages array
  • Implemented duplicate message prevention using a ref-based tracking system
  • Enhanced the render logic to display both persisted messages and streaming content

@nickytonline nickytonline changed the title Fix: User and assistant messages now properly sent to chat API fix: user and assistant messages now properly sent to chat API Oct 10, 2025
@nickytonline nickytonline enabled auto-merge (squash) October 10, 2025 20:02
@nickytonline nickytonline marked this pull request as draft October 12, 2025 03:17
auto-merge was automatically disabled October 12, 2025 03:17

Pull request was converted to draft

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.

Fix: User and assistant messages now properly sent to chat API

2 participants