Commit ddb27704 by JustSong

fix: fix the shared field is modified

parent b4142308
...@@ -14,12 +14,12 @@ import ( ...@@ -14,12 +14,12 @@ import (
"time" "time"
) )
func testChannel(channel *model.Channel, request *ChatRequest) error { func testChannel(channel *model.Channel, request ChatRequest) error {
if request.Model == "" { switch channel.Type {
request.Model = "gpt-3.5-turbo" case common.ChannelTypeAzure:
if channel.Type == common.ChannelTypeAzure {
request.Model = "gpt-35-turbo" request.Model = "gpt-35-turbo"
} default:
request.Model = "gpt-3.5-turbo"
} }
requestURL := common.ChannelBaseURLs[channel.Type] requestURL := common.ChannelBaseURLs[channel.Type]
if channel.Type == common.ChannelTypeAzure { if channel.Type == common.ChannelTypeAzure {
...@@ -97,7 +97,7 @@ func TestChannel(c *gin.Context) { ...@@ -97,7 +97,7 @@ func TestChannel(c *gin.Context) {
} }
testRequest := buildTestRequest(c) testRequest := buildTestRequest(c)
tik := time.Now() tik := time.Now()
err = testChannel(channel, testRequest) err = testChannel(channel, *testRequest)
tok := time.Now() tok := time.Now()
milliseconds := tok.Sub(tik).Milliseconds() milliseconds := tok.Sub(tik).Milliseconds()
go channel.UpdateResponseTime(milliseconds) go channel.UpdateResponseTime(milliseconds)
...@@ -165,7 +165,7 @@ func testAllChannels(c *gin.Context) error { ...@@ -165,7 +165,7 @@ func testAllChannels(c *gin.Context) error {
continue continue
} }
tik := time.Now() tik := time.Now()
err := testChannel(channel, testRequest) err := testChannel(channel, *testRequest)
tok := time.Now() tok := time.Now()
milliseconds := tok.Sub(tik).Milliseconds() milliseconds := tok.Sub(tik).Milliseconds()
if err != nil || milliseconds > disableThreshold { if err != nil || milliseconds > disableThreshold {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment