refactor: get rid of nui-components (#118)

This commit is contained in:
yetone
2024-08-21 21:28:17 +08:00
committed by GitHub
parent b995e4aa7b
commit 2e48d387a9
8 changed files with 1018 additions and 608 deletions

View File

@@ -376,7 +376,10 @@ end
---@type AvanteResponseParser
M.parse_claude_response = function(data_stream, event_state, opts)
if event_state == "content_block_delta" then
local json = vim.json.decode(data_stream)
local ok, json = pcall(vim.json.decode, data_stream)
if not ok then
return
end
opts.on_chunk(json.delta.text)
elseif event_state == "message_stop" then
opts.on_complete(nil)
@@ -739,7 +742,7 @@ M.stream = function(question, code_lang, code_content, selected_content_content,
return active_job
end
---@private
---@public
function M.setup()
if Config.provider == "copilot" and not M.copilot then
M.copilot = {