mirror of
https://github.com/router-for-me/CLIProxyAPI.git
synced 2026-02-03 04:50:52 +08:00
- Added `examples/custom-provider/main.go` showcasing custom executor and translator integration using the SDK. - Removed redundant debug logs from translator modules to enhance code cleanliness. - Updated SDK documentation with new usage and advanced examples. - Expanded the management API with new endpoints, including request logging and GPT-5 Codex features.
27 lines
738 B
Go
27 lines
738 B
Go
package gemini
|
|
|
|
import (
|
|
"bytes"
|
|
"context"
|
|
|
|
log "github.com/sirupsen/logrus"
|
|
)
|
|
|
|
// PassthroughGeminiResponseStream forwards Gemini responses unchanged.
|
|
func PassthroughGeminiResponseStream(_ context.Context, _ string, originalRequestRawJSON, requestRawJSON, rawJSON []byte, _ *any) []string {
|
|
if bytes.HasPrefix(rawJSON, []byte("data:")) {
|
|
rawJSON = bytes.TrimSpace(rawJSON[5:])
|
|
}
|
|
|
|
if bytes.Equal(rawJSON, []byte("[DONE]")) {
|
|
return []string{}
|
|
}
|
|
|
|
return []string{string(rawJSON)}
|
|
}
|
|
|
|
// PassthroughGeminiResponseNonStream forwards Gemini responses unchanged.
|
|
func PassthroughGeminiResponseNonStream(_ context.Context, _ string, originalRequestRawJSON, requestRawJSON, rawJSON []byte, _ *any) string {
|
|
return string(rawJSON)
|
|
}
|