lora trigger sheet

This commit is contained in:
2026-06-28 16:14:22 -07:00
parent 76ade4f768
commit 9bd45977e2

View File

@@ -18,6 +18,7 @@ from pathlib import Path
import hashlib
import time
from urllib.error import HTTPError, URLError
from urllib.parse import quote
from urllib.request import urlopen, Request
@@ -177,8 +178,9 @@ def lookup_source(filepath, filename, cache):
if cached:
url = cached.get("url")
label = cached.get("label")
if url and (now - cached.get("last_checked", 0)) < 86400 * 30:
return url, label
last = cached.get("last_checked", 0)
if (now - last) < 86400 * 30:
return (url, label) if url else (None, None)
# CivitAI model-version lookup by BLAKE2b file hash
try:
@@ -211,7 +213,7 @@ def lookup_source(filepath, filename, cache):
)
data = _fetch_json(
"https://huggingface.co/api/models"
f"?search={q}&sort=downloads&direction=-1&limit=3"
f"?search={quote(q)}&sort=downloads&direction=-1&limit=3"
)
if isinstance(data, list) and len(data) > 0:
model_id = data[0].get("modelId", "")