fix: claude parse response (#870)
This commit is contained in:
parent
c551bbe5b6
commit
e65be50a0a
@ -78,6 +78,13 @@ M.parse_messages = function(opts)
|
|||||||
end
|
end
|
||||||
|
|
||||||
M.parse_response = function(data_stream, event_state, opts)
|
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
|
if event_state == "content_block_delta" then
|
||||||
local ok, json = pcall(vim.json.decode, data_stream)
|
local ok, json = pcall(vim.json.decode, data_stream)
|
||||||
if not ok then return end
|
if not ok then return end
|
||||||
|
Loading…
x
Reference in New Issue
Block a user