Skip to content

The all-in-one local AI studio for your desktop: chat, image and video generation and a coding agent in one free, open source app. Windows and Linux. No Docker, no terminal, no cloud required.

feat(settings): ComfyUI install location is configurable (andy_38747, Discord)

purpleaa2aa9a09745
diff --git a/src-tauri/src/commands/install.rs b/src-tauri/src/commands/install.rs
index f7cbc1b7..0e1d3afa 100644
--- a/src-tauri/src/commands/install.rs
+++ b/src-tauri/src/commands/install.rs
@@ -513,6 +513,9 @@ pub fn install_comfyui(
);
}
let install_status = state.install_status.clone();
+ // Cloned into the worker so a custom install target can be persisted as
+ // the active ComfyUI path once the install completes (andy_38747).
+ let comfy_path_slot = state.comfy_path.clone();
std::thread::spawn(move || {
// Helper to update install status + logs
@@ -763,6 +766,31 @@ pub fn install_comfyui(
}
println!("[Install] ComfyUI installation complete");
+
+ // andy_38747 (Discord): the install target is user-configurable now.
+ // Persist it exactly like `set_comfyui_path` does (memory + config.json),
+ // otherwise a non-default target (e.g. D:\ComfyUI) is installed fine but
+ // never found again — `find_comfyui_path` only scans standard locations.
+ let dir_str = target_dir.to_string_lossy().to_string();
+ {
+ let mut p = comfy_path_slot.lock().unwrap();
+ *p = Some(dir_str.clone());
+ }
+ if let Some(config_dir) = dirs::config_dir() {
+ let app_config = config_dir.join("locally-uncensored");
+ let _ = std::fs::create_dir_all(&app_config);
+ let config_file = app_config.join("config.json");
+ let mut config: serde_json::Value = std::fs::read_to_string(&config_file)
+ .ok()
+ .and_then(|s| serde_json::from_str(&s).ok())
+ .unwrap_or_else(|| serde_json::json!({}));
+ config["comfyui_path"] = serde_json::json!(dir_str);
+ let _ = std::fs::write(
+ &config_file,
+ serde_json::to_string_pretty(&config).unwrap_or_default(),
+ );
+ }
+
update("complete", "ComfyUI installed successfully!");
});
diff --git a/src-tauri/src/state.rs b/src-tauri/src/state.rs
index 506437ba..de433d30 100644
--- a/src-tauri/src/state.rs
+++ b/src-tauri/src/state.rs
@@ -153,7 +153,9 @@ pub struct AppState {
/// Document-Chat / RAG so embeddings no longer require Ollama. `None` until
/// started via `start_bundled_embed`; reaped in `shutdown_subprocesses`.
pub bundled_embed: Mutex<Option<BundledEngine>>,
- pub comfy_path: Mutex<Option<String>>,
+ /// Arc so the ComfyUI install worker thread can persist a custom install
+ /// target as the active path on completion (andy_38747).
+ pub comfy_path: Arc<Mutex<Option<String>>>,
pub comfy_port: Mutex<u16>,
/// Configurable ComfyUI host. Default "localhost". Setting this to a
/// remote hostname/IP lets users point LU at a ComfyUI running on
@@ -281,7 +283,7 @@ impl AppState {
ollama_process: Mutex::new(None),
bundled_engine: Mutex::new(None),
bundled_embed: Mutex::new(None),
- comfy_path: Mutex::new(None),
+ comfy_path: Arc::new(Mutex::new(None)),
comfy_port: Mutex::new(initial_port),
comfy_host: Mutex::new(initial_host),
ollama_base: Mutex::new(initial_ollama_base),
diff --git a/src/components/settings/SettingsPage.tsx b/src/components/settings/SettingsPage.tsx
index 5ec4e3d7..bbc7ae56 100644
--- a/src/components/settings/SettingsPage.tsx
+++ b/src/components/settings/SettingsPage.tsx
@@ -547,7 +547,13 @@ function ComfyUISettings() {
setInstallPhase('comfyui')
setInstallLogs(['Installing ComfyUI…'])
try {
- await backendCall('install_comfyui')
+ // andy_38747 (Discord): let the Path field double as the install
+ // target so the multi-GB install can land on another drive.
+ // Empty field → backend default (~/ComfyUI). On a carcass
+ // re-install with no override, reuse the detected path so the
+ // repair happens where the broken install lives.
+ const installTarget = customPath.trim() || status?.path || ''
+ await backendCall('install_comfyui', installTarget ? { installPath: installTarget } : {})
const poll = setInterval(async () => {
try {
const data: any = await backendCall('install_comfyui_status')
@@ -573,6 +579,11 @@ function ComfyUISettings() {
{status?.complete === false ? 'Re-install ComfyUI' : 'Install ComfyUI'}
</button>
)}
+ {(!status?.found || status?.complete === false) && installPhase === 'idle' && (
+ <p className="w-full text-[0.55rem] text-gray-600">
+ Installs to your home folder by default. Set Path above (e.g. D:\ComfyUI) to install on another drive.
+ </p>
+ )}
{installPhase !== 'idle' && (
<div className="w-full mt-2 space-y-1">
<div className="flex items-center gap-1.5 text-[0.6rem] text-gray-400">