From affe5111ccc4cb9d544602338039f7d5b3349d65 Mon Sep 17 00:00:00 2001 From: CaIon <1808837298@qq.com> Date: Thu, 1 Feb 2024 18:31:42 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E6=94=AF=E6=8C=81=E6=B5=8B=E8=AF=95?= =?UTF-8?q?=E6=B8=A0=E9=81=93=E6=97=B6=E8=87=AA=E9=80=89=E6=A8=A1=E5=9E=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- controller/channel-test.go | 12 ++++++++++-- web/src/components/ChannelsTable.js | 30 ++++++++++++++++++++++++----- 2 files changed, 35 insertions(+), 7 deletions(-) diff --git a/controller/channel-test.go b/controller/channel-test.go index b20bbeb..1409e41 100644 --- a/controller/channel-test.go +++ b/controller/channel-test.go @@ -34,14 +34,18 @@ func testChannel(channel *model.Channel, request ChatRequest) (err error, openai case common.ChannelTypeXunfei: return errors.New("该渠道类型当前版本不支持测试,请手动测试"), nil case common.ChannelTypeAzure: - request.Model = "gpt-35-turbo" + if request.Model == "" { + request.Model = "gpt-35-turbo" + } defer func() { if err != nil { err = errors.New("请确保已在 Azure 上创建了 gpt-35-turbo 模型,并且 apiVersion 已正确填写!") } }() default: - request.Model = "gpt-3.5-turbo" + if request.Model == "" { + request.Model = "gpt-3.5-turbo" + } } requestURL := getFullRequestURL(channel.GetBaseURL(), "/v1/chat/completions", channel.Type) @@ -102,6 +106,7 @@ func TestChannel(c *gin.Context) { }) return } + testModel := c.Param("model") channel, err := model.GetChannelById(id, true) if err != nil { c.JSON(http.StatusOK, gin.H{ @@ -111,6 +116,9 @@ func TestChannel(c *gin.Context) { return } testRequest := buildTestRequest() + if testModel != "" { + testRequest.Model = testModel + } tik := time.Now() err, _ = testChannel(channel, *testRequest) tok := time.Now() diff --git a/web/src/components/ChannelsTable.js b/web/src/components/ChannelsTable.js index 5611743..47b5131 100644 --- a/web/src/components/ChannelsTable.js +++ b/web/src/components/ChannelsTable.js @@ -23,9 +23,10 @@ import { Space, Tooltip, Switch, - Typography, InputNumber + Typography, InputNumber, Dropdown, SplitButtonGroup } from "@douyinfe/semi-ui"; import EditChannel from "../pages/Channel/EditChannel"; +import {IconTreeTriangleDown} from "@douyinfe/semi-icons"; function renderTimestamp(timestamp) { return ( @@ -195,7 +196,14 @@ const ChannelsTable = () => { dataIndex: 'operate', render: (text, record, index) => (