Skip to content

Commit 0e0dbe9

Browse files
authored
Merge pull request #67 from siemensikkema/only-stop-prompt-on-explicit-stop-command
Only stop prompt on explicit stop command
2 parents dac36a9 + e62ce2b commit 0e0dbe9

2 files changed

Lines changed: 6 additions & 5 deletions

File tree

lua/eca/commands.lua

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -393,9 +393,15 @@ function M.setup()
393393

394394
vim.api.nvim_create_user_command("EcaStopResponse", function()
395395
local eca = require("eca")
396+
local chat = eca.get()
396397
local Utils = require("eca.utils")
397398

398399
-- Force stop any ongoing streaming response
400+
local chat_id = chat.mediator:id()
401+
if chat_id then
402+
chat.mediator:send("chat/promptStop", { chatId = chat_id }, nil)
403+
end
404+
399405
if eca.sidebar then
400406
eca.sidebar:_finalize_streaming_response()
401407
Logger.notify("Forced stop of streaming response", vim.log.levels.INFO)

lua/eca/sidebar.lua

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1721,11 +1721,6 @@ function M:_add_message(role, content)
17211721
end
17221722
function M:_finalize_streaming_response()
17231723
if self._is_streaming then
1724-
local chat_id = self.mediator:id()
1725-
if chat_id then
1726-
self.mediator:send("chat/promptStop", { chatId = chat_id }, nil)
1727-
end
1728-
17291724
Logger.debug("DEBUG: Finalizing streaming response")
17301725
Logger.debug("DEBUG: Final buffer had " .. #(self._current_response_buffer or "") .. " chars")
17311726

0 commit comments

Comments
 (0)