This commit is contained in:
zjt
2024-05-22 14:39:09 +08:00
parent 927577c201
commit e29085c314
5 changed files with 101 additions and 50297 deletions

View File

@@ -21,6 +21,7 @@ const Txt2ImgHandler: RequestHandler<Txt2ImgRequest, any> = async (ctx, next) =>
const { prompt, loraDetail, loraModel } = requestBody;
const inputNode = selectNodeFromApiJSONbyID(txt2imgAPIformatJSON, "33");
let temp = "";
let preViewBlobs:any = [];
inputNode.inputs.string = prompt;
ctx.body = {
data: await new Promise((resolve, reject) => {
@@ -33,6 +34,7 @@ const Txt2ImgHandler: RequestHandler<Txt2ImgRequest, any> = async (ctx, next) =>
prompt: txt2imgAPIformatJSON,
// extra_data: txt2imgAPIformatExtraData
});
console.log(`ok`);
} catch (error) {
console.log(error);
}
@@ -50,11 +52,13 @@ const Txt2ImgHandler: RequestHandler<Txt2ImgRequest, any> = async (ctx, next) =>
temp = data.output.text[0];
}
if (data.node === '94') {
resolve({ prompt: temp, url: baseUrl + '/view?filename=' + data.output.images[0].filename })
resolve({ prompt: temp, url: baseUrl + '/view?filename=' + data.output.images[0].filename, preViewBlobs: preViewBlobs });
}
}else if (type === "executing") {
}
} else {
} else if (event.data instanceof Buffer) {
console.log(`event.data`, event.data);
preViewBlobs.push(event.data);
}
}
}