Explorar o código

feat: 支持仅使用x-api-key获取anthropic格式的模型列表

hackerxiao hai 2 meses
pai
achega
2a16c37aab
Modificáronse 1 ficheiros con 1 adicións e 1 borrados
  1. 1 1
      middleware/auth.go

+ 1 - 1
middleware/auth.go

@@ -194,7 +194,7 @@ func TokenAuth() func(c *gin.Context) {
 			c.Request.Header.Set("Authorization", "Bearer "+key)
 		}
 		// 检查path包含/v1/messages
-		if strings.Contains(c.Request.URL.Path, "/v1/messages") {
+		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")
 			if anthropicKey != "" {
 				c.Request.Header.Set("Authorization", "Bearer "+anthropicKey)