渠道: 移除主页/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
-6
View File
@@ -49,12 +49,6 @@ func main() {
fmt.Fprint(w, `{"object":"list","data":[{"id":"gpt-4o-mini","object":"model"},{"id":"gpt-4o","object":"model"},{"id":"claude-sonnet-5","object":"model"}]}`)
})
// favicon(演示渠道主页图标)
http.HandleFunc("/favicon.ico", func(w http.ResponseWriter, r *http.Request) {
w.Header().Set("Content-Type", "image/svg+xml")
fmt.Fprint(w, `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16"><rect width="16" height="16" rx="4" fill="#34d399"/><path d="M4 4.6h8v1.4H4zM4 7.3h8v1.4H4zM4 10h5v1.4H4z" fill="#09090b"/></svg>`)
})
// Anthropic Messages 端点(provider=anthropic 的渠道走这里)
http.HandleFunc("/v1/messages", func(w http.ResponseWriter, r *http.Request) {
body, _ := io.ReadAll(r.Body)