mirror of
https://github.com/Nezumi-2711/9router.git
synced 2026-09-22 20:00:47 +00:00
fix(gemini): backfill thoughtSignature and suppress stream done sentinel
Backfill DEFAULT_THINKING_AG_SIGNATURE onto functionCall parts missing it (client history replay) and on Claude tool_use blocks, fixing 400 INVALID_ARGUMENT from Gemini-family APIs. Suppress the OpenAI-style data: [DONE] sentinel for antigravity/gemini/vertex to avoid parser crashes. Fixes #2193. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
committed by
decolua
co-authored by
Cursor
parent
319caa2d7b
commit
2d94fffe3b
@@ -350,7 +350,9 @@ export function createSSEStream(options = {}) {
|
||||
// Some clients (e.g. OpenClaw) expect the OpenAI-style sentinel:
|
||||
// data: [DONE]\n\n
|
||||
// Without it they can hang until timeout and trigger failover.
|
||||
if (!streamDoneSent) {
|
||||
// Gemini-family clients (Antigravity, Vertex, Gemini) reject this sentinel with 400 syntax errors.
|
||||
const isGeminiFamily = provider === "antigravity" || provider === "gemini" || provider === "vertex";
|
||||
if (!streamDoneSent && !isGeminiFamily) {
|
||||
const doneOutput = "data: [DONE]\n\n";
|
||||
reqLogger?.appendConvertedChunk?.(doneOutput);
|
||||
controller.enqueue(sharedEncoder.encode(doneOutput));
|
||||
|
||||
Reference in New Issue
Block a user