diff --git a/controller/relay.go b/controller/relay.go index 412f951b..28c8c80d 100644 --- a/controller/relay.go +++ b/controller/relay.go @@ -75,7 +75,8 @@ func Playground(c *gin.Context) { } channel, err := model.CacheGetRandomSatisfiedChannel(group, playgroundRequest.Model, 0) if err != nil { - openaiErr = service.OpenAIErrorWrapperLocal(err, "get_playground_channel_failed", http.StatusInternalServerError) + message := fmt.Sprintf("当前分组 %s 下对于模型 %s 无可用渠道", group, playgroundRequest.Model) + openaiErr = service.OpenAIErrorWrapperLocal(errors.New(message), "get_playground_channel_failed", http.StatusInternalServerError) return } middleware.SetupContextForSelectedChannel(c, channel, playgroundRequest.Model) diff --git a/web/src/components/Playground.js b/web/src/components/Playground.js index f512bb92..c080e13b 100644 --- a/web/src/components/Playground.js +++ b/web/src/components/Playground.js @@ -133,7 +133,9 @@ const Playground = () => { completeMessage(); } else { let text = payload.choices[0].delta.content; - generateMockResponse(text); + if (text) { + generateMockResponse(text); + } } } else { completeMessage(); @@ -186,7 +188,7 @@ const Playground = () => { stream: true, model: inputs.model, group: inputs.group, - max_tokens: inputs.max_tokens, + max_tokens: parseInt(inputs.max_tokens), temperature: inputs.temperature, }; };