Use Claude Code with your ChatGPT, Kimi, Cursor or Grok subscription via a local Anthropic-compatible proxy
Rust
kimi: always log finish field in upstream chunk debug output
Raine Virtaad4c6af258ce
diff --git a/src/providers/kimi/translate/reducer.ts b/src/providers/kimi/translate/reducer.tsindex 6279f7a..a249ed5 100644--- a/src/providers/kimi/translate/reducer.ts+++ b/src/providers/kimi/translate/reducer.ts@@ -67,9 +67,14 @@ interface ToolSlot {* of typed, downstream-agnostic ReducerEvents consumed by both the* streaming and non-streaming frontends.*/+export interface ReducerStats {+ chunkCount: number+}+export async function* reduceUpstream(upstream: ReadableStream<Uint8Array>,log: Logger,+ stats?: ReducerStats,): AsyncGenerator<ReducerEvent> {let nextBlockIndex = 0let thinkingIndex: number | undefined@@ -114,15 +119,18 @@ export async function* reduceUpstream(}if (VERBOSE) {- const d = chunk.choices?.[0]?.delta+ const choice = chunk.choices?.[0]+ const d = choice?.deltalog.debug("upstream chunk", {hasReasoning: typeof d?.reasoning_content === "string",hasContent: typeof d?.content === "string" && d.content.length > 0,toolCalls: d?.tool_calls?.length,- finish: chunk.choices?.[0]?.finish_reason,+ finish: choice?.finish_reason ?? null,})}+ if (stats) stats.chunkCount+++if (chunk.error) {throw new UpstreamStreamError("failed", chunk.error.message || "Upstream error")}