fix(gemini): correct misleading SAFETY comment — partial SSE content is unavoidable

The comment claimed "leave no text content" but any text chunks streamed
before the SAFETY finish reason have already been emitted. Updated to
accurately describe the behavior.
This commit is contained in:
Chris Staley
2026-04-02 16:41:10 -06:00
parent 75daf98112
commit 50683e6600

View File

@@ -172,9 +172,9 @@ export function geminiToClaudeResponse(chunk, state) {
} else if (reason === "max_tokens" || reason === "length") {
stopReason = "max_tokens";
} else if (reason === "safety" || reason === "recitation" || reason === "blocklist") {
// Content was blocked by Gemini safety filters — map to end_turn but leave
// no text content so the client sees an empty response rather than silently
// appearing normal. The caller can inspect the raw finishReason if needed.
// Content blocked by Gemini safety. Any text streamed before this finish
// reason has already been emitted to the client — this is unavoidable in
// SSE streaming. Map to end_turn (Claude has no "content blocked" reason).
stopReason = "end_turn";
} else {
stopReason = "end_turn";