mirror of
https://github.com/yangjian102621/geekai.git
synced 2025-11-12 04:03:42 +08:00
chore: print error detail when call http api failed with mj
This commit is contained in:
@@ -5,6 +5,8 @@ import (
|
||||
logger2 "chatplus/logger"
|
||||
"errors"
|
||||
"fmt"
|
||||
"io"
|
||||
|
||||
"github.com/imroc/req/v3"
|
||||
)
|
||||
|
||||
@@ -63,7 +65,8 @@ func (c *Client) Imagine(prompt string) (ImageRes, error) {
|
||||
SetErrorResult(&errRes).
|
||||
Post(apiURL)
|
||||
if err != nil {
|
||||
return ImageRes{}, fmt.Errorf("请求 API 出错:%v", err)
|
||||
errStr, _ := io.ReadAll(r.Body)
|
||||
return ImageRes{}, fmt.Errorf("请求 API 出错:%v,%v", err, string(errStr))
|
||||
}
|
||||
|
||||
if r.IsErrorState() {
|
||||
|
||||
Reference in New Issue
Block a user