fix(gemini): add baseURL resolution and conditional HTTPOptions configuration (#1144)

daniel created

Change summary

internal/llm/provider/gemini.go | 13 +++++++++----
1 file changed, 9 insertions(+), 4 deletions(-)

Detailed changes

internal/llm/provider/gemini.go 🔗

@@ -43,9 +43,14 @@ func createGeminiClient(opts providerClientOptions) (*genai.Client, error) {
 	cc := &genai.ClientConfig{
 		APIKey:  opts.apiKey,
 		Backend: genai.BackendGeminiAPI,
-		HTTPOptions: genai.HTTPOptions{
-			BaseURL: opts.baseURL,
-		},
+	}
+	if opts.baseURL != "" {
+		resolvedBaseURL, err := config.Get().Resolve(opts.baseURL)
+		if err == nil && resolvedBaseURL != "" {
+			cc.HTTPOptions = genai.HTTPOptions{
+				BaseURL: resolvedBaseURL,
+			}
+		}
 	}
 	if config.Get().Options.Debug {
 		cc.HTTPClient = log.NewHTTPClient()
@@ -572,4 +577,4 @@ func contains(s string, substrs ...string) bool {
 		}
 	}
 	return false
-}
+}