From f97a9ce597650d01c95353eabfde9f61c9e3d77a Mon Sep 17 00:00:00 2001 From: JustSong Date: Sun, 11 Jun 2023 09:49:57 +0800 Subject: [PATCH] fix: correct OpenAI error code's type --- controller/channel-test.go | 2 +- controller/relay.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/controller/channel-test.go b/controller/channel-test.go index 838a273..ec865b2 100644 --- a/controller/channel-test.go +++ b/controller/channel-test.go @@ -59,7 +59,7 @@ func testChannel(channel *model.Channel, request *ChatRequest) error { return err } if response.Usage.CompletionTokens == 0 { - return errors.New(fmt.Sprintf("type %s, code %s, message %s", response.Error.Type, response.Error.Code, response.Error.Message)) + return errors.New(fmt.Sprintf("type %s, code %v, message %s", response.Error.Type, response.Error.Code, response.Error.Message)) } return nil } diff --git a/controller/relay.go b/controller/relay.go index a581d3c..63b77e4 100644 --- a/controller/relay.go +++ b/controller/relay.go @@ -65,7 +65,7 @@ type OpenAIError struct { Message string `json:"message"` Type string `json:"type"` Param string `json:"param"` - Code string `json:"code"` + Code any `json:"code"` } type OpenAIErrorWithStatusCode struct {