fix: address review feedback - proper provider check and proxy support

This commit is contained in:
Ashish Sharma 2026-02-20 19:14:24 +05:30
parent 032f107935
commit 597115817d

View file

@ -178,6 +178,11 @@ func (p *HTTPProvider) parseResponse(body []byte) (*LLMResponse, error) {
}
}
// Fix: skip tool calls with empty names to avoid downstream errors
if name == "" {
continue
}
toolCalls = append(toolCalls, ToolCall{
ID: tc.ID,
Name: name,
@ -285,7 +290,8 @@ func CreateProvider(cfg *config.Config) (LLMProvider, error) {
apiKey = cfg.Providers.Gemini.APIKey
apiBase = cfg.Providers.Gemini.APIBase
if apiBase == "" {
apiBase = "https://generativelanguage.googleapis.com/v1beta"
// Use OpenAI-compatible endpoint for tool calling support
apiBase = "https://generativelanguage.googleapis.com/v1beta/openai"
}
}
case "vllm":
@ -388,7 +394,8 @@ func CreateProvider(cfg *config.Config) (LLMProvider, error) {
apiBase = cfg.Providers.Gemini.APIBase
proxy = cfg.Providers.Gemini.Proxy
if apiBase == "" {
apiBase = "https://generativelanguage.googleapis.com/v1beta"
// Use OpenAI-compatible endpoint for tool calling support
apiBase = "https://generativelanguage.googleapis.com/v1beta/openai"
}
case (strings.Contains(lowerModel, "glm") || strings.Contains(lowerModel, "zhipu") || strings.Contains(lowerModel, "zai")) && cfg.Providers.Zhipu.APIKey != "":