mirror of
https://github.com/open-webui/open-webui
synced 2024-11-16 13:40:55 +00:00
refac
This commit is contained in:
parent
8b5aed7a2b
commit
e2291f7148
@ -413,7 +413,6 @@ async def image_generations(
|
|||||||
return images
|
return images
|
||||||
|
|
||||||
elif app.state.config.ENGINE == "comfyui":
|
elif app.state.config.ENGINE == "comfyui":
|
||||||
|
|
||||||
data = {
|
data = {
|
||||||
"prompt": form_data.prompt,
|
"prompt": form_data.prompt,
|
||||||
"width": width,
|
"width": width,
|
||||||
|
@ -74,7 +74,7 @@ def get_images(ws, prompt, client_id, base_url):
|
|||||||
|
|
||||||
class ComfyUINodeInput(BaseModel):
|
class ComfyUINodeInput(BaseModel):
|
||||||
field: Optional[str] = None
|
field: Optional[str] = None
|
||||||
node_id: str
|
node_ids: list[str] = []
|
||||||
key: Optional[str] = "text"
|
key: Optional[str] = "text"
|
||||||
value: Optional[str] = None
|
value: Optional[str] = None
|
||||||
|
|
||||||
@ -106,27 +106,37 @@ async def comfyui_generate_image(
|
|||||||
for node in payload.workflow.nodes:
|
for node in payload.workflow.nodes:
|
||||||
if node.field:
|
if node.field:
|
||||||
if node.field == "model":
|
if node.field == "model":
|
||||||
workflow[node.node_id]["inputs"][node.key] = model
|
for node_id in node.node_ids:
|
||||||
|
workflow[node_id]["inputs"][node.key] = model
|
||||||
elif node.field == "prompt":
|
elif node.field == "prompt":
|
||||||
workflow[node.node_id]["inputs"]["text"] = payload.prompt
|
for node_id in node.node_ids:
|
||||||
|
workflow[node_id]["inputs"]["text"] = payload.prompt
|
||||||
elif node.field == "negative_prompt":
|
elif node.field == "negative_prompt":
|
||||||
workflow[node.node_id]["inputs"]["text"] = payload.negative_prompt
|
for node_id in node.node_ids:
|
||||||
|
workflow[node_id]["inputs"]["text"] = payload.negative_prompt
|
||||||
elif node.field == "width":
|
elif node.field == "width":
|
||||||
workflow[node.node_id]["inputs"]["width"] = payload.width
|
for node_id in node.node_ids:
|
||||||
|
workflow[node_id]["inputs"]["width"] = payload.width
|
||||||
elif node.field == "height":
|
elif node.field == "height":
|
||||||
workflow[node.node_id]["inputs"]["height"] = payload.height
|
for node_id in node.node_ids:
|
||||||
|
workflow[node_id]["inputs"]["height"] = payload.height
|
||||||
elif node.field == "n":
|
elif node.field == "n":
|
||||||
workflow[node.node_id]["inputs"]["batch_size"] = payload.n
|
for node_id in node.node_ids:
|
||||||
|
workflow[node_id]["inputs"]["batch_size"] = payload.n
|
||||||
elif node.field == "steps":
|
elif node.field == "steps":
|
||||||
workflow[node.node_id]["inputs"]["steps"] = payload.steps
|
for node_id in node.node_ids:
|
||||||
|
workflow[node_id]["inputs"]["steps"] = payload.steps
|
||||||
elif node.field == "seed":
|
elif node.field == "seed":
|
||||||
workflow[node.node_id]["inputs"]["seed"] = (
|
seed = (
|
||||||
payload.seed
|
payload.seed
|
||||||
if payload.seed
|
if payload.seed
|
||||||
else random.randint(0, 18446744073709551614)
|
else random.randint(0, 18446744073709551614)
|
||||||
)
|
)
|
||||||
|
for node_id in node.node_ids:
|
||||||
|
workflow[node.node_id]["inputs"]["seed"] = seed
|
||||||
else:
|
else:
|
||||||
workflow[node.node_id]["inputs"][node.key] = node.value
|
for node_id in node.node_ids:
|
||||||
|
workflow[node_id]["inputs"][node.key] = node.value
|
||||||
|
|
||||||
try:
|
try:
|
||||||
ws = websocket.WebSocket()
|
ws = websocket.WebSocket()
|
||||||
|
@ -323,7 +323,46 @@
|
|||||||
<div class="">
|
<div class="">
|
||||||
<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>hi</div>
|
<div class="text-xs">
|
||||||
|
<div class="flex gap-2">
|
||||||
|
<div>Prompt Node</div>
|
||||||
|
<div>Node Ids</div>
|
||||||
|
<div>"text"</div>
|
||||||
|
<div>Default</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="flex gap-2">
|
||||||
|
<div>Model Node</div>
|
||||||
|
<div>Node Ids</div>
|
||||||
|
<div>"text"</div>
|
||||||
|
<div>Default</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="flex gap-2">
|
||||||
|
<div>Image Size Node</div>
|
||||||
|
<div>Node Ids</div>
|
||||||
|
<div>"text"</div>
|
||||||
|
<div>Default</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="flex gap-2">
|
||||||
|
<div>Image Steps Node</div>
|
||||||
|
<div>Node Ids</div>
|
||||||
|
<div>"text"</div>
|
||||||
|
<div>Default</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<hr class=" dark:border-gray-850 my-2" />
|
||||||
|
|
||||||
|
<div class="text-xs">
|
||||||
|
<div class="flex gap-2">
|
||||||
|
<div>Custom Node</div>
|
||||||
|
<div>Node Ids</div>
|
||||||
|
<div>Key</div>
|
||||||
|
<div>Value</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
{/if}
|
{/if}
|
||||||
{:else if config?.engine === 'openai'}
|
{:else if config?.engine === 'openai'}
|
||||||
|
Loading…
Reference in New Issue
Block a user