mirror of
https://github.com/willmiao/ComfyUI-Lora-Manager.git
synced 2026-03-25 15:15:44 -03:00
feat: batch process model license data retrieval
This commit is contained in:
@@ -1394,11 +1394,14 @@ class ModelUpdateHandler:
|
|||||||
if not model_ids:
|
if not model_ids:
|
||||||
return {}
|
return {}
|
||||||
|
|
||||||
response = await provider.get_model_versions_bulk(model_ids)
|
BATCH_SIZE = 100
|
||||||
|
aggregated: Dict[int, Dict[str, Any]] = {}
|
||||||
|
for start in range(0, len(model_ids), BATCH_SIZE):
|
||||||
|
chunk = model_ids[start : start + BATCH_SIZE]
|
||||||
|
response = await provider.get_model_versions_bulk(chunk)
|
||||||
if not isinstance(response, Mapping):
|
if not isinstance(response, Mapping):
|
||||||
return {}
|
continue
|
||||||
|
|
||||||
license_map: Dict[int, Dict[str, Any]] = {}
|
|
||||||
for raw_id, payload in response.items():
|
for raw_id, payload in response.items():
|
||||||
normalized_id = self._normalize_model_id(raw_id)
|
normalized_id = self._normalize_model_id(raw_id)
|
||||||
if normalized_id is None or not isinstance(payload, Mapping):
|
if normalized_id is None or not isinstance(payload, Mapping):
|
||||||
@@ -1406,8 +1409,9 @@ class ModelUpdateHandler:
|
|||||||
license_data: Dict[str, Any] = {}
|
license_data: Dict[str, Any] = {}
|
||||||
for field in LICENSE_FIELDS:
|
for field in LICENSE_FIELDS:
|
||||||
license_data[field] = payload.get(field)
|
license_data[field] = payload.get(field)
|
||||||
license_map[normalized_id] = license_data
|
aggregated[normalized_id] = license_data
|
||||||
return license_map
|
|
||||||
|
return aggregated
|
||||||
|
|
||||||
def _extract_target_model_ids(self, payload: Dict) -> Optional[List[int]]:
|
def _extract_target_model_ids(self, payload: Dict) -> Optional[List[int]]:
|
||||||
if not isinstance(payload, Mapping):
|
if not isinstance(payload, Mapping):
|
||||||
|
|||||||
Reference in New Issue
Block a user