mirror of
https://github.com/QuantumNous/new-api.git
synced 2026-04-21 05:58:38 +00:00
feat: 支持仅使用x-api-key获取anthropic格式的模型列表 注释增加
This commit is contained in:
@@ -193,7 +193,7 @@ func TokenAuth() func(c *gin.Context) {
|
|||||||
}
|
}
|
||||||
c.Request.Header.Set("Authorization", "Bearer "+key)
|
c.Request.Header.Set("Authorization", "Bearer "+key)
|
||||||
}
|
}
|
||||||
// 检查path包含/v1/messages
|
// 检查path包含/v1/messages 或 /v1/models
|
||||||
if strings.Contains(c.Request.URL.Path, "/v1/messages") || strings.Contains(c.Request.URL.Path, "/v1/models") {
|
if strings.Contains(c.Request.URL.Path, "/v1/messages") || strings.Contains(c.Request.URL.Path, "/v1/models") {
|
||||||
anthropicKey := c.Request.Header.Get("x-api-key")
|
anthropicKey := c.Request.Header.Get("x-api-key")
|
||||||
if anthropicKey != "" {
|
if anthropicKey != "" {
|
||||||
|
|||||||
Reference in New Issue
Block a user