more keyboards

This commit is contained in:
2026-01-22 16:41:47 +03:00
parent 015d5b904a
commit 1ef0bd503a
4 changed files with 80 additions and 43 deletions

View File

@@ -123,7 +123,14 @@ func (o *OpenAIAPI) DoRequest(url string, params any) ([]byte, error) {
if res.StatusCode == 504 || res.StatusCode == 400 || res.StatusCode == 502 {
o.Logger.Warn(fmt.Sprintf("[%d] %s", res.StatusCode, res.Status))
time.Sleep(5 * time.Second)
return o.DoRequest(url, params)
res, err = o.client.Do(req)
if err != nil {
return nil, err
}
defer res.Body.Close()
if res.StatusCode == 504 || res.StatusCode == 400 || res.StatusCode == 502 {
return nil, fmt.Errorf("[%d] %s", res.StatusCode, res.Status)
}
}
responseBody, err = io.ReadAll(res.Body)
if err != nil {