From 4b2cb573b63c05b0275132be6a3a7623eba5dfdc Mon Sep 17 00:00:00 2001 From: ckt1031 <65409152+ckt1031@users.noreply.github.com> Date: Mon, 10 Jul 2023 23:09:15 +0800 Subject: [PATCH] fix: testing channel reject if not 200 --- controller/channel-test.go | 4 ++++ main.go | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/controller/channel-test.go b/controller/channel-test.go index 4625b576..0469019a 100644 --- a/controller/channel-test.go +++ b/controller/channel-test.go @@ -55,6 +55,10 @@ func testChannel(channel *model.Channel, request ChatRequest) error { return err } + if resp.StatusCode != 200 { + return errors.New("invalid status code: " + strconv.Itoa(resp.StatusCode)) + } + var response TextResponse isStream := strings.HasPrefix(resp.Header.Get("Content-Type"), "text/event-stream") var streamResponseText string diff --git a/main.go b/main.go index 4447509d..6fd55f8d 100644 --- a/main.go +++ b/main.go @@ -23,7 +23,7 @@ var buildFS embed.FS var indexPage []byte func main() { - godotenv.Load() + godotenv.Load(".env") common.SetupGinLog() common.SysLog("One API " + common.Version + " started")