fix: #1176 Gemini model in OpenRouter not finish their response (#1292)

This commit is contained in:
zerogog
2025-02-18 22:59:16 +08:00
committed by GitHub
parent 63194b5208
commit a17d4b00e2

View File

@@ -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({