Skip to content

fix: forward reasoning_effort to zhipu upstream - #7124

Merged
seefs001 merged 1 commit into
QuantumNous:mainfrom
feitianbubu:pr/d5a277fe8
Sep 18, 2026
Merged

seefs001 merged 1 commit into
QuantumNous:mainfrom
feitianbubu:pr/d5a277fe8

Conversation

@feitianbubu

@feitianbubu feitianbubu commented Aug 31, 2026 •

Copy link
Copy Markdown
Member

⚠️ 提交说明 / PR Notice

🚀 变更类型 / Type of change

  • 🐛 Bug 修复 (Bug fix)
  • ✨ 新功能 (New feature)
  • ⚡ 性能优化 / 重构 (Refactor)
  • 📝 文档更新 (Documentation)

📝 变更描述 / Description

requestOpenAI2Zhipu 用字段白名单重建上游请求,reasoning_effort 不在名单里,被静默丢弃。

按智谱文档,glm-5.3 / glm-5.3-flash 的 thinking 强制开启(disabled 无效),思考强度只能靠 reasoning_effort 控制,默认 max。参数被丢的结果是:客户端传 low 也按 max 思考,复杂 agent 请求动辄思考十几分钟,极端情况 max_tokens 全被 reasoning 吃掉,finish_reason=length,正文为空但照常计费。

修复就一行:白名单补 ReasoningEffort。

📸 运行证明 / Proof of Work

线上真实用户请求(12,653 prompt tokens + 22 个 function tools,reasoning_effort: "low")修复前后 A/B:

输出 tokens 耗时
修复前(参数被丢,实际 max) 5,050 2m4s
修复后(low 生效) 164 8s

触发排查的原始案例:同场景请求思考 15 分钟,32,000 completion tokens 里 31,844 个是 reasoning,finish_reason=length,content 为空。

✅ 提交前检查项 / Checklist

  • 人工确认: 无论描述是否由 AI 生成,我已审阅全部内容,并声明对其准确性与完整性负责。
  • 非重复提交: 我已搜索现有的 Issues 与 PRs,确认不是重复提交。
  • 新功能关联 Issue: 若此 PR 标记为 New feature,我已关联对应 Issue;若尚无 Issue,我已先自行创建。
  • 事前沟通: 若改动较大或涉及方向性变更,已在关联 Issue 中与维护者沟通并达成一致。
  • 功能范围: 本 PR 不是 Coding Plan、逆向渠道、第三方封装接口,也不是对 Codex 渠道类型的改动。
  • 范围聚焦: 本 PR 为一项聚焦改动,未包含无关代码。
  • 本地验证: 已在本地运行并通过测试或手动验证,维护者可以据此复核。
  • 安全合规: 代码中无敏感凭据,且符合项目代码规范。

Summary by CodeRabbit

  • Bug Fixes
    • Preserved the requested reasoning effort when converting requests for Zhipu 4V, ensuring model behavior aligns with the incoming configuration.

@coderabbitai

coderabbitai Bot commented Aug 31, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Team

Run ID: 8fb9fa18-ed52-4cca-8a49-d72051eae681

📥 Commits

Reviewing files that changed from the base of the PR and between 67a0585 and eb9888b.

📒 Files selected for processing (1)
  • relay/channel/zhipu_4v/relay-zhipu_v4.go

Included review availability: Your plan provides up to 10 included reviews per hour; 9 remain after this review.


Walkthrough

The Zhipu request conversion now propagates ReasoningEffort from the incoming request to the converted request. Existing field mappings remain unchanged.

Changes

Zhipu request conversion

Layer / File(s) Summary
Propagate reasoning effort
relay/channel/zhipu_4v/relay-zhipu_v4.go
The converted request now includes the incoming ReasoningEffort value.

Estimated code review effort: 1 (Trivial) | ~5 minutes

Merge Risk: ⚪ Minimal · up to eb988

This change forwards the requested reasoning effort to the upstream provider so low-effort requests are honored; no actionable merge-blocking risk remains beyond normal checks and review.

Suggested reviewers: calcium-ion

Poem

A rabbit found a reasoning thread
And carried it where requests were led
The Zhipu path now keeps it in sight
With fields aligned and mappings right
Hop, hop—conversion takes flight

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 1 functions across 1 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely describes the main change: forwarding reasoning_effort to the Zhipu upstream service.
  • Fix all pre-merge checks with AI
✨ Finishing Touches
🧪 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.

@seefs001
seefs001 merged commit 3e8c358 into QuantumNous:main Sep 18, 2026
2 checks passed
Javabcd pushed a commit to Javabcd/new-api that referenced this pull request Sep 22, 2026
chao2hang pushed a commit to chao2hang/chaos-api that referenced this pull request Sep 23, 2026
GuDong2003 pushed a commit to GuDong2003/new-api that referenced this pull request Sep 25, 2026
TomJKS pushed a commit to TomJKS/new-api that referenced this pull request Sep 28, 2026
cha-eunho pushed a commit to attodev/new-api that referenced this pull request Oct 14, 2026
NaturalSelect pushed a commit to NaturalSelect/new-api that referenced this pull request Nov 5, 2026
timwenx pushed a commit to timwenx/new-api that referenced this pull request Nov 18, 2026
xiaolanawaqaq pushed a commit to xiaolanawaqaq/new-apiaaa that referenced this pull request Nov 26, 2026
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