feat: 增加渠道重试优先级模式和避开已用渠道功能 - #2754
Conversation
…-i2v Gemini Veo3.1[AI Studio]增加图生视频支持
Ensure image file is closed using defer after opening.
…edit Gemini Image系列支持图像编辑
…d-oai feat: 视频下载和界面预览统一使用OAI标准接口
…-err-code fix(aws): extract HTTP status code from AWS SDK errors
…na-err fix: nano-banana not compatible imageSize
…nce-playground-debugging feat(playground): enhance SSE debugging and add image paste support with i18n
fix: nano banana pro 4k(StreamScannerMaxBufferMB env)
feat: glm coding plan && kimi coding plan
…field fix: claude request missing field
fix(i18n): fill missing translations in i18n.
…ix-gemini-ImageConfig Revert "fix: gemini image correct generationConfig"
…emini-veo3.1-i2v Revert "Gemini Veo3.1[AI Studio]增加图生视频支持"
…emini-image-edit Revert "Gemini Image系列支持图像编辑"
…ix-nano-banana-err Revert "fix: nano-banana not compatible imageSize"
…dd-gemini-3-pro-image-preview-oai Revert "OAI生图接口支持gemini 3 pro image preview"
…task-logging fix(task): 修复使用 auto 分组时 Task Relay 不记录日志和不扣费的问题
fix: 设置默认max req body 为128MB
Use the native Gemini Models API (/v1beta/models) instead of the OpenAI-compatible path when listing models for Gemini channels, improving compatibility with third-party Gemini-format providers that don't implement OpenAI routes. - Add paginated model listing with timeout and optional proxy support - Select an enabled key for multi-key Gemini channels
…etchModels fix: remove Minimax from FETCHABLE channels
…tchModels fix(gemini): fetch model list via native v1beta/models endpoint
* feat: /v1/chat/completion -> /v1/response
…-auto-disable feat: status code auto-disable configuration
* fix: setting ui * fix: rm global.chat_completions_to_responses_policy * fix: rm global.chat_completions_to_responses_policy
…Names fix: clean propertyNames for gemini function
…t-param-override feat: channel testing supports parameter overriding
* feat: codex channel * feat: codex channel * feat: codex oauth flow * feat: codex refresh cred * feat: codex usage * fix: codex err message detail * fix: codex setting ui * feat: codex refresh cred task * fix: import err * fix: codex store must be false * fix: chat -> responses tool call * fix: chat -> responses tool call
…sing Claude's rendering logs, the two approaches handle input rendering differently.
…062b85a4ee06a0b324ba9ec91f6
## 功能1:重试时避开已尝试渠道 - 新增配置选项 RetryAvoidUsedChannelEnabled - 重试时自动排除已经尝试过的渠道 - 前端新增开关按钮支持动态配置 ## 功能2:渠道重试优先级模式 实现两种渠道重试的优先级模式: - Sequential(顺序模式):同一优先级内尝试所有渠道后才降级到下一优先级 - Round-robin(轮询模式):每个优先级轮流尝试,实现负载均衡 ## 代码质量改进 - 添加 validateOptionValue 函数在保存前验证配置值 - 修复 RetryPriorityMode 验证逻辑,防止无效值保存到数据库 - 修复自动分组模式下可能跳过较低优先级的问题 - 为 RetryParam 及其所有方法添加完整的英文文档注释 - 使用中文错误消息,符合项目代码风格 ## 修改的文件 - common/constants.go - 新增配置常量 - model/option.go - 添加配置项的加载、验证和更新逻辑 - controller/relay.go - 在重试循环中记录已使用的渠道ID - service/channel_select.go - 新增 UsedChannelIds 字段和优先级处理逻辑 - model/ability.go & model/channel_cache.go - 在渠道查询时应用排除逻辑 - web/* - 前端UI控件和国际化文本
WalkthroughThis PR introduces two new configuration flags for channel retry behavior: Changes
Sequence DiagramsequenceDiagram
participant Client
participant Relay as controller/relay
participant ChannelCache as model/channel_cache
participant Ability as model/ability
participant DB as Database
Client->>Relay: Request (initial retry=0)
loop Retry Loop (sequential priorities)
Relay->>ChannelCache: GetRandomSatisfiedChannel(group, model, retry, excludeIds)
ChannelCache->>Ability: GetChannel(group, model, retry, excludeIds)
Ability->>DB: Query channels (priority-based, exclude used)
DB-->>Ability: Filtered channels
Ability-->>ChannelCache: Channel or nil
alt Channel Found
ChannelCache-->>Relay: Channel + weight data
Relay->>Relay: Log selection, return channel
Relay-->>Client: Success
else No Channel (priority exhausted)
ChannelCache-->>Relay: nil, nil
Relay->>Relay: Add used channel to excludeIds
Relay->>Relay: Increase priority index
Note over Relay: Continue loop with next priority
end
end
alt All Priorities Exhausted
Relay-->>Client: API Error (all channels excluded/unavailable)
end
Estimated code review effort🎯 4 (Complex) | ⏱️ ~50 minutes Possibly related PRs
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches
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 |
|
any progress? |
功能1:重试时避开已尝试渠道
功能2:渠道重试优先级模式
实现两种渠道重试的优先级模式:
代码质量改进
修改的文件
Summary by CodeRabbit
✏️ Tip: You can customize this high-level summary in your review settings.