From f65e72900f4289d6e4c7642309003813ecbdc3fe Mon Sep 17 00:00:00 2001 From: soulfy Date: Thu, 8 May 2025 12:42:14 +0800 Subject: [PATCH] fix(provider.openai) reasoning_content maybe empty string (#2000) Co-authored-by: yetone Co-authored-by: pre-commit-ci-lite[bot] <117423508+pre-commit-ci-lite[bot]@users.noreply.github.com> --- lua/avante/providers/openai.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lua/avante/providers/openai.lua b/lua/avante/providers/openai.lua index 7abdb1e..9bf213c 100644 --- a/lua/avante/providers/openai.lua +++ b/lua/avante/providers/openai.lua @@ -257,7 +257,7 @@ function M:parse_response(ctx, data_stream, _, opts) if provider_conf.model:match("o1") then delta = choice.message end end if not delta then return end - if delta.reasoning_content and delta.reasoning_content ~= vim.NIL then + if delta.reasoning_content and delta.reasoning_content ~= vim.NIL and delta.reasoning_content ~= "" then if ctx.returned_think_start_tag == nil or not ctx.returned_think_start_tag then ctx.returned_think_start_tag = true if opts.on_chunk then opts.on_chunk("\n") end