feat: support request_header key source - #4903
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (2)
✅ Files skipped from review due to trivial changes (1)
WalkthroughThis PR adds support for extracting channel affinity keys from HTTP request headers. The backend extracts and trims header values based on a configured key name, while the frontend UI allows users to select and configure header-based affinity rules with appropriate validation and guidance. ChangesRequest Header Channel Affinity
Estimated code review effort🎯 2 (Simple) | ⏱️ ~12 minutes Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Tip 💬 Introducing Slack Agent: The best way for teams to turn conversations into code.Slack Agent is built on CodeRabbit's deep understanding of your code, so your team can collaborate across the entire SDLC without losing context.
Built for teams:
One agent for your entire SDLC. Right inside Slack. 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. Comment |
合并上游约 40 个新提交,包含: - feat: support request_header key source (QuantumNous#4903) - feat: add model performance metrics (PerfMetric) to dashboard - feat: require compliance confirmation for paid features - feat: track upstream request ID and prevent response header override - feat: add DeepChat deeplink support (QuantumNous#4668) - fix: filter perf metrics summary by active groups - fix: respect dashboard content visibility settings - fix: expose param override audits for sensitive message fields - fix: apply group filter to channel list queries - fix: correct usage logs filtering - fix: allow clearing channel remark - fix: GetAllChannels ignores group filter parameter - fix: enforce header nav access control - fix: handle unlimited API key quota validation - fix: use getUserGroups for ratio display - fix: register_enabled in /api/status gate sign-up link - fix(auth): localize reset password confirmation, aff_code field name - fix(web): normalize model detail tabs layout, pagination button labels - fix(web/default): various new UI fixes - fix: logger.LogDebug 格式化参数优化 - chore: add LICENSE, NOTICE, THIRD-PARTY-LICENSES files - perf: avoid eager formatting in debug log calls - chore(deps): update axios 1.15.2, ip-address 10.2.0 保留自定义功能: - AWS 错误日志自动下架模型 (AwsModelBan) - Claude 批量自动调度账号 (channel_anthropic_batch) - 渠道失败率/RPM 展示与计算 (ChannelAutoEnable, TokenDailyStat) - 操作日志系统 (OperationLog) - 域名首页内容管理 (DomainHomeContent) - 升级系统提示词功能 - 日常业务管理员权限 - 易支付回调兼容 - 渠道分组顺序箭头显示 (render.jsx) - TopupNoticeCard 公告 - 视频任务退款防重复 (task.Quota = 0) - 请求头过滤 (minimax/tts.go, openai/audio.go) 文件路径调整: - 上游将 web/src/ 重命名为 web/classic/src/,新增 web/default/(新主题) - 13 个自定义前端文件已移至 web/classic/ 对应路径 - login.png 放至 web/classic/public/(被 classic 前端引用) Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Range: 18282e6..3b9ed0a8 (upstream/main as of fetch) Highlights: - feat: support request_header key source (QuantumNous#4903) - feat: Waffo Pancake gateway + admin catalog binding (QuantumNous#4935) - perf: optimize request metadata extraction, drop dead batch helpers in relay/channel/openai/helper.go (QuantumNous#5009) - perf: reduce heap residency for large base64 relay requests - fix(channel): evict auto-disabled multi-key channels from cache (QuantumNous#4983) - fix: resolve model owned_by from active channels (QuantumNous#4416) — introduces channelOwnerName/getPreferredModelOwners/buildOpenAIModel + ListModels refactor - fix: GetAllChannels respects group filter (QuantumNous#4847, QuantumNous#4885) - fix(auth): expose register_enabled, aff_code, localize reset (QuantumNous#4871, QuantumNous#4945, QuantumNous#4769) - fix(webhook): processing + Waffo subscription compliance (QuantumNous#5047, QuantumNous#5038) - refactor(ui): system settings drill-in sidebar + log filter responsiveness Conflicts resolved: - controller/model.go: kept local hiddenMappedModels filter (resolveAccessibleModelGroups + getHiddenMappedModelNamesForGroups) on top of upstream's ListModels refactor; adopted upstream channelOwnerName helper. - relay/channel/openai/helper.go: adopted upstream (HEAD's processChatCompletions/processCompletions were dead code after upstream's perf refactor in QuantumNous#5009). Local patches verified intact: Username + fillTopUpUsernames (model/topup.go, locked by topup_username_test.go), HideUpstreamErrors, Claude developer-role normalization, Gemini role fallback, Model Chat header nav entry, channel affinity auto-clear. Note: go build not run (no Go toolchain in this environment); CI to verify. Generated with [Claude Code](https://claude.ai/code) via [Happy](https://happy.engineering) Co-Authored-By: Claude <noreply@anthropic.com> Co-Authored-By: Happy <yesreply@happy.engineering>
* feat: support request_header key source in backend and settings UI * feat: support request_header channel affinity source
Sync upstream QuantumNous/new-api 68830e6, adapted to the fork's Semi web/src UI (upstream touched web/classic + web/default). - channel_affinity.go: add a request_header key source that reads the affinity key from a request header (trimmed). - Settings UI (SettingsChannelAffinity.jsx): add request_header to the key-source options, require a key for it, update the help text and placeholder (X-Affinity-Key). - Port the two upstream tests (fork's test file already uses testify).
* feat: support request_header key source in backend and settings UI * feat: support request_header channel affinity source
* feat: support request_header key source in backend and settings UI * feat: support request_header channel affinity source
* feat: support request_header key source in backend and settings UI * feat: support request_header channel affinity source
Important
📝 变更描述 / Description
(简述:做了什么?为什么这样改能生效?请基于你对代码逻辑的理解来写,避免粘贴未经整理的内容)
渠道亲和配置规则支持配置请求头
🚀 变更类型 / Type of change
🔗 关联任务 / Related Issue
✅ 提交前检查项 / Checklist
Bug fix,我已提交或关联对应 Issue,且不会将设计取舍、预期不一致或理解偏差直接归类为 bug。📸 运行证明 / Proof of Work
(请在此粘贴截图、关键日志或测试报告,以证明变更生效)
Summary by CodeRabbit