Skip to content

Commit d5d831a

Browse files
committed
chore(chat): formatting
1 parent 177f814 commit d5d831a

File tree

1 file changed

+20
-18
lines changed

1 file changed

+20
-18
lines changed

lua/codecompanion/strategies/chat.lua

Lines changed: 20 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -837,28 +837,30 @@ function Chat:submit()
837837

838838
lock_buf(bufnr)
839839
log:info("Chat request started")
840-
self.current_request = client.new():stream(settings, self.adapter:map_roles(vim.deepcopy(self.messages)), function(err, data)
841-
if err then
842-
log:error("Error: %s", err)
843-
return self:reset()
844-
end
840+
self.current_request = client
841+
.new()
842+
:stream(settings, self.adapter:map_roles(vim.deepcopy(self.messages)), function(err, data)
843+
if err then
844+
log:error("Error: %s", err)
845+
return self:reset()
846+
end
845847

846-
if data then
847-
self:get_tokens(data)
848+
if data then
849+
self:get_tokens(data)
848850

849-
local result = self.adapter.args.handlers.chat_output(data)
850-
if result and result.status == CONSTANTS.STATUS_SUCCESS then
851-
if result.output.role then
852-
result.output.role = CONSTANTS.LLM_ROLE
851+
local result = self.adapter.args.handlers.chat_output(data)
852+
if result and result.status == CONSTANTS.STATUS_SUCCESS then
853+
if result.output.role then
854+
result.output.role = CONSTANTS.LLM_ROLE
855+
end
856+
self:append_to_buf(result.output)
853857
end
854-
self:append_to_buf(result.output)
855858
end
856-
end
857-
end, function()
858-
self.current_request = nil
859-
end, {
860-
bufnr = bufnr,
861-
})
859+
end, function()
860+
self.current_request = nil
861+
end, {
862+
bufnr = bufnr,
863+
})
862864
end
863865

864866
---After the response from the LLM is received...

0 commit comments

Comments
 (0)