feat: show model last updated dates
This commit is contained in:
@@ -917,6 +917,11 @@ def _page_description(html: str) -> str:
|
||||
return ""
|
||||
|
||||
|
||||
def _page_updated_at(html: str) -> str | None:
|
||||
match = re.search(r'<span[^>]+title=["\']([^"\']+)["\'][^>]*>[\s\S]{0,1200}?\bUpdated\b', html, re.I)
|
||||
return unescape(match.group(1)).strip() if match else None
|
||||
|
||||
|
||||
def _parameter_hints(text: str) -> list[tuple[float, float]]:
|
||||
hints: set[tuple[float, float]] = set()
|
||||
for match in re.finditer(r"\b([0-9]+(?:\.[0-9]+)?)\s*B\s*[-_]\s*A\s*([0-9]+(?:\.[0-9]+)?)\s*B\b", text, re.I):
|
||||
@@ -1132,11 +1137,13 @@ def _fetch_family_variants(family: str) -> list[dict[str, Any]]:
|
||||
except (HTTPError, URLError, OSError, ValueError):
|
||||
family_html = tags_html
|
||||
description = _page_description(family_html) or _page_description(tags_html)
|
||||
updated_at = _page_updated_at(family_html) or _page_updated_at(tags_html)
|
||||
parameter_text = family_html + " " + tags_html
|
||||
hints = _parameter_hints(parameter_text)
|
||||
rows = _parse_variant_page(tags_html, family)
|
||||
for row in rows:
|
||||
row["description"] = description
|
||||
row["modified_at"] = updated_at
|
||||
hint = _variant_parameter_hint(str(row.get("name") or ""), hints)
|
||||
if hint:
|
||||
row["parameter_size"] = _format_parameter_size(hint[0])
|
||||
|
||||
Reference in New Issue
Block a user