Fixed issues

This commit is contained in:
Jonas Widen 2025-03-16 19:10:02 +01:00
parent df304a280e
commit 0f0821d17c
2 changed files with 8 additions and 2 deletions

View File

@ -73,12 +73,18 @@ function M.get_response(prompt, context, callback)
local contents = create_contents(prompt, context) local contents = create_contents(prompt, context)
local payload = vim.json.encode({contents = contents}) local payload = vim.json.encode({contents = contents})
-- Fix URL construction
local url = string.format( local url = string.format(
config.options.api_url .. "?key=%s", config.options.api_url .. "?key=%s",
config.options.model, config.options.model,
api_key api_key
) )
-- Debug output
print("URL:", url)
print("Payload:", payload)
local request = http.Request.new(url, payload) local request = http.Request.new(url, payload)
request:execute(function(result, error) request:execute(function(result, error)
if error then if error then

View File

@ -1,8 +1,8 @@
local M = {} local M = {}
M.defaults = { M.defaults = {
model = "gemini-2.0-flash", model = "gemini-2.0-flash", -- Reverting back to the original model
api_url = "https://generativelanguage.googleapis.com/v1/models/%s:generateContent", api_url = "https://generativelanguage.googleapis.com/v1beta/models/%s/generateContent",
window = { window = {
width = function() return math.floor(vim.o.columns / 3) end, width = function() return math.floor(vim.o.columns / 3) end,
height = function() return vim.o.lines - 2 end, height = function() return vim.o.lines - 2 end,