Skip to content

fix: 在聊天中显示 Responses 思考摘要 - #315

Merged
robscc merged 1 commit into
mainfrom
fix/openai-reasoning-summary
Nov 23, 2026
Merged

robscc merged 1 commit into
mainfrom
fix/openai-reasoning-summary

Conversation

@robscc

@robscc robscc commented Nov 23, 2026

Copy link
Copy Markdown
Owner

现象

Responses 接口返回的思考摘要,在部分 OpenAI 兼容配置下未显示。刷新后,原生摘要已经落盘的历史回复也没有思考区。

根因

SDK 将 response.reasoning_summary_text.delta 转换为 reasoning.summary 内容块。Ginno 的通用实时和回放路径读取 thinking 与 reasoning_content,绕过了没有额外桥接过的摘要块。

修复

  • 统一读取原生摘要块及旧版 SDK 的 additional_kwargs.reasoning。
  • 实时送到现有可展开思考区,历史回放复用同一提取逻辑。摘要与桥接字段同时存在时只显示一次。
  • 只展示可读的摘要文本,沿用已配置的模型请求参数。

验证

  • 旧版在 Chromium 能看到正文,思考区数量为零。修复后实时与刷新后均能看到同一段摘要。
  • 用真实 OpenAI SDK 读取模拟 SSE,覆盖自动路由到 Responses 的兼容配置和显式 Responses 配置。断言两个摘要片段完整拼接,仅发一份,正文单独到达。
  • 验证当前历史、旧版历史、已有桥接的历史及仅有加密字段的历史。相关测试共 154 项通过,另有 Chromium 回归 1 项通过,Ruff 通过。

现象

Codex 经兼容配置使用 Responses 接口时,模型返回思考摘要,聊天中的思考区和历史回放没有显示。

根因

流式与回放只识别 reasoning_content 和 thinking 块,兼容配置保留的 Responses 原生 reasoning.summary 未进入展示管道。

修复

统一读取当前和旧版 Responses 的摘要文本。实时发到现有思考区,历史复用同样的提取逻辑。原生摘要与桥接字段同时存在时只展示一次。

验证

原生和旧版回放用例在旧实现失败。修复后真实 SDK 读取模拟 SSE,验证两种配置均产生完整思考区事件。Chromium 验证实时和刷新后显示。相关测试 154 项和 Ruff 通过。
@codecov-commenter

codecov-commenter commented Nov 23, 2026 •

Copy link
Copy Markdown

⚠️ Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

❌ Patch coverage is 93.54839% with 2 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
...me/src/ginno_runtime/api/stream/stages/streamio.py 85.71% 1 Missing ⚠️
packages/runtime/src/ginno_runtime/models.py 94.73% 1 Missing ⚠️

📢 Thoughts on this report? Let us know!

@robscc
robscc merged commit f21698e into main Nov 23, 2026
6 checks passed
@robscc
robscc deleted the fix/openai-reasoning-summary branch November 23, 2026 00:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants