mirror of
https://github.com/CJackHwang/ds2api.git
synced 2026-05-10 19:27:41 +08:00
chore: update project files
This commit is contained in:
@@ -22,6 +22,9 @@ func normalizeGeminiRequest(store ConfigReader, routeModel string, req map[strin
|
||||
}
|
||||
defaultThinkingEnabled, searchEnabled, _ := config.GetModelConfig(resolvedModel)
|
||||
thinkingEnabled := util.ResolveThinkingEnabled(req, defaultThinkingEnabled)
|
||||
if config.IsNoThinkingModel(resolvedModel) {
|
||||
thinkingEnabled = false
|
||||
}
|
||||
|
||||
messagesRaw := geminiMessagesFromRequest(req)
|
||||
if len(messagesRaw) == 0 {
|
||||
|
||||
28
internal/httpapi/gemini/convert_request_test.go
Normal file
28
internal/httpapi/gemini/convert_request_test.go
Normal file
@@ -0,0 +1,28 @@
|
||||
package gemini
|
||||
|
||||
import "testing"
|
||||
|
||||
func TestNormalizeGeminiRequestNoThinkingModelForcesThinkingOff(t *testing.T) {
|
||||
req := map[string]any{
|
||||
"contents": []any{
|
||||
map[string]any{
|
||||
"role": "user",
|
||||
"parts": []any{map[string]any{"text": "hello"}},
|
||||
},
|
||||
},
|
||||
"reasoning_effort": "high",
|
||||
}
|
||||
out, err := normalizeGeminiRequest(testGeminiConfig{}, "gemini-2.5-pro-nothinking", req, false)
|
||||
if err != nil {
|
||||
t.Fatalf("normalizeGeminiRequest error: %v", err)
|
||||
}
|
||||
if out.ResolvedModel != "deepseek-v4-pro-nothinking" {
|
||||
t.Fatalf("resolved model mismatch: got=%q", out.ResolvedModel)
|
||||
}
|
||||
if out.Thinking {
|
||||
t.Fatalf("expected nothinking model to force thinking off")
|
||||
}
|
||||
if out.Search {
|
||||
t.Fatalf("expected search=false, got=%v", out.Search)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user