fix: fix the shared field is modified

This commit is contained in:
JustSong 2023-06-18 00:20:06 +08:00
parent d97640374c
commit 1cb1f727c0

View File

@ -14,12 +14,12 @@ import (
"time"
)
func testChannel(channel *model.Channel, request *ChatRequest) error {
if request.Model == "" {
func testChannel(channel *model.Channel, request ChatRequest) error {
switch channel.Type {
case common.ChannelTypeAzure:
request.Model = "gpt-35-turbo"
default:
request.Model = "gpt-3.5-turbo"
if channel.Type == common.ChannelTypeAzure {
request.Model = "gpt-35-turbo"
}
}
requestURL := common.ChannelBaseURLs[channel.Type]
if channel.Type == common.ChannelTypeAzure {
@ -97,7 +97,7 @@ func TestChannel(c *gin.Context) {
}
testRequest := buildTestRequest(c)
tik := time.Now()
err = testChannel(channel, testRequest)
err = testChannel(channel, *testRequest)
tok := time.Now()
milliseconds := tok.Sub(tik).Milliseconds()
go channel.UpdateResponseTime(milliseconds)
@ -165,7 +165,7 @@ func testAllChannels(c *gin.Context) error {
continue
}
tik := time.Now()
err := testChannel(channel, testRequest)
err := testChannel(channel, *testRequest)
tok := time.Now()
milliseconds := tok.Sub(tik).Milliseconds()
if err != nil || milliseconds > disableThreshold {