Skip to content

Commit 69dcd13

Browse files
committed
fix(quick_chat): session deletion
1 parent e410cf7 commit 69dcd13

File tree

1 file changed

+7
-8
lines changed

1 file changed

+7
-8
lines changed

lua/opencode/quick_chat.lua

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,13 @@ local function cleanup_session(session_info, session_id, message)
4040
if session_info and session_info.spinner then
4141
session_info.spinner:stop()
4242
end
43+
44+
if config.debug.quick_chat and not config.debug.quick_chat.keep_session then
45+
state.api_client:delete_session(session_id):catch(function(err)
46+
vim.notify('Error deleting ephemeral session: ' .. vim.inspect(err), vim.log.levels.WARN)
47+
end)
48+
end
49+
4350
running_sessions[session_id] = nil
4451
if message then
4552
vim.notify(message, vim.log.levels.WARN)
@@ -139,14 +146,6 @@ local on_done = Promise.async(function(active_session)
139146
else
140147
cleanup_session(running_session, active_session.id, 'Failed to update file with quick chat response')
141148
end
142-
143-
if config.debug.quick_chat and config.debug.quick_chat.keep_session then
144-
return
145-
end
146-
147-
state.api_client:delete_session(active_session.id):catch(function(err)
148-
vim.notify('Error deleting ephemeral session: ' .. vim.inspect(err), vim.log.levels.WARN)
149-
end)
150149
end)
151150

152151
---@param message string|nil The message to validate

0 commit comments

Comments
 (0)