feat(enhance): LoRA switches per template (#218)
A template can offer optional LoRAs the app turns on or off.
- enhance.toml: [[template.lora]] { id, label, default } per template.
Each id drives every workflow node titled `imageapi:lora:<id>`, so
Wan's high- and low-noise pair share one switch.
- POST /enhance takes `loras: {id: bool}`; a missing id uses its default,
an id the template doesn't offer is a 400. Off sets strength_model
(and strength_clip when present) to 0, so the graph is never rewired.
- The resolved switches are stored on the job (new enhance_jobs.loras
JSON column) and returned in the job view, so a retry or adjust can
repeat them; GET /enhance/templates lists each template's switches.
- A lora-titled node without a declaration keeps its exported strength,
and a declaration without nodes isn't offered; both are startup
warnings. A lora-titled node without a numeric strength_model fails
the template.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
e317bfee98
commit
31da21e061
12 files changed
+910
-33
No files matched your search
+10
-1
@@ -292,6 +292,7 @@ impl EnhanceService {
|
||||
template_name: &str,
|
||||
prompt: Option<&str>,
|
||||
reference: Option<&SourceFile>,
|
||||
loras: &std::collections::BTreeMap<String, bool>,
|
||||
) -> Result<EnhanceJobRow, EnhanceError> {
|
||||
let Some(client) = &self.client else {
|
||||
return Err(EnhanceError::Disabled);
|
||||
@@ -319,7 +320,13 @@ impl EnhanceService {
|
||||
None => None,
|
||||
};
|
||||
let filled = template
|
||||
.fill(&source, prompt, reference_path.as_deref(), &mut random_seed)
|
||||
.fill(
|
||||
&source,
|
||||
prompt,
|
||||
reference_path.as_deref(),
|
||||
loras,
|
||||
&mut random_seed,
|
||||
)
|
||||
.map_err(|e| EnhanceError::BadRequest(e.0))?;
|
||||
|
||||
if !self.probe_now().await {
|
||||
@@ -365,6 +372,8 @@ impl EnhanceService {
|
||||
created_at: now,
|
||||
updated_at: now,
|
||||
run_ms: None,
|
||||
loras: (!filled.loras.is_empty())
|
||||
.then(|| serde_json::to_string(&filled.loras).unwrap_or_default()),
|
||||
};
|
||||
self.dao
|
||||
.lock()
|
||||
|
||||
Reference in new issue
Block a user