* fix json marshaling error response of azure openai (#343) * add a test case for handleErrorResp func (#343)
This commit is contained in:
committed by
GitHub
parent
b8c13e4c01
commit
06b16a7281
10
error.go
10
error.go
@@ -44,9 +44,13 @@ func (e *APIError) UnmarshalJSON(data []byte) (err error) {
|
||||
return
|
||||
}
|
||||
|
||||
err = json.Unmarshal(rawMap["type"], &e.Type)
|
||||
if err != nil {
|
||||
return
|
||||
// optional fields for azure openai
|
||||
// refs: https://github.com/sashabaranov/go-openai/issues/343
|
||||
if _, ok := rawMap["type"]; ok {
|
||||
err = json.Unmarshal(rawMap["type"], &e.Type)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
// optional fields
|
||||
|
||||
Reference in New Issue
Block a user