refactor: migrate config_builder_node.py CivitAI calls to network gateway

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
Jason Hoku
2026-03-14 02:16:02 -07:00
co-authored by Claude Opus 4.6
parent f43bdf45e0
commit 77b30a3ca6
+2 -15
View File
@@ -12,8 +12,7 @@ from typing import List, Dict, Any
import server
from aiohttp import web
import hashlib
import urllib.request
import urllib.error
from .network_utils import civitai_fetch_by_hash
@@ -58,19 +57,7 @@ def calculate_sha256(file_path):
def get_model_version_info(hash_value):
"""Fetch model version info from Civitai API using hash"""
api_url = f"https://civitai.com/api/v1/model-versions/by-hash/{hash_value}"
try:
req = urllib.request.Request(api_url, headers={"User-Agent": "ComfyUI-ConfigBuilder"})
with urllib.request.urlopen(req, timeout=10) as response:
if response.status == 200:
return json.loads(response.read().decode("utf-8"))
else:
return None
except urllib.error.HTTPError:
return None
except Exception as e:
print(f"[ConfigBuilder] Error fetching from CivitAI: {e}")
return None
return civitai_fetch_by_hash(hash_value)
def load_and_save_tags(lora_name, force_fetch=False, auto_fetch=True):