enh: comfyui seed node support

This commit is contained in:
Timothy J. Baek 2024-08-21 23:05:20 +02:00
parent f3f6941205
commit 95cf90d787
2 changed files with 20 additions and 13 deletions

View File

@ -133,7 +133,7 @@ async def comfyui_generate_image(
else random.randint(0, 18446744073709551614)
)
for node_id in node.node_ids:
workflow[node.node_id]["inputs"]["seed"] = seed
workflow[node.node_id]["inputs"][node.key] = seed
else:
for node_id in node.node_ids:
workflow[node_id]["inputs"][node.key] = node.value

View File

@ -27,7 +27,7 @@
let models = null;
let workflowNodes = [
let requiredWorkflowNodes = [
{
type: 'prompt',
key: 'text',
@ -52,6 +52,11 @@
type: 'steps',
key: 'steps',
node_ids: ''
},
{
type: 'seed',
key: 'seed',
node_ids: ''
}
];
@ -101,7 +106,7 @@
}
if (config?.comfyui?.COMFYUI_WORKFLOW) {
config.comfyui.COMFYUI_WORKFLOW_NODES = workflowNodes.map((node) => {
config.comfyui.COMFYUI_WORKFLOW_NODES = requiredWorkflowNodes.map((node) => {
return {
type: node.type,
key: node.key,
@ -150,15 +155,17 @@
);
}
if ((config?.comfyui?.COMFYUI_WORKFLOW_NODES ?? []).length >= 5) {
workflowNodes = config.comfyui.COMFYUI_WORKFLOW_NODES.map((node) => {
requiredWorkflowNodes = requiredWorkflowNodes.map((node) => {
const n = config.comfyui.COMFYUI_WORKFLOW_NODES.find((n) => n.type === node.type) ?? node;
console.log(n);
return {
type: node.type,
key: node.key,
node_ids: node.node_ids.join(',')
type: n.type,
key: n.key,
node_ids: typeof n.node_ids === 'string' ? n.node_ids : n.node_ids.join(',')
};
});
}
const imageConfigRes = await getImageGenerationConfig(localStorage.token).catch((error) => {
toast.error(error);
@ -414,7 +421,7 @@
<div class=" mb-2 text-sm font-medium">{$i18n.t('ComfyUI Workflow Nodes')}</div>
<div class="text-xs flex flex-col gap-1.5">
{#each workflowNodes as node}
{#each requiredWorkflowNodes as node}
<div class="flex w-full items-center border dark:border-gray-850 rounded-lg">
<div class="flex-shrink-0">
<div