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:
@@ -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