mirror of
https://github.com/SillyTavern/SillyTavern.git
synced 2025-02-26 00:47:42 +01:00
update comfy generate to use saved workflows
This commit is contained in:
parent
777d105602
commit
d24c74e34a
@ -2060,7 +2060,18 @@ async function generateComfyImage(prompt) {
|
|||||||
'height',
|
'height',
|
||||||
];
|
];
|
||||||
|
|
||||||
let workflow = extension_settings.sd.comfy_workflow.replace('"%prompt%"', JSON.stringify(prompt));
|
const workflowResponse = await fetch('/api/sd/comfy/workflow', {
|
||||||
|
method: 'POST',
|
||||||
|
headers: getRequestHeaders(),
|
||||||
|
body: JSON.stringify({
|
||||||
|
file_name: extension_settings.sd.comfy_workflow,
|
||||||
|
}),
|
||||||
|
});
|
||||||
|
if (!workflowResponse.ok) {
|
||||||
|
const text = await workflowResponse.text();
|
||||||
|
toastr.error(`Failed to load workflow.\n\n${text}`);
|
||||||
|
}
|
||||||
|
let workflow = (await workflowResponse.json()).replace('"%prompt%"', JSON.stringify(prompt));
|
||||||
workflow = workflow.replace('"%seed%"', JSON.stringify(Math.round(Math.random() * Number.MAX_SAFE_INTEGER)));
|
workflow = workflow.replace('"%seed%"', JSON.stringify(Math.round(Math.random() * Number.MAX_SAFE_INTEGER)));
|
||||||
placeholders.forEach(ph => {
|
placeholders.forEach(ph => {
|
||||||
workflow = workflow.replace(`"%${ph}%"`, JSON.stringify(extension_settings.sd[ph]));
|
workflow = workflow.replace(`"%${ph}%"`, JSON.stringify(extension_settings.sd[ph]));
|
||||||
|
Loading…
x
Reference in New Issue
Block a user