mirror of
https://github.com/linux-do/new-api.git
synced 2025-09-17 16:06:38 +08:00
fix: make the 'openai_organization' parameter actually work.
This commit is contained in:
parent
652bb4a53c
commit
0fb98e44a7
@ -155,6 +155,9 @@ func Distribute() func(c *gin.Context) {
|
|||||||
if channel.AutoBan != nil && *channel.AutoBan == 0 {
|
if channel.AutoBan != nil && *channel.AutoBan == 0 {
|
||||||
ban = false
|
ban = false
|
||||||
}
|
}
|
||||||
|
if nil != channel.OpenAIOrganization {
|
||||||
|
c.Request.Header.Set("OpenAI-Organization", *channel.OpenAIOrganization)
|
||||||
|
}
|
||||||
c.Set("auto_ban", ban)
|
c.Set("auto_ban", ban)
|
||||||
c.Set("model_mapping", channel.GetModelMapping())
|
c.Set("model_mapping", channel.GetModelMapping())
|
||||||
c.Request.Header.Set("Authorization", fmt.Sprintf("Bearer %s", channel.Key))
|
c.Request.Header.Set("Authorization", fmt.Sprintf("Bearer %s", channel.Key))
|
||||||
|
@ -49,6 +49,12 @@ func (a *Adaptor) SetupRequestHeader(c *gin.Context, req *http.Request, info *re
|
|||||||
req.Header.Set("api-key", info.ApiKey)
|
req.Header.Set("api-key", info.ApiKey)
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
if info.ChannelType == common.ChannelTypeOpenAI {
|
||||||
|
orgId := c.GetHeader("OpenAI-Organization")
|
||||||
|
if "" != orgId {
|
||||||
|
req.Header.Set("OpenAI-Organization", orgId)
|
||||||
|
}
|
||||||
|
}
|
||||||
req.Header.Set("Authorization", "Bearer "+info.ApiKey)
|
req.Header.Set("Authorization", "Bearer "+info.ApiKey)
|
||||||
//if info.ChannelType == common.ChannelTypeOpenRouter {
|
//if info.ChannelType == common.ChannelTypeOpenRouter {
|
||||||
// req.Header.Set("HTTP-Referer", "https://github.com/songquanpeng/one-api")
|
// req.Header.Set("HTTP-Referer", "https://github.com/songquanpeng/one-api")
|
||||||
|
Loading…
Reference in New Issue
Block a user