Revert "feat(civarchive_client): update get_model_version_info to resolve the real model/version IDs before fetching the target metadata."

This reverts commit c3a66ecf28.
This commit is contained in:
Will Miao
2025-10-11 16:11:17 +08:00
parent 1e8bd88e28
commit ddb30dbb17

View File

@@ -419,41 +419,10 @@ class CivArchiveClient:
Returns:
Tuple[Optional[Dict], Optional[str]]: (version_data, error_message)
"""
try:
lookup_payload, error = await self._request_json(
"/models/1",
params={"modelVersionId": version_id},
)
if error or lookup_payload is None:
logger.error(f"Error performing CivArchive version lookup for {version_id}: {error}")
return None, error or "Model lookup failed"
data = self._normalize_payload(lookup_payload)
version_block = data.get("version")
if not isinstance(version_block, dict):
logger.warning(f"CivArchive lookup for version {version_id} returned no version block")
return None, "Model not found"
actual_version_id = version_block.get("id")
actual_model_id = version_block.get("modelId")
if actual_version_id is None or actual_model_id is None:
logger.warning(
"CivArchive lookup for version %s missing ids (modelId=%s, versionId=%s)",
version_id,
actual_model_id,
actual_version_id,
)
return None, "Model not found"
version = await self.get_model_version(actual_model_id, actual_version_id)
if version is None:
return None, "Model not found"
return version, None
except Exception as exc:
logger.error(f"Error resolving CivArchive model version info for {version_id}: {exc}")
return None, "Model lookup failed"
version = await self.get_model_version(1, version_id)
if version is None:
return None, "Model not found"
return version, None
async def get_model_by_url(self, url) -> Optional[Dict]:
"""Get specific model version by parsing CivArchive HTML page (legacy method)