fix channel test

This commit is contained in:
quzard 2023-06-19 11:32:12 +08:00
parent e8b50b3e78
commit 8bfea688a7
2 changed files with 2 additions and 1 deletions

View File

@ -58,7 +58,7 @@ func testChannel(channel *model.Channel, request ChatRequest) error {
if err != nil { if err != nil {
return err return err
} }
if response.Usage.CompletionTokens == 0 { if response.Id == "" {
return errors.New(fmt.Sprintf("type %s, code %v, 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 return nil

View File

@ -70,6 +70,7 @@ type OpenAIErrorWithStatusCode struct {
} }
type TextResponse struct { type TextResponse struct {
Id string `json:"id"`
Usage `json:"usage"` Usage `json:"usage"`
Error OpenAIError `json:"error"` Error OpenAIError `json:"error"`
} }