feat: volcengine支持自定义域名 - #1886
Conversation
WalkthroughAdds configurable Volcengine channel base URL resolution in the relay adaptor, extends the Volcengine model list with five new model IDs, and updates the web EditChannelModal to always show API configuration and handle a default/selectable base URL for channel type 45. Changes
Sequence Diagram(s)sequenceDiagram
autonumber
participant U as User
participant W as Web UI (EditChannelModal)
participant B as Backend Relay (Volcengine adaptor)
participant V as Volcengine API
U->>W: Open/Edit channel modal
W-->>U: Show API configuration controls (always)
U->>W: Select type / choose base_url / Save
W->>B: Submit channel settings (includes base_url for type 45)
rect rgb(200,230,255)
note right of B: Base URL resolution
B->>B: baseUrl = info.ChannelBaseUrl ? info.ChannelBaseUrl : "https://ark.cn-beijing.volces.com"
B->>V: Call Volcengine API using baseUrl
V-->>B: API response
end
B-->>W: Persist result/status
W-->>U: Show confirmation
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Poem
Pre-merge checks and finishing touches✅ Passed checks (3 passed)
✨ Finishing touches
🧪 Generate unit tests
📜 Recent review detailsConfiguration used: CodeRabbit UI Review profile: CHILL Plan: Pro 📒 Files selected for processing (1)
🧰 Additional context used🧠 Learnings (2)📚 Learning: 2025-08-27T02:15:25.448ZApplied to files:
📚 Learning: 2025-08-27T02:15:25.448ZApplied to files:
🧬 Code graph analysis (1)web/src/components/table/channels/modals/EditChannelModal.jsx (3)
🔇 Additional comments (1)
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 |
There was a problem hiding this comment.
Actionable comments posted: 0
🧹 Nitpick comments (1)
relay/channel/volcengine/adaptor.go (1)
191-205: Trim trailing separators on custom base URLsIf an admin enters the Volcengine base URL with a trailing slash, we start emitting endpoints like
https://foo//api/v3/.... Many servers tolerate this, but some CDNs/reverse proxies don’t, so it’s safer to normalize the value up front. Let’s strip trailing slashes before we append the path segments.- baseUrl := info.ChannelBaseUrl - if baseUrl == "" { - baseUrl = "https://ark.cn-beijing.volces.com" - } + baseUrl := strings.TrimRight(info.ChannelBaseUrl, "/") + if baseUrl == "" { + baseUrl = "https://ark.cn-beijing.volces.com" + }
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (3)
relay/channel/volcengine/adaptor.go(1 hunks)relay/channel/volcengine/constants.go(1 hunks)web/src/components/table/channels/modals/EditChannelModal.jsx(2 hunks)
🧰 Additional context used
🧠 Learnings (2)
📚 Learning: 2025-08-27T02:15:25.448Z
Learnt from: AAEE86
PR: QuantumNous/new-api#1658
File: web/src/components/table/channels/modals/EditChannelModal.jsx:555-569
Timestamp: 2025-08-27T02:15:25.448Z
Learning: In EditChannelModal.jsx, the database stores mapped keys (display names) in the models field after applying model mapping transformations. When loading a channel, data.models contains the mapped keys, not the original model names. The filtering logic if (data.models.includes(key)) in the initialization is correct.
Applied to files:
web/src/components/table/channels/modals/EditChannelModal.jsx
📚 Learning: 2025-08-27T02:15:25.448Z
Learnt from: AAEE86
PR: QuantumNous/new-api#1658
File: web/src/components/table/channels/modals/EditChannelModal.jsx:555-569
Timestamp: 2025-08-27T02:15:25.448Z
Learning: In EditChannelModal.jsx, the applyModelMapping function transforms the models list by replacing original model names (mapping values) with display names (mapping keys). The database stores this transformed list containing mapped keys. On channel load, data.models contains these mapped display names, making the initialization filter if (data.models.includes(key)) correct.
Applied to files:
web/src/components/table/channels/modals/EditChannelModal.jsx
🧬 Code graph analysis (2)
relay/channel/volcengine/adaptor.go (1)
relay/constant/relay_mode.go (5)
RelayModeChatCompletions(10-10)RelayModeEmbeddings(12-12)RelayModeImagesGenerations(14-14)RelayModeImagesEdits(15-15)RelayModeRerank(46-46)
web/src/components/table/channels/modals/EditChannelModal.jsx (1)
web/src/components/table/channels/modals/EditTagModal.jsx (1)
inputs(73-73)
|
因为防呆设计需要,不允许自定义,建议改为选项选择海外地址还是国内地址 |
默认不填写任何地址就是国内地址,如需要切换为海外地址,则根据需要填写 |
这个意思是不想让直接写地址,防止有些用户写的奇奇怪怪的地址不会用产生一堆问题,毕竟现在也就这俩地址所以是建议弄一个开关切换这两个固定地址 |
好的,针对该渠道,那我在前端控件加多一个下拉选择框吧,默认选择国内地址,也可以选择国外地址 |
There was a problem hiding this comment.
Actionable comments posted: 0
🧹 Nitpick comments (1)
web/src/components/table/channels/modals/EditChannelModal.jsx (1)
1793-1813: Default the Volcengine base URL when it’s emptyRight now
base_urlremains an empty string when you create or edit a Volcengine channel that hasn’t explicitly stored a value. Because the field is controlled by the form, the<Form.Select>renders with no option selected even though we pass adefaultValue, so users see an empty dropdown instead of the domestic endpoint you intend to promote as the default. Please hydrate the field withhttps://ark.cn-beijing.volces.comas soon as type 45 is selected (or loaded) whenbase_urlis falsy; that keeps the UI and the submitted payload aligned and removes the ambiguity.@@ - setInputs((inputs) => ({ ...inputs, [name]: value })); + setInputs((prev) => { + const next = { ...prev, [name]: value }; + if (name === 'type' && value === 45 && !prev.base_url) { + const defaultVolcUrl = 'https://ark.cn-beijing.volces.com'; + next.base_url = defaultVolcUrl; + if (formApiRef.current) { + formApiRef.current.setValue('base_url', defaultVolcUrl); + } + } + return next; + });
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
web/src/components/table/channels/modals/EditChannelModal.jsx(2 hunks)
🧰 Additional context used
🧬 Code graph analysis (1)
web/src/components/table/channels/modals/EditChannelModal.jsx (1)
web/src/components/table/channels/modals/EditTagModal.jsx (2)
inputs(73-73)handleInputChange(77-129)
There was a problem hiding this comment.
Actionable comments posted: 1
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
web/src/components/table/channels/modals/EditChannelModal.jsx(4 hunks)
🧰 Additional context used
🧠 Learnings (2)
📚 Learning: 2025-08-27T02:15:25.448Z
Learnt from: AAEE86
PR: QuantumNous/new-api#1658
File: web/src/components/table/channels/modals/EditChannelModal.jsx:555-569
Timestamp: 2025-08-27T02:15:25.448Z
Learning: In EditChannelModal.jsx, the applyModelMapping function transforms the models list by replacing original model names (mapping values) with display names (mapping keys). The database stores this transformed list containing mapped keys. On channel load, data.models contains these mapped display names, making the initialization filter if (data.models.includes(key)) correct.
Applied to files:
web/src/components/table/channels/modals/EditChannelModal.jsx
📚 Learning: 2025-08-27T02:15:25.448Z
Learnt from: AAEE86
PR: QuantumNous/new-api#1658
File: web/src/components/table/channels/modals/EditChannelModal.jsx:555-569
Timestamp: 2025-08-27T02:15:25.448Z
Learning: In EditChannelModal.jsx, the database stores mapped keys (display names) in the models field after applying model mapping transformations. When loading a channel, data.models contains the mapped keys, not the original model names. The filtering logic if (data.models.includes(key)) in the initialization is correct.
Applied to files:
web/src/components/table/channels/modals/EditChannelModal.jsx
🧬 Code graph analysis (1)
web/src/components/table/channels/modals/EditChannelModal.jsx (3)
web/src/helpers/api.js (1)
getChannelModels(278-294)web/src/helpers/utils.jsx (1)
showInfo(157-159)web/src/components/table/channels/modals/EditTagModal.jsx (2)
inputs(73-73)handleInputChange(77-129)
| { | ||
| value: 'https://ark.cn-beijing.volces.com', | ||
| label: 'https://ark.cn-beijing.volces.com' | ||
| }, | ||
| { | ||
| value: 'https://ark.ap-southeast.bytepluses.com', | ||
| label: 'https://ark.ap-southeast.bytepluses.com' | ||
| } |
There was a problem hiding this comment.
Outbound Volcengine domain is misspelled and missing the region suffix
The dropdown hard-codes https://ark.ap-southeast.bytepluses.com, but the official overseas Model Ark endpoint is https://ark.ap-southeast-1.byteplus.com (see the BytePlus international documentation linked in the PR description). With the current value, every “国际站” selection will point at a non-existent host, so all requests will fail.
Update the option to the documented host before shipping.
Based on learnings
🤖 Prompt for AI Agents
In web/src/components/table/channels/modals/EditChannelModal.jsx around lines
1811-1818, the dropdown option for the international Model Ark endpoint is
incorrect; replace the hard-coded 'https://ark.ap-southeast.bytepluses.com'
option (both value and label) with the documented host
'https://ark.ap-southeast-1.byteplus.com' so the "国际站" selection points to the
valid endpoint.
| system_prompt: '', | ||
| }); | ||
| const showApiConfigCard = inputs.type !== 45; // 控制是否显示 API 配置卡片(仅当渠道类型不是 豆包 时显示) | ||
| const showApiConfigCard = true; // 控制是否显示 API 配置卡片 |
|
感谢您的PR |
|
对于已存在渠道,没有设置默认值,导致编辑的时候无法保存 |
|
晚点会修复,当前电脑有点问题,我访问不了GitHub
|
没关系,好好休假,我已经改了 |
…e-base-url feat: volcengine支持自定义域名






例行检查
功能描述
volcengine支持自定义域名,如果未设置则使用默认域名
https://ark.cn-beijing.volces.com模型列表:
功能配置
测试用例
修改前:不支持自定义API域名
国内站点:


国外站点:
修改后:支持自定义API域名
国内站点:如果未设置则使用默认域名


https://ark.cn-beijing.volces.com国外站点:使用配置的自定义域名,如东南亚节点(新加坡)
https://ark.ap-southeast.bytepluses.com接口调试
请求api格式一致,model id不同,国内model id和国外model id基本差异在于国外model id没有前缀
doubao-国内api请求
返回值
{ "model": "doubao-seedream-4-0-250828", "created": 1758939814, "data": [ { "url": "https://ark-content-generation-v2-cn-beijing.tos-cn-beijing.volces.com/doubao-seedream-4-0/xxxxxxxx", "size": "3136x1344" } ], "usage": { "generated_images": 1, "output_tokens": 16464, "total_tokens": 16464 } }日志:

国外api请求
返回值
{ "model": "seedream-4-0-250828", "created": 1758940150, "data": [ { "url": "https://ark-content-generation-v2-ap-southeast-1.tos-ap-southeast-1.volces.com/seedream-4-0/xxxxxxxx", "size": "3136x1344" } ], "usage": { "generated_images": 1, "output_tokens": 16464, "total_tokens": 16464 } }日志:

Summary by CodeRabbit