渠道: 移除主页/favicon 特性, Base URL 可选+完整地址

- 回退渠道 homepage/favicon 字段与代理接口(未采用)
- Base URL 改为可选: 留空按供应商默认(openai/anthropic),
  兼容兼容型渠道必须填; 填完整地址(含 /v1)时归一化去尾
- 网关 upstreamURL 兜底去 /v1, 避免路径重复

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
Sakurasan
2026-08-15 20:55:17 +08:00
co-authored by Claude
parent 4f92d7e0a4
commit d0bc28a4fe
8 changed files with 57 additions and 126 deletions
+3 -1
View File
@@ -44,8 +44,10 @@ func parseBody(c *gin.Context) (*bodyReq, []byte, error) {
}
// upstreamURL 组装上游地址:base_url + 路径。
// 兼容用户填完整 base(含 /v1):去掉尾部 /v1,避免与请求路径重复。
func upstreamURL(ch *store.Channel, path string) string {
return strings.TrimRight(ch.BaseURL, "/") + path
base := strings.TrimRight(ch.BaseURL, "/")
return strings.TrimSuffix(base, "/v1") + path
}
// doProxy 通用代理(M5):遍历候选渠道,按需转换;可安全重试的失败自动故障转移。