From cd7390de219491bdd025ff9690ecd89498610c4a Mon Sep 17 00:00:00 2001 From: yetone Date: Mon, 3 Feb 2025 22:32:41 +0800 Subject: [PATCH] fix: remove unnecessary think tag (#1173) --- lua/avante/providers/openai.lua | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lua/avante/providers/openai.lua b/lua/avante/providers/openai.lua index 8aa2441..7011be9 100644 --- a/lua/avante/providers/openai.lua +++ b/lua/avante/providers/openai.lua @@ -127,7 +127,9 @@ M.parse_response = function(ctx, data_stream, _, opts) ctx.last_think_content = choice.delta.reasoning_content opts.on_chunk(choice.delta.reasoning_content) elseif choice.delta.content then - if ctx.returned_think_end_tag == nil or not ctx.returned_think_end_tag then + if + ctx.returned_think_start_tag ~= nil and (ctx.returned_think_end_tag == nil or not ctx.returned_think_end_tag) + then ctx.returned_think_end_tag = true if ctx.last_think_content