fix: surface real chat errors and add a New Chat button#59
Open
madhavcodez wants to merge 1 commit intomainfrom
Open
fix: surface real chat errors and add a New Chat button#59madhavcodez wants to merge 1 commit intomainfrom
madhavcodez wants to merge 1 commit intomainfrom
Conversation
Replace the silent mock fallback with an in-thread agent message reading "Unable to reach the chat service. Please try again later." for real backend failures. Read Retry-After on 503 responses, parse it as an integer, and only append "(retry after Ns)" when it falls within 1 to 3600 seconds so malformed headers never reach the UI. Add a pencil-in-square New Chat icon in the chat header that resets the active conversation. The handler also clears isThinking, inflightCountRef, and suppressMockRef so a new thread cannot inherit a stuck thinking indicator from an in-flight request. Closes #41 Closes #55
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What this does
Stops the chat from silently lying when the backend is down, and gives users a way to start a fresh conversation without refreshing the page.
Error messages, not fake mock replies
Before this PR, any backend 5xx caused the chat to fall back to mock responses — in a demo context that looks like the product is working when it isn't. Now, real failures surface as an in-thread agent message: "Unable to reach the chat service. Please try again later." If the backend sent a
Retry-Afterheader on a 503, we parse it safely (integer, clamped to 1–3600 seconds) and append(retry after Ns)so users know when to try again.New Chat button
A pencil-in-square icon in the chat header spawns a fresh conversation instantly. The handler also clears
isThinking,inflightCountRef, andsuppressMockRefso a new thread can't inherit a stuck "thinking..." indicator from a request still in flight.How to verify
docker compose stop postgisor Ctrl+C uvicorn), send a message → see the error message, NOT a fake responseCloses #41
Closes #55