Skip to content

Commit acfafcf

Browse files
author
Mihamina RKTMB
committed
fix(provider): Fix #1442 - Avoid double printing
1 parent 1e935ab commit acfafcf

1 file changed

Lines changed: 9 additions & 14 deletions

File tree

lua/CopilotChat/config/providers.lua

Lines changed: 9 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -525,30 +525,25 @@ M.copilot = {
525525
tool_calls = {},
526526
}
527527
elseif output.type == 'response.completed' then
528-
-- Completed response
528+
-- Completed response: do NOT resend content here to avoid duplication.
529+
-- Only signal finish and capture usage/reasoning.
529530
local response = output.response
530531
if response then
531-
-- Extract content from the output array
532-
if response.output and #response.output > 0 then
533-
for _, msg in ipairs(response.output) do
534-
if msg.content and #msg.content > 0 then
535-
content = content .. extract_text_from_parts(msg.content)
536-
end
537-
end
538-
end
539-
540-
-- Extract reasoning if available
541532
if response.reasoning and response.reasoning.summary then
542533
reasoning = response.reasoning.summary
543534
end
544-
545-
-- Extract usage information
546535
if response.usage then
547536
total_tokens = response.usage.total_tokens
548537
end
549-
550538
finish_reason = 'stop'
551539
end
540+
return {
541+
content = '',
542+
reasoning = reasoning,
543+
finish_reason = finish_reason,
544+
total_tokens = total_tokens,
545+
tool_calls = {},
546+
}
552547
elseif output.type == 'response.content.delta' or output.type == 'response.output_text.delta' then
553548
-- Streaming content delta
554549
if output.delta then

0 commit comments

Comments
 (0)