mirror of
https://github.com/linux-do/new-api.git
synced 2025-09-18 00:16:37 +08:00
fix: 修复测试渠道指定模型时实际使用gpt-3.5-turbo的问题 (close #67)
This commit is contained in:
parent
608c945ae6
commit
569751f5db
@ -16,6 +16,7 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
func testChannel(channel *model.Channel, request ChatRequest) (err error, openaiErr *OpenAIError) {
|
func testChannel(channel *model.Channel, request ChatRequest) (err error, openaiErr *OpenAIError) {
|
||||||
|
common.SysLog(fmt.Sprintf("testing channel %d with model %s", channel.Id, request.Model))
|
||||||
switch channel.Type {
|
switch channel.Type {
|
||||||
case common.ChannelTypePaLM:
|
case common.ChannelTypePaLM:
|
||||||
fallthrough
|
fallthrough
|
||||||
@ -113,7 +114,7 @@ func TestChannel(c *gin.Context) {
|
|||||||
})
|
})
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
testModel := c.Param("model")
|
testModel := c.Query("model")
|
||||||
channel, err := model.GetChannelById(id, true)
|
channel, err := model.GetChannelById(id, true)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
c.JSON(http.StatusOK, gin.H{
|
c.JSON(http.StatusOK, gin.H{
|
||||||
|
@ -463,11 +463,8 @@ const ChannelsTable = () => {
|
|||||||
const res = await API.get(`/api/channel/test/${record.id}?model=${model}`);
|
const res = await API.get(`/api/channel/test/${record.id}?model=${model}`);
|
||||||
const {success, message, time} = res.data;
|
const {success, message, time} = res.data;
|
||||||
if (success) {
|
if (success) {
|
||||||
let newChannels = [...channels];
|
|
||||||
record.response_time = time * 1000;
|
record.response_time = time * 1000;
|
||||||
record.test_time = Date.now() / 1000;
|
record.test_time = Date.now() / 1000;
|
||||||
|
|
||||||
setChannelFormat(newChannels)
|
|
||||||
showInfo(`通道 ${record.name} 测试成功,耗时 ${time.toFixed(2)} 秒。`);
|
showInfo(`通道 ${record.name} 测试成功,耗时 ${time.toFixed(2)} 秒。`);
|
||||||
} else {
|
} else {
|
||||||
showError(message);
|
showError(message);
|
||||||
|
Loading…
Reference in New Issue
Block a user