mirror of
https://github.com/router-for-me/CLIProxyAPI.git
synced 2026-02-19 04:40:52 +08:00
Add Gemini-to-Gemini request normalization and passthrough support
- Introduced a `ConvertGeminiRequestToGemini` function to normalize Gemini v1beta requests by ensuring valid or default roles. - Added passthrough response handlers for both streamed and non-streamed Gemini responses. - Registered translators for Gemini-to-Gemini traffic in the initialization process. - Updated `gemini-cli` request normalization to align with the new Gemini translator logic.
This commit is contained in:
15
internal/translator/gemini/gemini/gemini_gemini_response.go
Normal file
15
internal/translator/gemini/gemini/gemini_gemini_response.go
Normal file
@@ -0,0 +1,15 @@
|
||||
package gemini
|
||||
|
||||
import (
|
||||
"context"
|
||||
)
|
||||
|
||||
// PassthroughGeminiResponseStream forwards Gemini responses unchanged.
|
||||
func PassthroughGeminiResponseStream(_ context.Context, _ string, rawJSON []byte, _ *any) []string {
|
||||
return []string{string(rawJSON)}
|
||||
}
|
||||
|
||||
// PassthroughGeminiResponseNonStream forwards Gemini responses unchanged.
|
||||
func PassthroughGeminiResponseNonStream(_ context.Context, _ string, rawJSON []byte, _ *any) string {
|
||||
return string(rawJSON)
|
||||
}
|
||||
Reference in New Issue
Block a user