🔖 chore: Replace API version in request URL

This commit is contained in:
MartialBE 2024-05-21 19:32:35 +08:00
parent fc51dffaca
commit 7ddeada284
No known key found for this signature in database
GPG Key ID: 27C0267EC84B0A5C
3 changed files with 9 additions and 2 deletions

View File

@ -102,6 +102,8 @@ func (p *OpenAIProvider) GetFullRequestURL(requestURL string, modelName string)
requestURL = fmt.Sprintf("/openai%s?api-version=%s", requestURL, apiVersion) requestURL = fmt.Sprintf("/openai%s?api-version=%s", requestURL, apiVersion)
} }
} else if p.Channel.Type == common.ChannelTypeCustom && p.Channel.Other != "" {
requestURL = strings.Replace(requestURL, "v1", p.Channel.Other, 1)
} }
if strings.HasPrefix(baseURL, "https://gateway.ai.cloudflare.com") { if strings.HasPrefix(baseURL, "https://gateway.ai.cloudflare.com") {

View File

@ -153,7 +153,8 @@ const EditModal = ({ open, channelId, onCancel, onOk, groupOptions }) => {
const res = await API.post(`/api/channel/provider_models_list`, { ...values, models: '' }); const res = await API.post(`/api/channel/provider_models_list`, { ...values, models: '' });
const { success, message, data } = res.data; const { success, message, data } = res.data;
if (success && data) { if (success && data) {
let modelList = data.map((model) => { let uniqueModels = Array.from(new Set(data));
let modelList = uniqueModels.map((model) => {
return { return {
id: model, id: model,
group: '自定义:点击或回车输入' group: '自定义:点击或回车输入'

View File

@ -54,7 +54,11 @@ const typeConfig = {
}, },
8: { 8: {
inputLabel: { inputLabel: {
provider_models_list: '从渠道获取模型列表' provider_models_list: '从渠道获取模型列表',
other: '替换 API 版本'
},
prompt: {
other: '输入后会替换请求地址中的v1例如freeapi则请求chat时会变成https://xxx.com/freeapi/chat/completions'
} }
}, },
3: { 3: {