Skip to content

fix: fetch model add header passthrough rule key check - #3130

Merged
seefs001 merged 1 commit into
QuantumNous:mainfrom
feitianbubu:pr/ce221d98d71ab7aec3eb60f27ca33dbb4dc9610a
Mar 5, 2026
Merged

fix: fetch model add header passthrough rule key check#3130
seefs001 merged 1 commit into
QuantumNous:mainfrom
feitianbubu:pr/ce221d98d71ab7aec3eb60f27ca33dbb4dc9610a

Conversation

@feitianbubu

@feitianbubu feitianbubu commented Mar 5, 2026

Copy link
Copy Markdown
Member

修复当渠道配置请求头透传模板时, 获取模型列表失败的问题
image
image
修复后
image

Summary by CodeRabbit

  • Refactor
    • Improved header handling logic in channel relay operations by introducing a new public interface for header pass-through rule validation, enabling more modular header processing workflow.

@coderabbitai

coderabbitai Bot commented Mar 5, 2026

Copy link
Copy Markdown
Contributor

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 3cb6eabd-9c6c-46e6-8668-21e5276a37cb

📥 Commits

Reviewing files that changed from the base of the PR and between 56c9716 and 1b85b18.

📒 Files selected for processing (2)
  • controller/channel.go
  • relay/channel/api_request.go

Walkthrough

The PR exposes an existing private header passthrough rule check function as a public API in the relay channel module and uses it in the channel controller to skip processing passthrough rule headers when building fetch models headers.

Changes

Cohort / File(s) Summary
Header Passthrough Rule Exposure
relay/channel/api_request.go
Added public wrapper function IsHeaderPassthroughRuleKey(key string) bool that delegates to the existing internal isHeaderPassthroughRuleKey(key) function.
Channel Controller Integration
controller/channel.go
Added import alias for relay channel module and integrated the new IsHeaderPassthroughRuleKey function to skip processing passthrough rule header keys in buildFetchModelsHeaders.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~3 minutes

Possibly related PRs

  • #2394 — Both changes modify header handling in controller/channel.go for fetching upstream models; this PR uses the newly exposed IsHeaderPassthroughRuleKey to skip passthrough headers while the related PR adds header override functionality.
  • #2840 — Directly related through shared header passthrough logic in relay/channel/api_request.go; this PR exposes the key check function while the related PR manages extensive header passthrough rule additions.

Poem

🐰 A hidden check now sees the light,
Exported from the shadows bright,
Controller calls it by its name,
Headers skip—it plays the game! ✨

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 25.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and specifically describes the main fix: adding a header passthrough rule key check to the fetch model functionality.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

Tip

Try Coding Plans. Let us write the prompt for your AI agent so you can ship faster (with fewer bugs).
Share your feedback on Discord.


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 and usage tips.

@seefs001
seefs001 merged commit db8243b into QuantumNous:main Mar 5, 2026
1 check passed
ennnnny pushed a commit to ennnnny/new-api that referenced this pull request Mar 17, 2026
…7aec3eb60f27ca33dbb4dc9610a

fix: fetch model add header passthrough rule key check
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