Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/ready-taxis-hide.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"kilo-code": patch
---

Fix duplicate text output when using OpenAI-compatible providers with streaming disabled.
6 changes: 3 additions & 3 deletions src/api/providers/__tests__/openai.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -148,11 +148,11 @@ describe("OpenAiHandler", () => {
}

expect(chunks.length).toBeGreaterThan(0)
const textChunk = chunks.find((chunk) => chunk.type === "text")
const textChunks = chunks.filter((chunk) => chunk.type === "text")
const usageChunk = chunks.find((chunk) => chunk.type === "usage")

expect(textChunk).toBeDefined()
expect(textChunk?.text).toBe("Test response")
expect(textChunks).toHaveLength(1)
expect(textChunks[0]?.text).toBe("Test response")
expect(usageChunk).toBeDefined()
expect(usageChunk?.inputTokens).toBe(10)
expect(usageChunk?.outputTokens).toBe(5)
Expand Down
5 changes: 0 additions & 5 deletions src/api/providers/openai.ts
Original file line number Diff line number Diff line change
Expand Up @@ -291,11 +291,6 @@ export class OpenAiHandler extends BaseProvider implements SingleCompletionHandl
}
}

yield {
type: "text",
text: message?.content || "",
}

yield this.processUsageMetrics(response.usage, modelInfo)
}
}
Expand Down
Loading