mirror of
https://github.com/Nezumi-2711/9router.git
synced 2026-09-22 13:38:31 +00:00
fix: preserve forced streaming for json clients
Keep provider-required streaming when client prefers JSON. The Accept: application/json branch no longer flips stream back to false for forceStream providers, fixing 400 errors on stream-only providers (e.g. Command Code) for Hermes / Claude Code / other JSON clients. Fixes #2031 Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
committed by
decolua
co-authored by
Cursor
parent
4d9da5db26
commit
c842dc8f07
@@ -89,7 +89,7 @@ export async function handleChatCore({ body, modelInfo, credentials, log, onCred
|
||||
const acceptHeader = clientRawRequest?.headers?.accept || "";
|
||||
const clientPrefersJson = acceptHeader.includes("application/json");
|
||||
const clientPrefersSSE = acceptHeader.includes("text/event-stream");
|
||||
if (clientPrefersJson && !clientPrefersSSE && body.stream !== true) {
|
||||
if (clientPrefersJson && !clientPrefersSSE && body.stream !== true && !providerRequiresStreaming) {
|
||||
stream = false;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user