on main help sign in
fix(gemini): add baseURL resolution and conditional HTTPOptions configuration (#1144)
baf0534daniel
internal/llm/provider/gemini.go+9−4
@@ -43,9 +43,14 @@ func createGeminiClient(opts providerClientOptions) (*genai.Client, error) {
43 cc := &genai.ClientConfig{
43 cc := &genai.ClientConfig{
44 APIKey: opts.apiKey,
44 APIKey: opts.apiKey,
45 Backend: genai.BackendGeminiAPI,
45 Backend: genai.BackendGeminiAPI,
46+ }
47+ if opts.baseURL != "" {
48+ resolvedBaseURL, err := config.Get().Resolve(opts.baseURL)
49+ if err == nil && resolvedBaseURL != "" {
46− HTTPOptions: genai.HTTPOptions{
50+ cc.HTTPOptions = genai.HTTPOptions{
47− BaseURL: opts.baseURL,
51+ BaseURL: resolvedBaseURL,
52+ }
48− },
53+ }
49 }
54 }
50 if config.Get().Options.Debug {
55 if config.Get().Options.Debug {
51 cc.HTTPClient = log.NewHTTPClient()
56 cc.HTTPClient = log.NewHTTPClient()
@@ -572,4 +577,4 @@ func contains(s string, substrs ...string) bool {
572 }
577 }
573 }
578 }
574 return false
579 return false
575−}
580+}