mirror of
https://github.com/willmiao/ComfyUI-Lora-Manager.git
synced 2026-03-25 15:15:44 -03:00
feat(model_download): add file_params JSON parsing to download handler
- Parse optional file_params query parameter as JSON in ModelDownloadHandler - Add error handling for invalid JSON with warning log - Maintain backward compatibility with existing download parameters
This commit is contained in:
@@ -1142,6 +1142,7 @@ class ModelDownloadHandler:
|
|||||||
request.query.get("use_default_paths", "false").lower() == "true"
|
request.query.get("use_default_paths", "false").lower() == "true"
|
||||||
)
|
)
|
||||||
source = request.query.get("source")
|
source = request.query.get("source")
|
||||||
|
file_params_json = request.query.get("file_params")
|
||||||
|
|
||||||
data = {"model_id": model_id, "use_default_paths": use_default_paths}
|
data = {"model_id": model_id, "use_default_paths": use_default_paths}
|
||||||
if model_version_id:
|
if model_version_id:
|
||||||
@@ -1150,6 +1151,12 @@ class ModelDownloadHandler:
|
|||||||
data["download_id"] = download_id
|
data["download_id"] = download_id
|
||||||
if source:
|
if source:
|
||||||
data["source"] = source
|
data["source"] = source
|
||||||
|
if file_params_json:
|
||||||
|
import json
|
||||||
|
try:
|
||||||
|
data["file_params"] = json.loads(file_params_json)
|
||||||
|
except json.JSONDecodeError:
|
||||||
|
self._logger.warning("Invalid file_params JSON: %s", file_params_json)
|
||||||
|
|
||||||
loop = asyncio.get_event_loop()
|
loop = asyncio.get_event_loop()
|
||||||
future = loop.create_future()
|
future = loop.create_future()
|
||||||
|
|||||||
Reference in New Issue
Block a user