Просмотр исходного кода

fix: correct OpenAI error code's type

JustSong 2 лет назад
Родитель
Сommit
f97a9ce597
2 измененных файлов с 2 добавлено и 2 удалено
  1. 1 1
      controller/channel-test.go
  2. 1 1
      controller/relay.go

+ 1 - 1
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
 }

+ 1 - 1
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 {