Update PassthroughGeminiResponseStream to handle [DONE] marker

- Added logic to return an empty slice when the raw JSON equals the `[DONE]` marker.
- Ensures proper termination of streamed Gemini responses.
This commit is contained in:
Luis Pater
2025-09-01 02:00:55 +08:00
parent 6d30faf9c9
commit bdac24bb4e

View File

@@ -1,11 +1,15 @@
package gemini
import (
"bytes"
"context"
)
// PassthroughGeminiResponseStream forwards Gemini responses unchanged.
func PassthroughGeminiResponseStream(_ context.Context, _ string, rawJSON []byte, _ *any) []string {
if bytes.Equal(rawJSON, []byte("[DONE]")) {
return []string{}
}
return []string{string(rawJSON)}
}