mirror of
https://github.com/HuangYuChuh/ComfyUI_Skills_OpenClaw.git
synced 2026-08-14 08:52:22 +00:00
fix: surface schema load errors and normalize update_server inputs (#41)
- registry.py: replace bare `except Exception: pass` with specific exception handling and a warning log, so corrupted schema.json files are visible instead of silently disappearing from workflow list - services.py: apply the same input normalization in update_server as add_server (strip whitespace, coerce types, apply fallback defaults) to prevent dirty data from entering config Co-authored-by: Kelin <kelin@KelindeMacBook-Air.local> Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Kelin
Claude Sonnet 4.6
parent
ca27560ed7
commit
ffbdd76b52
+6
-3
@@ -1,13 +1,16 @@
|
||||
import os
|
||||
import json
|
||||
import argparse
|
||||
|
||||
import sys
|
||||
from logging import getLogger
|
||||
|
||||
sys.path.insert(0, os.path.dirname(os.path.abspath(__file__)))
|
||||
|
||||
from shared.config import get_server_schema_path, list_server_workflow_dirs
|
||||
from shared.runtime_config import get_runtime_config
|
||||
|
||||
logger = getLogger(__name__)
|
||||
|
||||
|
||||
def get_workflows(is_agent=False):
|
||||
config = get_runtime_config()
|
||||
@@ -71,8 +74,8 @@ def get_workflows(is_agent=False):
|
||||
}
|
||||
|
||||
all_workflows.append(workflow_info)
|
||||
except Exception:
|
||||
pass
|
||||
except (json.JSONDecodeError, OSError) as e:
|
||||
logger.warning("Skipping workflow '%s/%s': %s", server_id, workflow_id, e)
|
||||
|
||||
if is_agent:
|
||||
# Clean internal fields
|
||||
|
||||
+10
-3
@@ -123,9 +123,16 @@ class UIStorageService:
|
||||
config = self.get_config()
|
||||
for s in config.get("servers", []):
|
||||
if s.get("id") == server_id:
|
||||
for key in ("name", "url", "auth", "enabled", "output_dir"):
|
||||
if key in updates:
|
||||
s[key] = updates[key]
|
||||
if "name" in updates:
|
||||
s["name"] = str(updates["name"] or "").strip() or server_id
|
||||
if "url" in updates:
|
||||
s["url"] = str(updates["url"] or "").strip()
|
||||
if "auth" in updates:
|
||||
s["auth"] = str(updates["auth"] or "").strip()
|
||||
if "enabled" in updates:
|
||||
s["enabled"] = bool(updates["enabled"])
|
||||
if "output_dir" in updates:
|
||||
s["output_dir"] = str(updates["output_dir"] or "./outputs").strip() or "./outputs"
|
||||
self.save_config(config)
|
||||
return self._serialize_server_for_ui(s)
|
||||
raise FileNotFoundError(f"Server '{server_id}' not found")
|
||||
|
||||
Reference in New Issue
Block a user