支持ai gateway渠道的测试

This commit is contained in:
wood 2023-10-27 01:21:54 +08:00
parent ed3900d619
commit d0910f72e1

View File

@ -11,7 +11,7 @@ import (
"strconv"
"sync"
"time"
"strings"
"github.com/gin-gonic/gin"
)
@ -47,8 +47,11 @@ func testChannel(channel *model.Channel, request ChatRequest) (err error, openai
} else {
if channel.GetBaseURL() != "" {
requestURL = channel.GetBaseURL()
if !strings.HasPrefix(requestURL, "https://gateway.ai.cloudflare.com") {
requestURL += "/v1"
}
}
requestURL += "/v1/chat/completions"
requestURL += "/chat/completions"
}
jsonData, err := json.Marshal(request)