This commit is contained in:
WangBooth
2024-01-01 17:52:20 +08:00
committed by GitHub
5 changed files with 31 additions and 3 deletions

View File

@@ -244,6 +244,7 @@ func init() {
Parent: nil,
},
{
Id: "gpt-4-vision-preview",
Object: "model",
Created: 1699593571,

View File

@@ -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)