chore: change default params for stable diffusion

This commit is contained in:
RockYang
2023-12-10 14:45:22 +08:00
parent 4a9f7e3bce
commit 024c0032eb
3 changed files with 24 additions and 21 deletions

View File

@@ -1,20 +1,20 @@
{
"data": [
"task(m1wpaa4v60zedj8)",
"a cute cat",
"task(s95jqt5jr8yppcp)",
"A beautiful Chinese girl in a garden",
"",
[],
20,
"DPM++ 2M Karras",
30,
"Euler a",
1,
1,
7,
512,
384,
512,
true,
0.7,
2,
"ESRGAN_4x",
"Latent",
10,
0,
0,
@@ -55,13 +55,13 @@
false,
false,
0,
false,
[],
[
],
"",
"",
""
],
"event_data": null,
"fn_index": 96,
"session_hash": "kmb0ojjfhdj"
"fn_index": 95,
"session_hash": "eqwumnt3rov"
}

View File

@@ -135,7 +135,6 @@ func (s *Service) runTask(taskInfo TaskInfo, client *req.Client) {
"fn_index": taskInfo.FnIndex,
"session_hash": taskInfo.SessionHash,
}
logger.Debug(utils.JsonEncode(body))
var result = make(chan CBReq)
go func() {
var res struct {
@@ -231,7 +230,6 @@ func (s *Service) runTask(taskInfo TaskInfo, client *req.Client) {
cbReq.ImageData = progressRes.LivePreview
cbReq.Progress = int(progressRes.Progress * 100)
logger.Debug(cbReq)
s.callback(cbReq)
time.Sleep(time.Second)
}
@@ -287,8 +285,13 @@ func (s *Service) callback(data CBReq) {
if data.Progress < 100 && data.ImageData != "" {
jobVo.ImgURL = data.ImageData
}
logger.Infof("绘图进度:%d", data.Progress)
// 扣减绘图次数
s.db.Model(&model.User{}).Where("id = ?", jobVo.UserId).UpdateColumn("img_calls", gorm.Expr("img_calls - ?", 1))
if data.Progress == 100 {
s.db.Model(&model.User{}).Where("id = ? AND img_calls > 0", jobVo.UserId).UpdateColumn("img_calls", gorm.Expr("img_calls - ?", 1))
}
// 推送任务到前端
if client != nil {
utils.ReplyChunkMessage(client, jobVo)