diff --git a/lua/gemini/api.lua b/lua/gemini/api.lua index 4e2cafa..d38e8cb 100644 --- a/lua/gemini/api.lua +++ b/lua/gemini/api.lua @@ -74,7 +74,7 @@ function M.get_response(prompt, context, callback) local contents = create_contents(prompt, context) local payload = vim.json.encode({contents = contents}) - -- Fix URL construction + -- Fix URL construction - properly format the URL with model and API key local url = string.format( config.options.api_url .. "?key=%s", config.options.model, @@ -88,6 +88,9 @@ function M.get_response(prompt, context, callback) local request = http.Request.new(url, payload) request:execute(function(result, error) if error then + vim.schedule(function() + print("Error:", error) -- Add more debug output + end) callback(nil, error) return end