Open up windows direct

This commit is contained in:
Jonas Widen 2025-03-16 18:13:44 +01:00
parent 7456183630
commit 03502d4601

View File

@ -161,6 +161,10 @@ local function gemini_query(prompt, context)
-- Store the context for subsequent queries -- Store the context for subsequent queries
current_context = context current_context = context
-- Show initial message in chat window
local initial_content = "\nUser: " .. prompt .. "\n\nAssistant: Thinking..."
update_chat_window(initial_content)
local response = api.get_response(prompt, context) local response = api.get_response(prompt, context)
if response then if response then
local formatted_content = "\nUser: " .. prompt .. "\n\nAssistant: " .. response local formatted_content = "\nUser: " .. prompt .. "\n\nAssistant: " .. response
@ -174,6 +178,9 @@ local function gemini_query(prompt, context)
-- Clear the command line -- Clear the command line
vim.cmd('echo ""') vim.cmd('echo ""')
else else
-- Update the chat window with error message
local error_content = "\nUser: " .. prompt .. "\n\nAssistant: Failed to get response from Gemini API"
update_chat_window(error_content)
vim.notify("Failed to get a response from Gemini API", vim.log.levels.ERROR) vim.notify("Failed to get a response from Gemini API", vim.log.levels.ERROR)
end end
end end