Skip to content

Commit

Permalink
fix: claude parse response (yetone#870)
Browse files Browse the repository at this point in the history
  • Loading branch information
yetone authored Nov 18, 2024
1 parent c551bbe commit e65be50
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions lua/avante/providers/claude.lua
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,13 @@ M.parse_messages = function(opts)
end

M.parse_response = function(data_stream, event_state, opts)
if event_state == nil then
if data_stream:match('"content_block_delta"') then
event_state = "content_block_delta"
elseif data_stream:match('"message_stop"') then
event_state = "message_stop"
end
end
if event_state == "content_block_delta" then
local ok, json = pcall(vim.json.decode, data_stream)
if not ok then return end
Expand Down

0 comments on commit e65be50

Please sign in to comment.