feat: blend and swap face function for midjourney-plus is ready

This commit is contained in:
RockYang
2024-01-26 11:57:08 +08:00
parent cc78780a8e
commit 55ba0d08a5
7 changed files with 568 additions and 504 deletions

View File

@@ -167,7 +167,7 @@ func (p *ServicePool) HasAvailableService() bool {
}
func (p *ServicePool) Notify(data plus.CBReq) error {
logger.Infof("收到任务回调:%+v", data)
logger.Debugf("收到任务回调:%+v", data)
var job model.MidJourneyJob
res := p.db.Where("task_id = ?", data.Id).First(&job)
if res.Error != nil {
@@ -190,7 +190,7 @@ func (p *ServicePool) SyncTaskProgress() {
go func() {
var items []model.MidJourneyJob
for {
res := p.db.Where("progress < ?", 100).Find(&items)
res := p.db.Where("progress >= ? AND progress < ?", 0, 100).Find(&items)
if res.Error != nil {
continue
}
@@ -215,6 +215,11 @@ func (p *ServicePool) SyncTaskProgress() {
if err != nil {
continue
}
// 任务失败了
if task.FailReason != "" {
p.db.Model(&model.MidJourneyJob{Id: v.Id}).UpdateColumn("progress", -1)
continue
}
if len(task.Buttons) > 0 {
v.Hash = getImageHash(task.Buttons[0].CustomId)
}