fix: correct OpenAI error code's type
This commit is contained in:
parent
4339f45f74
commit
f97a9ce597
@ -59,7 +59,7 @@ func testChannel(channel *model.Channel, request *ChatRequest) error {
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
if response.Usage.CompletionTokens == 0 {
|
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
|
return nil
|
||||||
}
|
}
|
||||||
|
@ -65,7 +65,7 @@ type OpenAIError struct {
|
|||||||
Message string `json:"message"`
|
Message string `json:"message"`
|
||||||
Type string `json:"type"`
|
Type string `json:"type"`
|
||||||
Param string `json:"param"`
|
Param string `json:"param"`
|
||||||
Code string `json:"code"`
|
Code any `json:"code"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type OpenAIErrorWithStatusCode struct {
|
type OpenAIErrorWithStatusCode struct {
|
||||||
|
Loading…
Reference in New Issue
Block a user