mirror of
https://github.com/open-webui/open-webui
synced 2024-11-16 13:40:55 +00:00
enh: comfyui seed node support
This commit is contained in:
parent
f3f6941205
commit
95cf90d787
@ -133,7 +133,7 @@ async def comfyui_generate_image(
|
|||||||
else random.randint(0, 18446744073709551614)
|
else random.randint(0, 18446744073709551614)
|
||||||
)
|
)
|
||||||
for node_id in node.node_ids:
|
for node_id in node.node_ids:
|
||||||
workflow[node.node_id]["inputs"]["seed"] = seed
|
workflow[node.node_id]["inputs"][node.key] = seed
|
||||||
else:
|
else:
|
||||||
for node_id in node.node_ids:
|
for node_id in node.node_ids:
|
||||||
workflow[node_id]["inputs"][node.key] = node.value
|
workflow[node_id]["inputs"][node.key] = node.value
|
||||||
|
@ -27,7 +27,7 @@
|
|||||||
|
|
||||||
let models = null;
|
let models = null;
|
||||||
|
|
||||||
let workflowNodes = [
|
let requiredWorkflowNodes = [
|
||||||
{
|
{
|
||||||
type: 'prompt',
|
type: 'prompt',
|
||||||
key: 'text',
|
key: 'text',
|
||||||
@ -52,6 +52,11 @@
|
|||||||
type: 'steps',
|
type: 'steps',
|
||||||
key: 'steps',
|
key: 'steps',
|
||||||
node_ids: ''
|
node_ids: ''
|
||||||
|
},
|
||||||
|
{
|
||||||
|
type: 'seed',
|
||||||
|
key: 'seed',
|
||||||
|
node_ids: ''
|
||||||
}
|
}
|
||||||
];
|
];
|
||||||
|
|
||||||
@ -101,7 +106,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (config?.comfyui?.COMFYUI_WORKFLOW) {
|
if (config?.comfyui?.COMFYUI_WORKFLOW) {
|
||||||
config.comfyui.COMFYUI_WORKFLOW_NODES = workflowNodes.map((node) => {
|
config.comfyui.COMFYUI_WORKFLOW_NODES = requiredWorkflowNodes.map((node) => {
|
||||||
return {
|
return {
|
||||||
type: node.type,
|
type: node.type,
|
||||||
key: node.key,
|
key: node.key,
|
||||||
@ -150,15 +155,17 @@
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((config?.comfyui?.COMFYUI_WORKFLOW_NODES ?? []).length >= 5) {
|
requiredWorkflowNodes = requiredWorkflowNodes.map((node) => {
|
||||||
workflowNodes = config.comfyui.COMFYUI_WORKFLOW_NODES.map((node) => {
|
const n = config.comfyui.COMFYUI_WORKFLOW_NODES.find((n) => n.type === node.type) ?? node;
|
||||||
return {
|
|
||||||
type: node.type,
|
console.log(n);
|
||||||
key: node.key,
|
|
||||||
node_ids: node.node_ids.join(',')
|
return {
|
||||||
};
|
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) => {
|
const imageConfigRes = await getImageGenerationConfig(localStorage.token).catch((error) => {
|
||||||
toast.error(error);
|
toast.error(error);
|
||||||
@ -414,7 +421,7 @@
|
|||||||
<div class=" mb-2 text-sm font-medium">{$i18n.t('ComfyUI Workflow Nodes')}</div>
|
<div class=" mb-2 text-sm font-medium">{$i18n.t('ComfyUI Workflow Nodes')}</div>
|
||||||
|
|
||||||
<div class="text-xs flex flex-col gap-1.5">
|
<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 w-full items-center border dark:border-gray-850 rounded-lg">
|
||||||
<div class="flex-shrink-0">
|
<div class="flex-shrink-0">
|
||||||
<div
|
<div
|
||||||
|
Loading…
Reference in New Issue
Block a user