feat: add GetClaudeAuthHeader function and update FetchUpstreamModels to support Anthropic channel type

This commit is contained in:
RedwindA
2025-10-09 02:43:19 +08:00
parent 0c417e8ec6
commit 581c51f312
2 changed files with 12 additions and 3 deletions

View File

@@ -198,9 +198,10 @@ func FetchUpstreamModels(c *gin.Context) {
// 获取响应体 - 根据渠道类型决定是否添加 AuthHeader
var body []byte
key := strings.Split(channel.Key, "\n")[0]
if channel.Type == constant.ChannelTypeGemini {
body, err = GetResponseBody("GET", url, channel, GetAuthHeader(key)) // Use AuthHeader since Gemini now forces it
} else {
switch channel.Type {
case constant.ChannelTypeAnthropic:
body, err = GetResponseBody("GET", url, channel, GetClaudeAuthHeader(key))
default:
body, err = GetResponseBody("GET", url, channel, GetAuthHeader(key))
}
if err != nil {