feat(server): do not parse lora fromt client-side prompts (#1083)

This commit is contained in:
leejet 2025-12-13 14:27:47 +08:00 committed by GitHub
parent 6888fcb581
commit 15d0f82760
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 5 additions and 2 deletions

View File

@ -1349,6 +1349,9 @@ struct SDGenerationParams {
} }
void extract_and_remove_lora(const std::string& lora_model_dir) { void extract_and_remove_lora(const std::string& lora_model_dir) {
if (lora_model_dir.empty()) {
return;
}
static const std::regex re(R"(<lora:([^:>]+):([^>]+)>)"); static const std::regex re(R"(<lora:([^:>]+):([^>]+)>)");
static const std::vector<std::string> valid_ext = {".pt", ".safetensors", ".gguf"}; static const std::vector<std::string> valid_ext = {".pt", ".safetensors", ".gguf"};
std::smatch m; std::smatch m;

View File

@ -425,7 +425,7 @@ int main(int argc, const char** argv) {
return; return;
} }
if (!gen_params.process_and_check(IMG_GEN, ctx_params.lora_model_dir)) { if (!gen_params.process_and_check(IMG_GEN, "")) {
res.status = 400; res.status = 400;
res.set_content(R"({"error":"invalid params"})", "application/json"); res.set_content(R"({"error":"invalid params"})", "application/json");
return; return;
@ -605,7 +605,7 @@ int main(int argc, const char** argv) {
return; return;
} }
if (!gen_params.process_and_check(IMG_GEN, ctx_params.lora_model_dir)) { if (!gen_params.process_and_check(IMG_GEN, "")) {
res.status = 400; res.status = 400;
res.set_content(R"({"error":"invalid params"})", "application/json"); res.set_content(R"({"error":"invalid params"})", "application/json");
return; return;