Skip to content

[Bugfix] Fix JSON decode error - #572

Merged
Keithwwa merged 1 commit into
AISBench:masterfrom
C-k-Y:issue482
Sep 22, 2026
Merged

Keithwwa merged 1 commit into
AISBench:masterfrom
C-k-Y:issue482

Conversation

@C-k-Y

@C-k-Y C-k-Y commented Sep 21, 2026

Copy link
Copy Markdown
Contributor

PR Type / PR类型

  • Feature(功能新增)
  • Bugfix(Bug 修复)
  • Docs(文档更新)
  • CI/CD(持续集成/持续部署)
  • Refactor(代码重构)
  • Perf(性能优化)
  • Dependency(依赖项更新)
  • Test-Cases(测试用例更新)
  • Other(其他)

Related Issue | 关联 Issue
Fixes #482

🔍 Motivation / 变更动机

流式 API 回复可能包含 SSE 元数据行如 id: xxxx 以及 data:,评价和 [DONE] 终止符号。当前实现没有处理 id: 行并试图作为 JSON 处理,导致 JSON 解码错误。

The streaming API response may contain SSE metadata lines such as id: xxxx in addition to data: lines, comment lines, and the [DONE] termination signal. The current implementation does not handle id: lines and attempts to parse them as JSON, which causes a JSON decoding error. This PR fixes the issue by skipping id: metadata lines during streaming response processing.

📝 Modification / 修改内容

更新流式回复处理逻辑,识别并跳过 id: 避免 JSON 处理。其余回复类型的处理并未更改:

  • data: {...} data lines
  • : comment lines
  • data: [DONE] termination signal

📐 Associated Test Results / 关联测试结果

Please provide links to the related test results, such as CI pipelines, test reports, etc.
请提供相关测试结果的链接,例如 CI 管道、测试报告等。

手动验证了流式 API 回复,使用包含 id: 元数据的行进行测试。

✅ Checklist / 检查列表

Before PR:

  • Pre-commit or other linting tools are used to fix the potential lint issues. / 使用预提交或其他 linting 工具来修复潜在的 lint 问题。
  • Bug fixes are fully covered by unit tests, the case that causes the bug should be added in the unit tests. / 修复的 Bug 已完全由单元测试覆盖,导致 Bug 的情况应在单元测试中添加。
  • The modification is covered by complete unit tests. If not, please add more unit tests to ensure the correctness. / 此拉取请求中的修改已完全由单元测试覆盖。如果不是,请添加更多单元测试以确保正确性。
  • All relevant documentation (API docs, docstrings, example tutorials) has been updated to reflect these changes. / 所有相关文档(API 文档、文档字符串、示例教程)已更新以反映这些更改。

After PR:

  • If the modification has potential influence on downstream or other related projects, this PR should be tested with those projects. / 如果此拉取请求对下游或其他相关项目有潜在影响,应在那些项目中测试此 PR。
  • CLA has been signed and all committers have signed the CLA in this PR. / CLA 已签署,且本 PR 中的所有提交者均已签署 CLA。

👥 Collaboration Info / 协作信息

@github-actions github-actions Bot added bugfix no_review PR 未包含任何检视意见,合入前必须包含检视意见 labels Sep 21, 2026
@github-actions

Copy link
Copy Markdown

🚫 PR 合入质量检查未通过,PR 已被禁止合入。

未通过项:no_review

  • 无检视意见:请至少邀请一位 reviewer 提交检视意见(Approve / Request changes / Comment 均可)。

请按上述提示整改后,重新推送(push)或评论本 PR 即可触发再次检查。

@C-k-Y

C-k-Y commented Sep 22, 2026

Copy link
Copy Markdown
Contributor Author

/pr_check

@github-actions github-actions Bot removed the no_review PR 未包含任何检视意见,合入前必须包含检视意见 label Sep 22, 2026
@github-actions

Copy link
Copy Markdown

✅ PR 合入质量五项检查全部通过,允许合入。

@Keithwwa
Keithwwa merged commit 248393a into AISBench:master Sep 22, 2026
5 of 6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug] 流式 API 响应中的 id: 元数据行导致 JSON 解析失败

2 participants