🔖 chore: allow to remove openai version number (#232)

This commit is contained in:
MartialBE 2024-05-29 13:44:44 +08:00
parent 23f7dd0612
commit 7d90e43492
No known key found for this signature in database
GPG Key ID: 27C0267EC84B0A5C
2 changed files with 9 additions and 2 deletions

View File

@ -111,7 +111,13 @@ func (p *OpenAIProvider) GetFullRequestURL(requestURL string, modelName string)
}
} else if p.Channel.Type == config.ChannelTypeCustom && p.Channel.Other != "" {
requestURL = strings.Replace(requestURL, "v1", p.Channel.Other, 1)
if p.Channel.Other == "disable" {
p.Channel.Other = ""
} else {
p.Channel.Other = "/" + p.Channel.Other
}
requestURL = strings.Replace(requestURL, "/v1", p.Channel.Other, 1)
}
if strings.HasPrefix(baseURL, "https://gateway.ai.cloudflare.com") {

View File

@ -58,7 +58,8 @@ const typeConfig = {
other: '替换 API 版本'
},
prompt: {
other: '输入后会替换请求地址中的v1例如freeapi则请求chat时会变成https://xxx.com/freeapi/chat/completions'
other:
'输入后会替换请求地址中的v1例如freeapi则请求chat时会变成https://xxx.com/freeapi/chat/completions,如果需要禁用版本号,请输入 disable'
}
},
3: {