From 0f0821d17ce2d650d8557fa86a210fc001dfe9f5 Mon Sep 17 00:00:00 2001 From: Jonas Widen Date: Sun, 16 Mar 2025 19:10:02 +0100 Subject: [PATCH] Fixed issues --- lua/gemini/api.lua | 6 ++++++ lua/gemini/config.lua | 4 ++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/lua/gemini/api.lua b/lua/gemini/api.lua index f92e1c0..4e2cafa 100644 --- a/lua/gemini/api.lua +++ b/lua/gemini/api.lua @@ -73,12 +73,18 @@ function M.get_response(prompt, context, callback) local contents = create_contents(prompt, context) local payload = vim.json.encode({contents = contents}) + + -- Fix URL construction local url = string.format( config.options.api_url .. "?key=%s", config.options.model, api_key ) + -- Debug output + print("URL:", url) + print("Payload:", payload) + local request = http.Request.new(url, payload) request:execute(function(result, error) if error then diff --git a/lua/gemini/config.lua b/lua/gemini/config.lua index d0d1c41..12fb74f 100644 --- a/lua/gemini/config.lua +++ b/lua/gemini/config.lua @@ -1,8 +1,8 @@ local M = {} M.defaults = { - model = "gemini-2.0-flash", - api_url = "https://generativelanguage.googleapis.com/v1/models/%s:generateContent", + model = "gemini-2.0-flash", -- Reverting back to the original model + api_url = "https://generativelanguage.googleapis.com/v1beta/models/%s/generateContent", window = { width = function() return math.floor(vim.o.columns / 3) end, height = function() return vim.o.lines - 2 end,