From 58749898bd0540e76fc360b4a6572d8f86f1c770 Mon Sep 17 00:00:00 2001 From: mikemikimike <186855910+mikemikimike@users.noreply.github.com> Date: Thu, 1 Oct 2026 20:49:08 +0800 Subject: [PATCH] fix: avoid scanning cwd for default lora cache --- examples/common/common.h | 2 +- examples/server/runtime.cpp | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/examples/common/common.h b/examples/common/common.h index d0d39b738..223d77487 100644 --- a/examples/common/common.h +++ b/examples/common/common.h @@ -144,7 +144,7 @@ struct SDContextParams { std::string pulid_weights_path; sd_type_t wtype = SD_TYPE_COUNT; std::string tensor_type_rules; - std::string lora_model_dir = "."; + std::string lora_model_dir; std::string hires_upscalers_dir; std::map embedding_map; diff --git a/examples/server/runtime.cpp b/examples/server/runtime.cpp index 3a209313a..1a71cf76f 100644 --- a/examples/server/runtime.cpp +++ b/examples/server/runtime.cpp @@ -254,6 +254,12 @@ std::string SDSvrParams::to_string() const { void refresh_lora_cache(ServerRuntime& rt) { std::vector new_cache; + if (rt.ctx_params->lora_model_dir.empty()) { + std::lock_guard lock(*rt.lora_mutex); + rt.lora_cache->clear(); + return; + } + fs::path lora_dir = rt.ctx_params->lora_model_dir; std::error_code ec; if (fs::exists(lora_dir, ec) && !ec && fs::is_directory(lora_dir, ec) && !ec) {