Files
ImageApi/src/enhance/mod.rs
T
Cameron CordesandClaude Opus 5.5 e2cf18678f feat(enhance): pick LoRAs from ComfyUI per job (#220)
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>
2026-11-03 16:28:23 -05:00

29 lines
887 B
Rust

//! Enhance on demand (#192): run a ComfyUI restore/edit workflow on a photo
//! from the apps, approve the result in-app, and have it land in the library
//! as a version (#191).
//!
//! - [`config`]: `enhance.toml` (templates, path map, timings).
//! - [`template`]: workflow loading/validation and per-photo filling.
//! - [`comfy`]: the ComfyUI HTTP calls used.
//! - [`service`]: submit, poll, approve, idle `/free`.
//! - [`handlers`]: the HTTP endpoints.
//!
//! ImageApi never writes under a library root: ComfyUI writes the approved
//! file, ImageApi only ingests it.
pub mod comfy;
pub mod config;
pub mod handlers;
pub mod lora_catalog;
pub mod path_map;
pub mod service;
pub mod template;
#[cfg(test)]
mod integration_tests;
pub use handlers::{
approve, discard, get_job, get_templates, list_jobs, preview, recent_prompts, submit,
};
pub use service::EnhanceService;