Templates with `imageapi:lora-slot:<n>:high|low` nodes take LoRAs picked
per job from a catalog built live from ComfyUI.
- Catalog: ComfyUI's LoraLoaderModelOnly `lora_name` choices (cached
60 s, re-read when a submit names an unknown id), paired by High/Low
name tokens (StyleHigh/StyleLow, x-HIGH/x-LOW, x_high_noise/...). Files
the workflow already loads outside the slots (lightx2v, switches) and
`[template.catalog] exclude` substrings never show; ids derive from the
names so they stay stable.
- POST /enhance `slots: [{lora, scale?}]` fills the slots in order: each
pick sets the slot nodes' lora_name and scales their exported strength;
unused slots run at 0, so the graph is never rewired. More picks than
slots, duplicates or unknown ids are 400s.
- GET /enhance/templates gains `slots` and `catalog: {loras, strength,
min, max}`; jobs store and return the picks (new enhance_jobs.lora_slots
JSON column).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
104 lines
5.7 KiB
TOML
104 lines
5.7 KiB
TOML
# ImageApi Enhance configuration (#192). Copy to `enhance.toml` next to
|
|
# `.env` (or point ENHANCE_CONFIG_PATH at it). Every key is optional: delete
|
|
# a line to get its default (trailing `default:` comment). Without `url`,
|
|
# Enhance is off and GET /enhance/templates reports `available: false`.
|
|
#
|
|
# ComfyUI has no auth and stays LAN-only; the apps only ever talk to
|
|
# ImageApi, which relays previews. Nothing in this file is a secret.
|
|
#
|
|
# Templates are API-format workflows (ComfyUI -> Workflow -> Export (API)).
|
|
# ImageApi finds the nodes it fills in by `_meta.title`, so re-exporting
|
|
# after editing the graph keeps working:
|
|
# imageapi:source required Load Image From Path; gets the photo's path
|
|
# imageapi:save required Save Image Version; forced to require_approval
|
|
# imageapi:prompt optional text node; its `text`, `prompt` or `value`
|
|
# input (first one present) gets the user's text
|
|
# imageapi:reference optional second loader for a context photo. With no
|
|
# reference in the request the node and every
|
|
# link to it are removed from the prompt.
|
|
# A template missing a required title (or with a prompt node that has none of
|
|
# the three inputs) is rejected at startup with a log line; the rest still load.
|
|
# Never edit the template files from here: ImageApi only reads them.
|
|
|
|
url = "http://192.168.10.218:8188" # default: unset (Enhance disabled)
|
|
timeout_secs = 15 # default: 15; per ComfyUI request
|
|
probe_ttl_secs = 10 # default: 10; how long `available` is cached
|
|
poll_secs = 2 # default: 2; job poll interval
|
|
idle_free_secs = 300 # default: 300; ComfyUI idle (empty queue, newest
|
|
# history entry this old) -> POST /free once. 0 = off
|
|
unreachable_grace_secs = 120 # default: 120; active job -> `unavailable` after this
|
|
default_template = "restore" # default: the first template
|
|
warn_above_megapixels = 1.5 # default: 1.5; clients warn above this original size
|
|
|
|
# Library path prefix <-> ComfyUI path prefix; longest prefix wins and
|
|
# separators are converted, in both directions. With no entries, paths pass
|
|
# through unchanged. A mapped drive (Z:\) only exists in the logged-in
|
|
# session; use a UNC prefix (\\nas\) if ComfyUI ever runs as a service.
|
|
[[path_map]]
|
|
from = "/media/nas/"
|
|
to = 'Z:\'
|
|
|
|
[[template]]
|
|
name = "restore" # stable id clients send
|
|
label = "Restore"
|
|
description = "Sharpen and clean up the photo (about 3 s)."
|
|
file = "/media/nas/image_fibo2_restore_turbo_imageapi_API.json" # relative = beside this file
|
|
# append: the template's prompt is a full base instruction; the user's text
|
|
# is appended after prompt_join. Empty text leaves the prompt as is.
|
|
prompt_mode = "append" # default: "append" | "replace"
|
|
prompt_join = " " # default: " " (single space); e.g. "\n\nAdditional instructions: "
|
|
output_megapixels = 1.0 # default: 1.0; ~1 MP output, for the client's size warning
|
|
|
|
[[template]]
|
|
name = "edit"
|
|
label = "Edit"
|
|
description = "Change the photo as you describe."
|
|
file = "/media/nas/image_fibo2_edit_turbo_imageapi_API.json"
|
|
# replace: the user's text IS the prompt, so it is required (empty = 400).
|
|
prompt_mode = "replace"
|
|
|
|
# The Dev variant (50 steps, ~50 s) is no better on the archive test set, so
|
|
# it is not the default; configure it if you want it:
|
|
# [[template]]
|
|
# name = "restore-dev"
|
|
# label = "Restore (Dev, slow)"
|
|
# file = "/media/nas/image_fibo2_restore_imageapi_API.json"
|
|
|
|
# A video template with optional LoRAs the app can switch on or off and scale
|
|
# (#218). Each [[template.lora]] matches the workflow's LoRA loader nodes titled
|
|
# "imageapi:lora:<id>" (Wan's high- and low-noise pair share one id). The
|
|
# request's scale multiplies each node's exported strength_model (and
|
|
# strength_clip), so 1.0 = as exported, 0 = off and a pair keeps its ratio; the
|
|
# graph isn't rewired. Any number of switches can be on at once (LoRA patches
|
|
# add up, so their order in the graph doesn't matter). Nodes titled that way
|
|
# with no entry here keep their exported strength.
|
|
[[template]]
|
|
name = "animate"
|
|
label = "Animate"
|
|
description = "A short clip from the photo."
|
|
file = "/media/nas/image_wan22_animate_imageapi_API.json"
|
|
prompt_join = ", "
|
|
output_megapixels = 0.92
|
|
|
|
[[template.lora]]
|
|
id = "style" # node title "imageapi:lora:style"
|
|
label = "Style"
|
|
default = false # default: false; used when the request omits it
|
|
strength = 1.0 # default: 1.0; the scale when on without a number
|
|
min = 0.0 # default: 0.0; slider range while on (a requested
|
|
max = 1.5 # default: 1.5; scale is clamped; <= 0 is off)
|
|
|
|
# Picked LoRAs (#220): LoRA loader nodes titled "imageapi:lora-slot:<n>:high"
|
|
# and ":low" (n = 1, 2, ... without gaps) are slots the app fills from a
|
|
# catalog, one picked LoRA per slot. The catalog is every LoRA file ComfyUI
|
|
# lists whose name pairs as High/Low (StyleHigh/StyleLow, x-HIGH/x-LOW,
|
|
# x_high_noise/x_low_noise), minus the LoRAs the workflow already loads
|
|
# (lightx2v, switches); a new download shows up within a minute. A pick's
|
|
# scale multiplies the slot's exported strength; unused slots run at 0.
|
|
# Settings for the template above (all optional):
|
|
[template.catalog]
|
|
strength = 1.0 # default: 1.0; a pick's scale when the request gives none
|
|
min = 0.0 # default: 0.0; slider range (a requested scale is
|
|
max = 1.5 # default: 1.5; clamped; <= 0 leaves the slot unused)
|
|
exclude = [] # default: []; file-name substrings never offered
|