{{ message }}
Repository navigation
Word chat request refusals from their stable error code - #931
Merged
Merged
Conversation
Signed-off-by: dada-yan <BinjunYann@gmail.com>
WaylandYang
approved these changes
Sep 26, 2026
WaylandYang
left a comment
Contributor
There was a problem hiding this comment.
One wording function shared by request() and the stream, so a refusal with a code reads the same everywhere and the server keeps speaking English (0004). The three cases pin the code, the fallback and the detail. Merging.
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.

Problem
When a chat request is refused, for example because no chat model is configured, the chat view shows the server's English sentence even in the Chinese interface.
S.errhas a translation for that code (no_chat_model), but it is never used here.Cause
Every other request goes through
request(). It looks the refusal'scodeup inS.errand falls back to the server's sentence (ADR 0004: the server always speaks English, and the wording belongs to the client). The chat stream reads its refusals inconsumeChatStream, which only tookerror.Change
The code lookup moves out of
request()intorefusalMessage, andconsumeChatStreamuses it too, for bothstreamChatandreattachChat.request()behaves as before.Verification
Run in containers on a Linux host (Node 20).
Three new cases in
src/chatStream.test.ts:code: "no_chat_model"is worded fromS.err.detailis kept beside the wording.On
dev(b3919ca) with only the new cases added, the first and third fail and the second passes, as it should.With this change,
pnpm test(138 passed) andpnpm buildpass.Limits
An error that arrives after the stream has started (an
errorframe) is still a plain English sentence without a code. Wording those needs a code on the frame, and that is left for a separate change.