Skip to content

Use Claude Code with your ChatGPT, Kimi, Cursor or Grok subscription via a local Anthropic-compatible proxy

Rust

kimi: remove per-chunk debug logging from reducer

Raine Virtae4b8c4ae14be
diff --git a/src/providers/kimi/translate/accumulate.ts b/src/providers/kimi/translate/accumulate.ts
index 5efef66..2f8eb3f 100644
--- a/src/providers/kimi/translate/accumulate.ts
+++ b/src/providers/kimi/translate/accumulate.ts
@@ -49,7 +49,7 @@ export async function accumulateResponse(
let toolCount = 0
const stats = { chunkCount: 0 }
- for await (const e of reduceUpstream(upstream, opts.log, stats)) {
+ for await (const e of reduceUpstream(upstream, stats)) {
switch (e.kind) {
case "thinking-start":
blocks.set(e.index, { kind: "thinking", text: "" })
diff --git a/src/providers/kimi/translate/reducer.ts b/src/providers/kimi/translate/reducer.ts
index a249ed5..cb62203 100644
--- a/src/providers/kimi/translate/reducer.ts
+++ b/src/providers/kimi/translate/reducer.ts
@@ -1,5 +1,4 @@
import { parseSseStream } from "../../../sse.ts"
-import type { Logger } from "../../../log.ts"
const VERBOSE = !!process.env.CCP_LOG_VERBOSE
@@ -73,7 +72,6 @@ export interface ReducerStats {
export async function* reduceUpstream(
upstream: ReadableStream<Uint8Array>,
- log: Logger,
stats?: ReducerStats,
): AsyncGenerator<ReducerEvent> {
let nextBlockIndex = 0
@@ -118,17 +116,6 @@ export async function* reduceUpstream(
continue
}
- if (VERBOSE) {
- const choice = chunk.choices?.[0]
- const d = choice?.delta
- log.debug("upstream chunk", {
- hasReasoning: typeof d?.reasoning_content === "string",
- hasContent: typeof d?.content === "string" && d.content.length > 0,
- toolCalls: d?.tool_calls?.length,
- finish: choice?.finish_reason ?? null,
- })
- }
-
if (stats) stats.chunkCount++
if (chunk.error) {
diff --git a/src/providers/kimi/translate/stream.ts b/src/providers/kimi/translate/stream.ts
index a6b9d74..c3739ea 100644
--- a/src/providers/kimi/translate/stream.ts
+++ b/src/providers/kimi/translate/stream.ts
@@ -64,7 +64,7 @@ export function translateStream(
const stats = { chunkCount: 0 }
try {
- for await (const e of reduceUpstream(upstream, opts.log, stats)) {
+ for await (const e of reduceUpstream(upstream, stats)) {
if (firstChunkAt === undefined) firstChunkAt = Date.now()
switch (e.kind) {