mirror of
https://github.com/songquanpeng/one-api.git
synced 2025-11-20 23:16:49 +08:00
Merge 7f6eab77ab into 505817ca17
This commit is contained in:
@@ -244,6 +244,7 @@ func init() {
|
||||
Parent: nil,
|
||||
},
|
||||
{
|
||||
|
||||
Id: "gpt-4-vision-preview",
|
||||
Object: "model",
|
||||
Created: 1699593571,
|
||||
|
||||
@@ -48,6 +48,7 @@ func init() {
|
||||
}
|
||||
|
||||
func relayTextHelper(c *gin.Context, relayMode int) *OpenAIErrorWithStatusCode {
|
||||
|
||||
channelType := c.GetInt("channel")
|
||||
channelId := c.GetInt("channel_id")
|
||||
tokenId := c.GetInt("token_id")
|
||||
@@ -130,6 +131,11 @@ func relayTextHelper(c *gin.Context, relayMode int) *OpenAIErrorWithStatusCode {
|
||||
if c.GetString("base_url") != "" {
|
||||
baseURL = c.GetString("base_url")
|
||||
}
|
||||
Organization := ""
|
||||
if c.GetString("openai_organization") != "" {
|
||||
Organization = c.GetString("openai_organization")
|
||||
}
|
||||
|
||||
fullRequestURL := getFullRequestURL(baseURL, requestURL, channelType)
|
||||
switch apiType {
|
||||
case APITypeOpenAI:
|
||||
@@ -368,6 +374,9 @@ func relayTextHelper(c *gin.Context, relayMode int) *OpenAIErrorWithStatusCode {
|
||||
req.Header.Set("HTTP-Referer", "https://github.com/songquanpeng/one-api")
|
||||
req.Header.Set("X-Title", "One API")
|
||||
}
|
||||
if Organization != "" {
|
||||
req.Header.Set("OpenAI-Organization", Organization)
|
||||
}
|
||||
}
|
||||
case APITypeClaude:
|
||||
req.Header.Set("x-api-key", apiKey)
|
||||
|
||||
Reference in New Issue
Block a user