Commit da8a52f5 by CaIon

feat: add conditional setting for HTTP headers in OpenRouter channel type

parent 9fdb0bc2
...@@ -225,8 +225,12 @@ func (a *Adaptor) SetupRequestHeader(c *gin.Context, header *http.Header, info * ...@@ -225,8 +225,12 @@ func (a *Adaptor) SetupRequestHeader(c *gin.Context, header *http.Header, info *
} }
} }
if info.ChannelType == constant.ChannelTypeOpenRouter { if info.ChannelType == constant.ChannelTypeOpenRouter {
header.Set("HTTP-Referer", "https://www.newapi.ai") if header.Get("HTTP-Referer") == "" {
header.Set("X-OpenRouter-Title", "New API") header.Set("HTTP-Referer", "https://www.newapi.ai")
}
if header.Get("X-OpenRouter-Title") == "" {
header.Set("X-OpenRouter-Title", "New API")
}
} }
return nil return nil
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment