From 77b30a3ca6afdc5887d5915f6ce7fa6c7cd3bc46 Mon Sep 17 00:00:00 2001 From: Jason Hoku Date: Sat, 14 Mar 2026 02:16:02 -0700 Subject: [PATCH] refactor: migrate config_builder_node.py CivitAI calls to network gateway Co-Authored-By: Claude Opus 4.6 (1M context) --- config_builder_node.py | 17 ++--------------- 1 file changed, 2 insertions(+), 15 deletions(-) diff --git a/config_builder_node.py b/config_builder_node.py index c50e3c1..aa8f145 100644 --- a/config_builder_node.py +++ b/config_builder_node.py @@ -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):