From a17d4b00e209eddbd7f847a30f56d1a180c2fafd Mon Sep 17 00:00:00 2001 From: zerogog <18209463+zerogog@users.noreply.github.com> Date: Tue, 18 Feb 2025 22:59:16 +0800 Subject: [PATCH] fix: #1176 Gemini model in OpenRouter not finish their response (#1292) --- lua/avante/providers/openai.lua | 1 + 1 file changed, 1 insertion(+) diff --git a/lua/avante/providers/openai.lua b/lua/avante/providers/openai.lua index 8e95a7a..5a00d46 100644 --- a/lua/avante/providers/openai.lua +++ b/lua/avante/providers/openai.lua @@ -206,6 +206,7 @@ M.parse_response = function(ctx, data_stream, _, opts) if jsn.choices and jsn.choices[1] then local choice = jsn.choices[1] if choice.finish_reason == "stop" or choice.finish_reason == "eos_token" then + if choice.delta.content and choice.delta.content ~= vim.NIL then opts.on_chunk(choice.delta.content) end opts.on_stop({ reason = "complete" }) elseif choice.finish_reason == "tool_calls" then opts.on_stop({