fix: testing channel reject if not 200
This commit is contained in:
parent
bde43cc358
commit
4b2cb573b6
@ -55,6 +55,10 @@ func testChannel(channel *model.Channel, request ChatRequest) error {
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if resp.StatusCode != 200 {
|
||||||
|
return errors.New("invalid status code: " + strconv.Itoa(resp.StatusCode))
|
||||||
|
}
|
||||||
|
|
||||||
var response TextResponse
|
var response TextResponse
|
||||||
isStream := strings.HasPrefix(resp.Header.Get("Content-Type"), "text/event-stream")
|
isStream := strings.HasPrefix(resp.Header.Get("Content-Type"), "text/event-stream")
|
||||||
var streamResponseText string
|
var streamResponseText string
|
||||||
|
2
main.go
2
main.go
@ -23,7 +23,7 @@ var buildFS embed.FS
|
|||||||
var indexPage []byte
|
var indexPage []byte
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
godotenv.Load()
|
godotenv.Load(".env")
|
||||||
|
|
||||||
common.SetupGinLog()
|
common.SetupGinLog()
|
||||||
common.SysLog("One API " + common.Version + " started")
|
common.SysLog("One API " + common.Version + " started")
|
||||||
|
Loading…
Reference in New Issue
Block a user