Skip to content

Conversation

@connorabbas
Copy link

@connorabbas connorabbas commented Aug 23, 2025

About

Previously, the stream() controller method relied on the client to send the full conversation history back to the server for both authenticated and guest users. On each authenticated request (Chat exists), the server would re-save any messages without an id. With this design if a user had an existing chat and refreshed the page, the client re-sent all messages from state. The backend then persisted those messages again, resulting in duplicated messages being stored in the database.

This PR makes the database the source of truth for chat history of authenticated users, while still allowing the full message context to be sent for guests/anonymous chats.

Demo

Before

larachat_bug_pr.mp4

After

larachat_fixed.mp4

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