mirror of
https://github.com/yangjian102621/geekai.git
synced 2025-09-18 01:06:39 +08:00
opt: add logs for mj-plus api error
This commit is contained in:
parent
1bee0ab04d
commit
169bf069ce
6
.dockerignore
Normal file
6
.dockerignore
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
deploy
|
||||||
|
docs
|
||||||
|
api/static
|
||||||
|
web/node_modules
|
||||||
|
desktop
|
||||||
|
|
@ -90,16 +90,15 @@ func (c *Client) Imagine(task types.MjTask) (ImageRes, error) {
|
|||||||
SetErrorResult(&errRes).
|
SetErrorResult(&errRes).
|
||||||
Post(apiURL)
|
Post(apiURL)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
if r.Body != nil {
|
if r != nil {
|
||||||
errStr, _ := io.ReadAll(r.Body)
|
errStr, _ := io.ReadAll(r.Body)
|
||||||
logger.Errorf("API 返回:%s, API URL: %s", string(errStr), apiURL)
|
logger.Errorf("API URL: %s, 返回:%s", string(errStr), apiURL)
|
||||||
}
|
}
|
||||||
return ImageRes{}, fmt.Errorf("请求 API 出错:%v", err)
|
return ImageRes{}, fmt.Errorf("请求 API 出错:%v", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
if r.IsErrorState() {
|
if r.IsErrorState() {
|
||||||
errStr, _ := io.ReadAll(r.Body)
|
return ImageRes{}, fmt.Errorf("API 返回错误:%s", errRes.Error.Message)
|
||||||
return ImageRes{}, fmt.Errorf("API 返回错误:%s,%v", errRes.Error.Message, string(errStr))
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return res, nil
|
return res, nil
|
||||||
|
@ -697,6 +697,7 @@ const fetchRunningJobs = (userId) => {
|
|||||||
dangerouslyUseHTMLString: true,
|
dangerouslyUseHTMLString: true,
|
||||||
message: `任务ID:${jobs[i]['task_id']}<br />原因:${jobs[i]['err_msg']}`,
|
message: `任务ID:${jobs[i]['task_id']}<br />原因:${jobs[i]['err_msg']}`,
|
||||||
type: 'error',
|
type: 'error',
|
||||||
|
duration: 0,
|
||||||
})
|
})
|
||||||
imgCalls.value += 1
|
imgCalls.value += 1
|
||||||
continue
|
continue
|
||||||
|
Loading…
Reference in New Issue
Block a user