🐛 fix: fix panic caused by errors (#106)

This commit is contained in:
Martial BE 2024-03-13 11:22:01 +08:00
parent 113ed77bb9
commit d941faac9f
No known key found for this signature in database
GPG Key ID: D06C32DF0EDB9084

View File

@ -2,6 +2,7 @@ package minimax
import ( import (
"encoding/json" "encoding/json"
"errors"
"net/http" "net/http"
"one-api/common" "one-api/common"
"one-api/common/requester" "one-api/common/requester"
@ -62,7 +63,7 @@ func (p *MiniMaxProvider) getChatRequest(request *types.ChatCompletionRequest) (
// 获取请求地址 // 获取请求地址
fullRequestURL := p.GetFullRequestURL(url, request.Model) fullRequestURL := p.GetFullRequestURL(url, request.Model)
if fullRequestURL == "" { if fullRequestURL == "" {
return nil, common.ErrorWrapper(nil, "invalid_minimax_config", http.StatusInternalServerError) return nil, common.ErrorWrapper(errors.New("API KEY is filled in incorrectly"), "invalid_minimax_config", http.StatusInternalServerError)
} }
// 获取请求头 // 获取请求头