Skip to content

fix(relay): log client reasoning effort - #6642

Closed
RedwindA wants to merge 1 commit into
QuantumNous:mainfrom
RedwindA:fix/6634
Closed

RedwindA wants to merge 1 commit into
QuantumNous:mainfrom
RedwindA:fix/6634

Conversation

@RedwindA

@RedwindA RedwindA commented Aug 4, 2026 •

Copy link
Copy Markdown
Contributor

⚠️ 提交说明 / PR Notice

Important

  • 请提供人工撰写的简洁摘要,避免直接粘贴未经整理的 AI 输出。

📝 变更描述 / Description

调用日志中的推理强度此前依赖具体渠道适配器写入,因此 New API、Sub2API、Codex、高级自定义以及请求体透传等路径可能遗漏该字段。

本次改动将推理强度的采集前移到统一请求解析阶段:Chat Completions 从 reasoning_effort 读取,Responses API 从 reasoning.effort 读取。这样日志元数据不再依赖后续选择的渠道或是否执行请求转换,同时保留渠道适配器根据模型后缀推导推理强度的现有行为。

同时增加表格驱动测试,覆盖 Chat Completions 与 Responses API 两种请求格式。

🚀 变更类型 / Type of change

  • 🐛 Bug 修复 (Bug fix) - 请关联对应 Issue,避免将设计取舍、理解偏差或预期不一致直接归类为 bug
  • ✨ 新功能 (New feature) - 重大特性建议先通过 Issue 沟通
  • ⚡ 性能优化 / 重构 (Refactor)
  • 📝 文档更新 (Documentation)

🔗 关联任务 / Related Issue

✅ 提交前检查项 / Checklist

  • 人工确认: 我已亲自整理并撰写此描述,没有直接粘贴未经处理的 AI 输出。
  • 非重复提交: 我已搜索现有的 Issues 与 PRs,确认不是重复提交。
  • Bug fix 说明: 若此 PR 标记为 Bug fix,我已提交或关联对应 Issue,且不会将设计取舍、预期不一致或理解偏差直接归类为 bug。
  • 变更理解: 我已理解这些更改的工作原理及可能影响。
  • 范围聚焦: 本 PR 未包含任何与当前任务无关的代码改动。
  • 本地验证: 已在本地运行并通过测试或手动验证,维护者可以据此复核结果。
  • 安全合规: 代码中无敏感凭据,且符合项目代码规范。

📸 运行证明 / Proof of Work

  • go test ./... 全部通过。
  • 手动调用 /v1/chat/completions,请求携带 reasoning_effort: "high",响应成功且 UI 日志正确显示推理强度。
  • 手动调用 /v1/responses,使用 glm-5.2 和 reasoning.effort: "high",返回 HTTP 200,消费日志中的 reasoning_effort 正确记录为 high。

Summary by CodeRabbit

  • New Features

    • Preserves the requested reasoning effort when processing supported OpenAI requests, improving request metadata accuracy.
  • Tests

    • Added coverage confirming reasoning effort is captured for OpenAI Chat Completions and Responses requests.

@RedwindA RedwindA closed this Aug 4, 2026
@coderabbitai

coderabbitai Bot commented Aug 4, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 985bc2d6-6906-4d12-98a1-ad4882b4712c

📥 Commits

Reviewing files that changed from the base of the PR and between 0ab0202 and acbf85c.

📒 Files selected for processing (2)
  • relay/common/relay_info.go
  • relay/common/relay_info_test.go

Walkthrough

The change captures client reasoning effort in generated relay metadata for OpenAI chat-completions and Responses requests. Tests verify the high and max values.

Changes

Reasoning effort capture

Layer / File(s) Summary
Relay info propagation and validation
relay/common/relay_info.go, relay/common/relay_info_test.go
GenRelayInfoResponses and GenRelayInfoOpenAI now copy reasoning effort into RelayInfo. Table-driven tests cover OpenAI chat-completions and Responses requests.

Estimated code review effort: 2 (Simple) | ~10 minutes

Possibly related PRs

Suggested reviewers: calcium-ion

Poem

A rabbit checks the relay trail,
Where high and max values sail.
The logs now hold each thought’s degree,
Tests watch the paths from A to Z.
Hop, hop—the metadata is free!

✨ Finishing Touches 💡 1
🛠️ Fix failing CI checks 💡
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@RedwindA

RedwindA commented Aug 4, 2026

Copy link
Copy Markdown
Contributor Author

duplicated

@seefs001

seefs001 commented Aug 4, 2026

Copy link
Copy Markdown
Collaborator

真巧啊,和我撞一起了

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