Fixed issues

This commit is contained in:
Jonas Widen 2025-03-16 14:22:53 +01:00
parent fdf90a6bdb
commit 18b4d06508

View File

@ -29,20 +29,7 @@ local function make_request(prompt)
return nil return nil
end end
-- List models first to verify available options local model = "gemini-2.0-flash" -- Updated to an available model
local list_models_command = string.format(
"curl -s 'https://generativelanguage.googleapis.com/v1/models?key=%s'",
api_key
)
local models_result = vim.fn.system(list_models_command)
local success, models_data = pcall(vim.json.decode, models_result)
if success and models_data.models then
vim.notify("Available models: " .. vim.inspect(models_data.models), vim.log.levels.DEBUG)
end
local model = "gemini-1.0-pro" -- Updated model name
local payload = vim.json.encode({ local payload = vim.json.encode({
contents = { contents = {
{ {
@ -58,7 +45,6 @@ local function make_request(prompt)
-- Escape the payload for shell -- Escape the payload for shell
payload = vim.fn.shellescape(payload) payload = vim.fn.shellescape(payload)
-- Updated API endpoint URL with v1 path
local command = string.format( local command = string.format(
"curl -s -X POST " "curl -s -X POST "
.. "'https://generativelanguage.googleapis.com/v1/models/%s:generateContent?key=%s' " .. "'https://generativelanguage.googleapis.com/v1/models/%s:generateContent?key=%s' "