feat: stable diffusion page function is ready

This commit is contained in:
RockYang
2023-10-06 22:25:37 +08:00
parent d83019cbe4
commit 083155413d
4 changed files with 391 additions and 352 deletions

View File

@@ -114,7 +114,7 @@ func (s *Service) Txt2Img(task types.SdTask) error {
TaskId: params.TaskId,
Data: data,
EventData: nil,
FnIndex: 405,
FnIndex: 232,
SessionHash: "ycaxgzm9ah",
}, s.httpClient)
}()
@@ -233,6 +233,8 @@ func (s *Service) runTask(taskInfo TaskInfo, client *req.Client) {
}
func (s *Service) callback(data CBReq) {
// 释放任务锁
s.redis.Del(context.Background(), RunningJobKey)
client := s.Clients.Get(data.SessionId)
if data.Success { // 任务成功
var job model.SdJob
@@ -262,6 +264,7 @@ func (s *Service) callback(data CBReq) {
job.ImgURL = imageURL
}
job.Params = utils.JsonEncode(params)
res = s.db.Updates(&job)
if res.Error != nil {
logger.Error("error with update job: ", res.Error)
@@ -276,7 +279,6 @@ func (s *Service) callback(data CBReq) {
}
if data.Progress < 100 {
logger.Infof(data.ImageData)
jobVo.ImgURL = data.ImageData
}

View File

@@ -45,200 +45,95 @@ var ParamKeys = map[string]int{
}
const Text2ImgParamTemplate = `[
"task(p1lk3n41saygmr8)",
"a tiger sit on the window",
"",
[],
20,
"Euler a",
false,
false,
1,
1,
7,
-1,
-1,
0,
0,
0,
false,
128,
128,
false,
0.7,
2,
"Latent",
0,
0,
0,
[],
"None",
false,
"MultiDiffusion",
false,
10,
1,
1,
64,
false,
true,
1024,
1024,
96,
96,
48,
1,
"None",
2,
false,
false,
false,
false,
false,
0.4,
0.4,
0.2,
0.2,
"",
"",
"Background",
0.2,
-1,
false,
0.4,
0.4,
0.2,
0.2,
"",
"",
"Background",
0.2,
-1,
false,
0.4,
0.4,
0.2,
0.2,
"",
"",
"Background",
0.2,
-1,
false,
0.4,
0.4,
0.2,
0.2,
"",
"",
"Background",
0.2,
-1,
false,
0.4,
0.4,
0.2,
0.2,
"",
"",
"Background",
0.2,
-1,
false,
0.4,
0.4,
0.2,
0.2,
"",
"",
"Background",
0.2,
-1,
false,
0.4,
0.4,
0.2,
0.2,
"",
"",
"Background",
0.2,
-1,
false,
0.4,
0.4,
0.2,
0.2,
"",
"",
"Background",
0.2,
-1,
false,
false,
true,
true,
false,
1536,
96,
false,
false,
"LoRA",
"None",
1,
1,
"LoRA",
"None",
1,
1,
"LoRA",
"None",
1,
1,
"LoRA",
"None",
1,
1,
"LoRA",
"None",
1,
1,
null,
"Refresh models",
null,
null,
null,
null,
false,
false,
"positive",
"comma",
0,
false,
false,
"",
"Seed",
"",
"Nothing",
"",
"Nothing",
"",
true,
false,
false,
false,
0,
null,
false,
null,
false,
null,
false,
null,
false,
50,
[],
"",
"",
""
"task(6sm0b3j17tag2gd)",
"A beautiful Chinese girl wearing a cheongsam walks on the bluestone street",
"",
[],
50,
"Euler a",
false,
false,
1,
1,
15,
null,
-1,
0,
0,
0,
false,
768,
512,
false,
0.7,
2,
"ESRGAN_4x",
10,
0,
0,
"Use same sampler",
"",
"",
[],
"None",
null,
false,
false,
"positive",
"comma",
0,
false,
false,
"",
"Seed",
"",
[],
"Nothing",
"",
[],
"Nothing",
"",
[],
true,
false,
false,
false,
0,
"Not set",
true,
true,
"",
"",
"",
"",
"",
1.3,
"Not set",
"Not set",
1.3,
"Not set",
1.3,
"Not set",
1.3,
1.3,
"Not set",
1.3,
"Not set",
1.3,
"Not set",
1.3,
"Not set",
1.3,
"Not set",
1.3,
"Not set",
false,
"None",
null,
false,
50,
[],
"",
"",
""
]`