fix: fix the shared field is modified
This commit is contained in:
parent
d97640374c
commit
1cb1f727c0
@ -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 {
|
||||||
|
case common.ChannelTypeAzure:
|
||||||
|
request.Model = "gpt-35-turbo"
|
||||||
|
default:
|
||||||
request.Model = "gpt-3.5-turbo"
|
request.Model = "gpt-3.5-turbo"
|
||||||
if channel.Type == common.ChannelTypeAzure {
|
|
||||||
request.Model = "gpt-35-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) {
|
|||||||
}
|
}
|
||||||
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 {
|
|||||||
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 {
|
||||||
|
Loading…
Reference in New Issue
Block a user