diff --git a/providers/openai/base.go b/providers/openai/base.go index b586345e..4565c4ab 100644 --- a/providers/openai/base.go +++ b/providers/openai/base.go @@ -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") { diff --git a/web/src/views/Channel/type/Config.js b/web/src/views/Channel/type/Config.js index 35d2c8df..03582bfb 100644 --- a/web/src/views/Channel/type/Config.js +++ b/web/src/views/Channel/type/Config.js @@ -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: {