♻️ refactor: 重构http请求函数

This commit is contained in:
Martial BE
2023-11-30 13:49:35 +08:00
parent 96dc7614e6
commit 7c6dee7390
17 changed files with 116 additions and 143 deletions

View File

@@ -21,9 +21,9 @@ func (p *OpenaiSBProvider) Balance(channel *model.Channel) (float64, error) {
// 发送请求
var response OpenAISBUsageResponse
err = client.SendRequest(req, &response)
_, errWithCode := common.SendRequest(req, &response, false)
if err != nil {
return 0, err
return 0, errors.New(errWithCode.OpenAIError.Message)
}
if response.Data == nil {