fix(auth): refine authorization header setting for messages endpoint #1575
This commit is contained in:
@@ -197,8 +197,10 @@ func TokenAuth() func(c *gin.Context) {
|
|||||||
// 或者是否 x-api-key 不为空且存在anthropic-version
|
// 或者是否 x-api-key 不为空且存在anthropic-version
|
||||||
// 谁知道有多少不符合规范没写anthropic-version的
|
// 谁知道有多少不符合规范没写anthropic-version的
|
||||||
// 所以就这样随它去吧(
|
// 所以就这样随它去吧(
|
||||||
if strings.Contains(c.Request.URL.Path, "/v1/messages") || (anthropicKey != "" && c.Request.Header.Get("anthropic-version") != "") {
|
if strings.Contains(c.Request.URL.Path, "/v1/messages") {
|
||||||
c.Request.Header.Set("Authorization", "Bearer "+anthropicKey)
|
if anthropicKey != "" {
|
||||||
|
c.Request.Header.Set("Authorization", "Bearer "+anthropicKey)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
// gemini api 从query中获取key
|
// gemini api 从query中获取key
|
||||||
if strings.HasPrefix(c.Request.URL.Path, "/v1beta/models") ||
|
if strings.HasPrefix(c.Request.URL.Path, "/v1beta/models") ||
|
||||||
|
|||||||
Reference in New Issue
Block a user