Skip to content

v0.1.8

Choose a tag to compare

@github-actions github-actions released this 17 Oct 05:41
· 26 commits to main since this release

cell 0.1.8

修复:空回复诊断 + 上下文溢出自动压缩

小本地模型(gemma4 / qwen 等,经 Ollama)在对话超出上下文窗口后,仍回 HTTP 200 + 空 choices + 完整 usage——旧版本把这种「成功外衣下的失败」吞成一句泛化的 empty reply,并丢失了 provider 的 finish_reason / prompt_tokens。

  • 三个流式客户端(openai-chat / Responses / Anthropic)现在都捕获 finish_reason / stop_reason;空完成时构造可读诊断,明确写出 finish_reason 与 prompt_tokens。
  • 当 finish_reason=length 或 prompt_tokens ≥ 3072(也认 Anthropic / Responses 的 input_tokens)时判为上下文压力:置 err 含 context window 且 ok=false,run_turn 据此自动压缩历史并重试,而不是以死路告终。
  • openai-chat 增加「单 JSON body」回退,兼容忽略 stream:true 的 Ollama / 代理(直接回一整个 JSON 而非 SSE 帧)。
  • run_turn 的空回复守卫改用 provider 诊断作 turn_error;前端失败气泡与 SSE error 事件现在携带完整 provider 信息(例如 provider returned an empty completion (finish_reason=stop); prompt_tokens=3969 — the conversation likely exceeded the model context window; auto-compacting and retrying)。

测试

  • 新增 6 个 empty_completion_diagnostic selftest:finish_reason=length(压力 + 命名 finish_reason + prompt_tokens)、大 prompt_tokens+stop(压力)、小 prompt_tokens(非压力但报告 token)、unknown(非压力 + 报告 unknown)、content_filter(非压力 + 命名 filtered)、input_tokens 代理(Anthropic / Responses 客户端)。

提交

  • 7c73e00 fix: surface the provider's real empty-completion diagnostic and auto-compact on context-window pressure
  • 3131c33 test: assert the empty-completion diagnostic names finish_reason and flags context pressure (incl. input_tokens for Anthropic/Responses)