From 84da88506f91de31c73b3682c2f6e4ec61ac1048 Mon Sep 17 00:00:00 2001 From: CaIon <1808837298@qq.com> Date: Sat, 18 May 2024 16:06:12 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E8=87=AA=E5=AE=9A=E4=B9=89=E6=B8=A0?= =?UTF-8?q?=E9=81=93=E5=8A=9F=E8=83=BD=E5=8F=98=E6=9B=B4=20(#262)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- relay/channel/openai/adaptor.go | 8 ++++---- web/src/pages/Channel/EditChannel.js | 18 +++++++++++------- 2 files changed, 15 insertions(+), 11 deletions(-) diff --git a/relay/channel/openai/adaptor.go b/relay/channel/openai/adaptor.go index 46d827a..a0a5b07 100644 --- a/relay/channel/openai/adaptor.go +++ b/relay/channel/openai/adaptor.go @@ -41,10 +41,10 @@ func (a *Adaptor) GetRequestURL(info *relaycommon.RelayInfo) (string, error) { return relaycommon.GetFullRequestURL(info.BaseUrl, requestURL, info.ChannelType), nil case common.ChannelTypeMiniMax: return minimax.GetRequestURL(info) - //case common.ChannelTypeCustom: - // url := info.BaseUrl - // url = strings.Replace(url, "{model}", info.UpstreamModelName, -1) - // return url, nil + case common.ChannelTypeCustom: + url := info.BaseUrl + url = strings.Replace(url, "{model}", info.UpstreamModelName, -1) + return url, nil default: return relaycommon.GetFullRequestURL(info.BaseUrl, info.RequestURLPath, info.ChannelType), nil } diff --git a/web/src/pages/Channel/EditChannel.js b/web/src/pages/Channel/EditChannel.js index 03b8e3b..a32a065 100644 --- a/web/src/pages/Channel/EditChannel.js +++ b/web/src/pages/Channel/EditChannel.js @@ -301,17 +301,18 @@ const EditChannel = (props) => { const addCustomModels = () => { if (customModel.trim() === '') return; // 使用逗号分隔字符串,然后去除每个模型名称前后的空格 - const modelArray = customModel.split(',').map(model => model.trim()); - + const modelArray = customModel.split(',').map((model) => model.trim()); + let localModels = [...inputs.models]; let localModelOptions = [...modelOptions]; let hasError = false; - modelArray.forEach(model => { + modelArray.forEach((model) => { // 检查模型是否已存在,且模型名称非空 if (model && !localModels.includes(model)) { localModels.push(model); // 添加到模型列表 - localModelOptions.push({ // 添加到下拉选项 + localModelOptions.push({ + // 添加到下拉选项 key: model, text: model, value: model, @@ -330,7 +331,6 @@ const EditChannel = (props) => { handleInputChange('models', localModels); }; - return ( <> { {inputs.type === 8 && ( <>
- Base URL: + + 完整的 Base URL,支持变量{'{model}'}: +
{ handleInputChange('base_url', value); }}