feat: MiniMax support (#50)

This commit is contained in:
Buer
2024-01-22 12:25:55 +08:00
committed by GitHub
parent 2cc120f35b
commit 705804e6dd
11 changed files with 601 additions and 2 deletions

View File

@@ -10,6 +10,7 @@ import (
"one-api/common"
"one-api/types"
"strconv"
"strings"
"github.com/gin-gonic/gin"
)
@@ -122,7 +123,7 @@ func (r *HTTPRequester) SendRequestRaw(req *http.Request) (*http.Response, *type
// 获取流式响应
func RequestStream[T streamable](requester *HTTPRequester, resp *http.Response, handlerPrefix HandlerPrefix[T]) (*streamReader[T], *types.OpenAIErrorWithStatusCode) {
// 如果返回的头是json格式 说明有错误
if resp.Header.Get("Content-Type") == "application/json" {
if strings.Contains(resp.Header.Get("Content-Type"), "application/json") {
return nil, HandleErrorResp(resp, requester.ErrorHandler)
}