mirror of
https://github.com/yangjian102621/geekai.git
synced 2025-09-17 16:56:38 +08:00
feat: add err_msg field for mj and sd jobs
This commit is contained in:
parent
96785ca037
commit
6d85d128cc
@ -1,4 +1,11 @@
|
|||||||
# 更新日志
|
# 更新日志
|
||||||
|
## v3.2.7
|
||||||
|
* 功能重构:采用 Vant 重构移动页面,新增 MidJourney 功能
|
||||||
|
* 功能优化:优化 PC 端 MidJourney 页面布局,新增融图和换脸功能
|
||||||
|
* Bug修复:修复 issue [
|
||||||
|
管理界面操作用户存在的两个问题](https://github.com/yangjian102621/chatgpt-plus/issues/117#issuecomment-1909201532)
|
||||||
|
* 功能优化:在对话和聊天记录表中新增冗余字段 model,存储对话模型
|
||||||
|
|
||||||
## v3.2.6
|
## v3.2.6
|
||||||
* 功能优化:恢复关闭注册系统配置项,管理员可以在后台关闭用户注册,只允许内部添加账号
|
* 功能优化:恢复关闭注册系统配置项,管理员可以在后台关闭用户注册,只允许内部添加账号
|
||||||
* 功能优化:兼用旧版本微信收款消息解析
|
* 功能优化:兼用旧版本微信收款消息解析
|
||||||
|
@ -86,9 +86,13 @@ func (s *Service) Run() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if err != nil || (res.Code != 1 && res.Code != 22) {
|
if err != nil || (res.Code != 1 && res.Code != 22) {
|
||||||
logger.Error("绘画任务执行失败:", err, res.Description)
|
errMsg := err.Error() + res.Description
|
||||||
|
logger.Error("绘画任务执行失败:", errMsg)
|
||||||
// update the task progress
|
// update the task progress
|
||||||
s.db.Model(&model.MidJourneyJob{Id: uint(task.Id)}).UpdateColumn("progress", -1)
|
s.db.Model(&model.MidJourneyJob{Id: uint(task.Id)}).UpdateColumns(map[string]interface{}{
|
||||||
|
"progress": -1,
|
||||||
|
"err_msg": errMsg,
|
||||||
|
})
|
||||||
// 任务失败,通知前端
|
// 任务失败,通知前端
|
||||||
s.notifyQueue.RPush(task.UserId)
|
s.notifyQueue.RPush(task.UserId)
|
||||||
// restore img_call quota
|
// restore img_call quota
|
||||||
|
@ -217,7 +217,10 @@ func (p *ServicePool) SyncTaskProgress() {
|
|||||||
}
|
}
|
||||||
// 任务失败了
|
// 任务失败了
|
||||||
if task.FailReason != "" {
|
if task.FailReason != "" {
|
||||||
p.db.Model(&model.MidJourneyJob{Id: v.Id}).UpdateColumn("progress", -1)
|
p.db.Model(&model.MidJourneyJob{Id: v.Id}).UpdateColumns(map[string]interface{}{
|
||||||
|
"progress": -1,
|
||||||
|
"err_msg": task.FailReason,
|
||||||
|
})
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
if len(task.Buttons) > 0 {
|
if len(task.Buttons) > 0 {
|
||||||
|
@ -82,9 +82,12 @@ func (s *Service) Run() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
logger.Error("绘画任务执行失败:", err)
|
logger.Error("绘画任务执行失败:", err.Error())
|
||||||
// update the task progress
|
// update the task progress
|
||||||
s.db.Model(&model.MidJourneyJob{Id: uint(task.Id)}).UpdateColumn("progress", -1)
|
s.db.Model(&model.MidJourneyJob{Id: uint(task.Id)}).UpdateColumns(map[string]interface{}{
|
||||||
|
"progress": -1,
|
||||||
|
"err_msg": err.Error(),
|
||||||
|
})
|
||||||
s.notifyQueue.RPush(task.UserId)
|
s.notifyQueue.RPush(task.UserId)
|
||||||
// restore img_call quota
|
// restore img_call quota
|
||||||
if task.Type.String() != types.TaskUpscale.String() {
|
if task.Type.String() != types.TaskUpscale.String() {
|
||||||
|
@ -68,9 +68,12 @@ func (s *Service) Run() {
|
|||||||
logger.Infof("%s handle a new Stable-Diffusion task: %+v", s.name, task)
|
logger.Infof("%s handle a new Stable-Diffusion task: %+v", s.name, task)
|
||||||
err = s.Txt2Img(task)
|
err = s.Txt2Img(task)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
logger.Error("绘画任务执行失败:", err)
|
logger.Error("绘画任务执行失败:", err.Error())
|
||||||
// update the task progress
|
// update the task progress
|
||||||
s.db.Model(&model.SdJob{Id: uint(task.Id)}).UpdateColumn("progress", -1)
|
s.db.Model(&model.SdJob{Id: uint(task.Id)}).UpdateColumns(map[string]interface{}{
|
||||||
|
"progress": -1,
|
||||||
|
"err_msg": err.Error(),
|
||||||
|
})
|
||||||
// restore img_call quota
|
// restore img_call quota
|
||||||
s.db.Model(&model.User{}).Where("id = ?", task.UserId).UpdateColumn("img_calls", gorm.Expr("img_calls + ?", 1))
|
s.db.Model(&model.User{}).Where("id = ?", task.UserId).UpdateColumn("img_calls", gorm.Expr("img_calls + ?", 1))
|
||||||
// release task num
|
// release task num
|
||||||
@ -300,7 +303,10 @@ func (s *Service) callback(data CBReq) {
|
|||||||
} else { // 任务失败
|
} else { // 任务失败
|
||||||
logger.Error("任务执行失败:", data.Message)
|
logger.Error("任务执行失败:", data.Message)
|
||||||
// update the task progress
|
// update the task progress
|
||||||
s.db.Model(&model.SdJob{Id: uint(data.JobId)}).UpdateColumn("progress", -1)
|
s.db.Model(&model.SdJob{Id: uint(data.JobId)}).UpdateColumns(map[string]interface{}{
|
||||||
|
"progress": -1,
|
||||||
|
"err_msg": data.Message,
|
||||||
|
})
|
||||||
// restore img_calls
|
// restore img_calls
|
||||||
s.db.Model(&model.User{}).Where("id = ? AND img_calls > 0", data.UserId).UpdateColumn("img_calls", gorm.Expr("img_calls + ?", 1))
|
s.db.Model(&model.User{}).Where("id = ? AND img_calls > 0", data.UserId).UpdateColumn("img_calls", gorm.Expr("img_calls + ?", 1))
|
||||||
}
|
}
|
||||||
|
@ -15,8 +15,9 @@ type MidJourneyJob struct {
|
|||||||
Hash string // message hash
|
Hash string // message hash
|
||||||
Progress int
|
Progress int
|
||||||
Prompt string
|
Prompt string
|
||||||
UseProxy bool // 是否使用反代加载图片
|
UseProxy bool // 是否使用反代加载图片
|
||||||
Publish bool //是否发布图片到画廊
|
Publish bool //是否发布图片到画廊
|
||||||
|
ErrMsg string // 报错信息
|
||||||
CreatedAt time.Time
|
CreatedAt time.Time
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -11,7 +11,8 @@ type SdJob struct {
|
|||||||
Progress int
|
Progress int
|
||||||
Prompt string
|
Prompt string
|
||||||
Params string
|
Params string
|
||||||
Publish bool //是否发布图片到画廊
|
Publish bool //是否发布图片到画廊
|
||||||
|
ErrMsg string // 报错信息
|
||||||
CreatedAt time.Time
|
CreatedAt time.Time
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -17,5 +17,6 @@ type MidJourneyJob struct {
|
|||||||
Prompt string `json:"prompt"`
|
Prompt string `json:"prompt"`
|
||||||
UseProxy bool `json:"use_proxy"`
|
UseProxy bool `json:"use_proxy"`
|
||||||
Publish bool `json:"publish"`
|
Publish bool `json:"publish"`
|
||||||
|
ErrMsg string `json:"err_msg"`
|
||||||
CreatedAt time.Time `json:"created_at"`
|
CreatedAt time.Time `json:"created_at"`
|
||||||
}
|
}
|
||||||
|
@ -15,5 +15,6 @@ type SdJob struct {
|
|||||||
Progress int `json:"progress"`
|
Progress int `json:"progress"`
|
||||||
Prompt string `json:"prompt"`
|
Prompt string `json:"prompt"`
|
||||||
Publish bool `json:"publish"`
|
Publish bool `json:"publish"`
|
||||||
|
ErrMsg string `json:"err_msg"`
|
||||||
CreatedAt time.Time `json:"created_at"`
|
CreatedAt time.Time `json:"created_at"`
|
||||||
}
|
}
|
||||||
|
4
database/update-v3.2.7.sql
Normal file
4
database/update-v3.2.7.sql
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
ALTER TABLE `chatgpt_mj_jobs` ADD `err_msg` VARCHAR(255) DEFAULT NULL COMMENT '错误信息' AFTER `publish`;
|
||||||
|
ALTER TABLE `chatgpt_sd_jobs` ADD `err_msg` VARCHAR(255) DEFAULT NULL COMMENT '错误信息' AFTER `publish`;
|
||||||
|
|
||||||
|
ALTER TABLE `chatgpt_chat_items` ADD `model` VARCHAR(30) NULL COMMENT '模型名称' AFTER `model_id`;
|
@ -397,7 +397,7 @@
|
|||||||
<div class="job-item">
|
<div class="job-item">
|
||||||
<el-image
|
<el-image
|
||||||
:src="scope.item['thumb_url']"
|
:src="scope.item['thumb_url']"
|
||||||
:class="scope.item.type === 'upscale' ? 'upscale' : ''" :zoom-rate="1.2"
|
:class="scope.item['can_opt'] ? '' : 'upscale'" :zoom-rate="1.2"
|
||||||
:preview-src-list="[scope.item['img_url']]" fit="cover" :initial-index="scope.index"
|
:preview-src-list="[scope.item['img_url']]" fit="cover" :initial-index="scope.index"
|
||||||
loading="lazy" v-if="scope.item.progress > 0">
|
loading="lazy" v-if="scope.item.progress > 0">
|
||||||
<template #placeholder>
|
<template #placeholder>
|
||||||
@ -419,7 +419,7 @@
|
|||||||
</template>
|
</template>
|
||||||
</el-image>
|
</el-image>
|
||||||
|
|
||||||
<div class="opt" v-if="scope.item.type !== 'upscale'">
|
<div class="opt" v-if="scope.item['can_opt']">
|
||||||
<div class="opt-line">
|
<div class="opt-line">
|
||||||
<ul>
|
<ul>
|
||||||
<li><a @click="upscale(1, scope.item)">U1</a></li>
|
<li><a @click="upscale(1, scope.item)">U1</a></li>
|
||||||
@ -690,7 +690,8 @@ const fetchRunningJobs = (userId) => {
|
|||||||
if (jobs[i].progress === -1) {
|
if (jobs[i].progress === -1) {
|
||||||
ElNotification({
|
ElNotification({
|
||||||
title: '任务执行失败',
|
title: '任务执行失败',
|
||||||
message: "任务ID:" + jobs[i]['task_id'],
|
dangerouslyUseHTMLString: true,
|
||||||
|
message: `任务ID:${jobs[i]['task_id']}<br />原因:${jobs[i]['err_msg']}`,
|
||||||
type: 'error',
|
type: 'error',
|
||||||
})
|
})
|
||||||
imgCalls.value += 1
|
imgCalls.value += 1
|
||||||
@ -712,9 +713,10 @@ const fetchFinishJobs = (userId) => {
|
|||||||
if (jobs[i]['use_proxy']) {
|
if (jobs[i]['use_proxy']) {
|
||||||
jobs[i]['thumb_url'] = jobs[i]['img_url'] + '?x-oss-process=image/quality,q_60&format=webp'
|
jobs[i]['thumb_url'] = jobs[i]['img_url'] + '?x-oss-process=image/quality,q_60&format=webp'
|
||||||
} else {
|
} else {
|
||||||
if (jobs[i].type === 'upscale') {
|
if (jobs[i].type === 'upscale' || jobs[i].type === 'swapFace') {
|
||||||
jobs[i]['thumb_url'] = jobs[i]['img_url'] + '?imageView2/1/w/480/h/600/q/75'
|
jobs[i]['thumb_url'] = jobs[i]['img_url'] + '?imageView2/1/w/480/h/600/q/75'
|
||||||
} else {
|
} else {
|
||||||
|
jobs[i]['can_opt'] = true
|
||||||
jobs[i]['thumb_url'] = jobs[i]['img_url'] + '?imageView2/1/w/480/h/480/q/75'
|
jobs[i]['thumb_url'] = jobs[i]['img_url'] + '?imageView2/1/w/480/h/480/q/75'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -600,7 +600,8 @@ onMounted(() => {
|
|||||||
if (jobs[i].progress === -1) {
|
if (jobs[i].progress === -1) {
|
||||||
ElNotification({
|
ElNotification({
|
||||||
title: '任务执行失败',
|
title: '任务执行失败',
|
||||||
message: "任务ID:" + jobs[i]['task_id'],
|
dangerouslyUseHTMLString: true,
|
||||||
|
message: `任务ID:${jobs[i]['task_id']}<br />原因:${jobs[i]['err_msg']}`,
|
||||||
type: 'error',
|
type: 'error',
|
||||||
})
|
})
|
||||||
imgCalls.value += 1
|
imgCalls.value += 1
|
||||||
|
Loading…
Reference in New Issue
Block a user