Skip to content

armgit / kokon

Public Imported from GitHub
0

Edit photos by describing the change, on your own GPU. A free, open-source alternative to Nano Banana and ChatGPT image editing: photos stay on your computer, no daily limit. One installer for Windows, Mac and Linux sets up the best open model (Qwen-Image 2.1). MCP server for AI agents.

lora: requests without a LoRA list use none (MCP and the HTTP API)

Gabriele Lozupone5496ae45fa15
diff --git a/crates/qls-core/src/config.rs b/crates/qls-core/src/config.rs
index e785a68..81fcb7a 100644
--- a/crates/qls-core/src/config.rs
+++ b/crates/qls-core/src/config.rs
@@ -398,7 +398,7 @@ pub struct LoraEntry {
pub weight: f32,
/// Added in front of the prompt when the LoRA is used.
pub trigger_words: String,
- /// On in every new project (and for MCP requests that name no LoRAs).
+ /// On in every new project of the app (MCP never uses LoRAs).
pub on_by_default: bool,
/// Size of the copy in bytes.
pub size: u64,
diff --git a/crates/qls-core/src/lora.rs b/crates/qls-core/src/lora.rs
index 78a5e17..a2cdd13 100644
--- a/crates/qls-core/src/lora.rs
+++ b/crates/qls-core/src/lora.rs
@@ -412,13 +412,15 @@ pub struct AppliedLora {
pub trigger_words: String,
}
-/// The LoRAs a job uses: `requested` ids or names (case-insensitive) in that order, or the ones
-/// turned on by default when the request names none (`None`, e.g. MCP without `loras`). Also
-/// returns notes for the ones skipped.
+/// The LoRAs a job uses: `requested` ids or names (case-insensitive), in that order. A request
+/// without the field (MCP, the HTTP API) uses none: LoRAs are an app feature for now (decided
+/// 2026-10-20: no catalog of LoRAs with a clear purpose that an agent could pick). "On by
+/// default" is applied by the app, which always sends its list. Also returns notes for the ones
+/// skipped.
pub fn resolve(cfg: &AppConfig, requested: Option<&[String]>) -> (Vec<AppliedLora>, Vec<String>) {
let mut notes = Vec::new();
let chosen: Vec<&LoraEntry> = match requested {
- None => cfg.loras.iter().filter(|l| l.on_by_default).collect(),
+ None => Vec::new(),
Some(list) => {
let mut out: Vec<&LoraEntry> = Vec::new();
for want in list {
@@ -618,7 +620,9 @@ mod tests {
for id in ["film", "angles", "off"] {
std::fs::write(cfg.lora_dir().join(format!("{id}.safetensors")), b"x").unwrap();
}
- let (on, notes) = resolve(&cfg, None);
+ // MCP / API requests name no LoRAs: none, whatever is on by default in the app.
+ assert_eq!(resolve(&cfg, None), (vec![], vec![]));
+ let (on, notes) = resolve(&cfg, Some(&["gone".into(), "film".into()]));
assert_eq!(on.iter().map(|l| l.id.as_str()).collect::<Vec<_>>(), ["film"]);
assert!(notes[0].contains("\"GONE\" is missing"));
let (on, notes) = resolve(&cfg, Some(&["Angles".into(), "film".into(), "film".into(), "nope".into()]));
diff --git a/crates/qls-core/src/planner.rs b/crates/qls-core/src/planner.rs
index 1168109..f905ca3 100644
--- a/crates/qls-core/src/planner.rs
+++ b/crates/qls-core/src/planner.rs
@@ -275,8 +275,8 @@ pub struct GenerationRequest {
/// generating (text-to-image, edits, combines; engines with text generation only).
#[serde(default)]
pub enhance: bool,
- /// The user's LoRAs to use, by id or name (Settings → LoRA); None = the ones on by
- /// default. Not used by upscales.
+ /// The user's LoRAs to use, by id or name (Settings → LoRA); sent by the app only, None =
+ /// no LoRA (MCP and the HTTP API don't use LoRAs for now). Not used by upscales.
#[serde(default, skip_serializing_if = "Option::is_none")]
pub loras: Option<Vec<String>>,
}
diff --git a/src/lib/types.ts b/src/lib/types.ts
index ad22ad6..4390a10 100644
--- a/src/lib/types.ts
+++ b/src/lib/types.ts
@@ -61,7 +61,7 @@ export interface GenerationRequest {
private?: boolean;
/** Prompt enhancer: the model's language model rewrites the prompt first (new images, edits, combines). */
enhance?: boolean;
- /** LoRA ids to use; omitted = the ones on by default. */
+ /** LoRA ids to use (the app always sends its list; omitted = none, as for MCP). */
loras?: string[] | null;
}