Repository navigation
feat: advanced custom channel - #5590
Conversation
|
Caution Review failedThe pull request is closed. ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (26)
WalkthroughAdds a new "Advanced Custom" channel type (ID 58) with per-route request routing across OpenAI/Anthropic/Gemini backends. Includes Go constants, DTO structs with validation, a full relay adaptor with path matching and converter dispatch, React UI editor dialog, form/schema integration, and i18n strings for six locales. ChangesAdvanced Custom Channel Type
Sequence Diagram(s)sequenceDiagram
participant User
participant ChannelMutateDrawer
participant AdvancedCustomEditorDialog
participant channelFormSchema
participant ValidateSettings as model.ValidateSettings
participant Adaptor as advancedcustom.Adaptor
participant UpstreamAPI
User->>ChannelMutateDrawer: Open "Configure routes"
ChannelMutateDrawer->>AdvancedCustomEditorDialog: open=true, value=advanced_custom JSON
User->>AdvancedCustomEditorDialog: Edit routes (visual/JSON), select template, save
AdvancedCustomEditorDialog->>channelFormSchema: onSave → set advanced_custom field
channelFormSchema->>channelFormSchema: superRefine: parseAdvancedCustomConfig + validateAdvancedCustomConfig
channelFormSchema-->>ChannelMutateDrawer: validation errors / ok
ChannelMutateDrawer->>ValidateSettings: Submit channel (OtherSettings.AdvancedCustom)
ValidateSettings->>ValidateSettings: AdvancedCustom.Validate() per-route checks
ValidateSettings-->>ChannelMutateDrawer: error or nil
Note over Adaptor: At request time
Adaptor->>Adaptor: resolve() — match incoming path to routes
alt route matched
Adaptor->>Adaptor: routeURL() — build upstream URL + auth
Adaptor->>UpstreamAPI: HTTP request (converted or native)
UpstreamAPI-->>Adaptor: response
Adaptor->>Adaptor: DoResponse — converter-specific handling
else fallback enabled
Adaptor->>UpstreamAPI: openaiAdaptor pass-through to base URL
UpstreamAPI-->>Adaptor: response
end
Adaptor-->>User: API response
Estimated code review effort🎯 5 (Critical) | ⏱️ ~120 minutes Possibly related PRs
Suggested reviewers
Poem
✨ Finishing Touches🧪 Generate unit tests (beta)
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 |
Important
高级自定义渠道
📝 变更描述 / Description
(简述:做了什么?为什么这样改能生效?请基于你对代码逻辑的理解来写,避免粘贴未经整理的内容)
🚀 变更类型 / Type of change
🔗 关联任务 / Related Issue
✅ 提交前检查项 / Checklist
Bug fix,我已提交或关联对应 Issue,且不会将设计取舍、预期不一致或理解偏差直接归类为 bug。📸 运行证明 / Proof of Work
(请在此粘贴截图、关键日志或测试报告,以证明变更生效)
Summary by CodeRabbit
Release Notes
New Features