mirror of
https://github.com/router-for-me/CLIProxyAPI.git
synced 2026-02-18 20:30:51 +08:00
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:
@@ -1,11 +1,15 @@
|
|||||||
package gemini
|
package gemini
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"bytes"
|
||||||
"context"
|
"context"
|
||||||
)
|
)
|
||||||
|
|
||||||
// PassthroughGeminiResponseStream forwards Gemini responses unchanged.
|
// PassthroughGeminiResponseStream forwards Gemini responses unchanged.
|
||||||
func PassthroughGeminiResponseStream(_ context.Context, _ string, rawJSON []byte, _ *any) []string {
|
func PassthroughGeminiResponseStream(_ context.Context, _ string, rawJSON []byte, _ *any) []string {
|
||||||
|
if bytes.Equal(rawJSON, []byte("[DONE]")) {
|
||||||
|
return []string{}
|
||||||
|
}
|
||||||
return []string{string(rawJSON)}
|
return []string{string(rawJSON)}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user