fix(gemini): trim "data:" prefix in raw JSON and resolve variable shadowing in stream translation

This commit is contained in:
Luis Pater
2025-09-23 21:22:41 +08:00
parent 361a69f4de
commit b018072914
2 changed files with 6 additions and 2 deletions

View File

@@ -42,6 +42,10 @@ func ConvertGeminiResponseToOpenAI(_ context.Context, _ string, originalRequestR
}
}
if bytes.HasPrefix(rawJSON, []byte("data:")) {
rawJSON = bytes.TrimSpace(rawJSON[5:])
}
if bytes.Equal(rawJSON, []byte("[DONE]")) {
return []string{}
}