feat: expose whether the llm is currently generating content (#1181)

This commit is contained in:
Thomas Müller 2025-02-11 04:35:28 +01:00 committed by GitHub
parent 63136fd92f
commit 8d82abe043
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -57,6 +57,7 @@ function Sidebar:new(id)
selected_files_container = nil,
input_container = nil,
file_selector = FileSelector:new(id),
is_generating = false,
}, { __index = self })
end
@ -1836,6 +1837,8 @@ function Sidebar:create_input_container(opts)
---@type AvanteLLMChunkCallback
local on_chunk = function(chunk)
self.is_generating = true
original_response = original_response .. chunk
local selected_files = self.file_selector:get_selected_files_contents()
@ -1870,6 +1873,8 @@ function Sidebar:create_input_container(opts)
---@type AvanteLLMStopCallback
local on_stop = function(stop_opts)
self.is_generating = false
pcall(function()
---remove keymaps
vim.keymap.del("n", "j", { buffer = self.result_container.bufnr })