From 56ebcad7a861f5a1df5c7a09a761dae0a3e88081 Mon Sep 17 00:00:00 2001 From: yetone Date: Wed, 20 Nov 2024 01:29:55 +0800 Subject: [PATCH] fix: must not be called in a lua loop (#876) --- lua/avante/llm.lua | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lua/avante/llm.lua b/lua/avante/llm.lua index 3a63a53..b244913 100644 --- a/lua/avante/llm.lua +++ b/lua/avante/llm.lua @@ -347,6 +347,8 @@ end ---@param opts StreamOptions M.stream = function(opts) + if opts.on_chunk ~= nil then opts.on_chunk = vim.schedule_wrap(opts.on_chunk) end + if opts.on_complete ~= nil then opts.on_complete = vim.schedule_wrap(opts.on_complete) end local Provider = opts.provider or P[Config.provider] if Config.dual_boost.enabled then M._dual_boost_stream(opts, Provider, P[Config.dual_boost.first_provider], P[Config.dual_boost.second_provider])