File size: 2,219 Bytes
8f3e429 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 | #!/usr/bin/env python3
"""Quick validation script for SAGE app.py (v3.0)"""
import ast
import sys
import os
# Fix Windows console encoding
if sys.platform == "win32":
os.environ.setdefault("PYTHONIOENCODING", "utf-8")
try:
sys.stdout.reconfigure(encoding="utf-8")
except Exception:
pass
def validate():
with open("app.py", "r", encoding="utf-8") as f:
code = f.read()
ok = True
# Syntax
try:
ast.parse(code)
print("[OK] Syntax: PASS")
except SyntaxError as e:
print(f"[FAIL] Syntax: FAIL -- {e}")
return 1
# Imports
required = ["gradio", "httpx", "matplotlib", "numpy"]
for mod in required:
if f"import {mod}" in code or f"from {mod}" in code:
print(f"[OK] Import {mod}: FOUND")
else:
print(f"[WARN] Import {mod}: NOT FOUND")
# Key classes
classes = [
"SageConfig", "BackendClient", "SAGEProAPIClient",
"OllamaClient", "DemoClient", "VisualizationEngine",
]
for cls in classes:
if f"class {cls}" in code:
print(f"[OK] Class {cls}: FOUND")
else:
print(f"[FAIL] Class {cls}: MISSING")
ok = False
# v3.0 Feature methods
v3_features = [
("render_code", "Glass Renderer"),
("vision_debug", "Vision Debugger"),
("toggle_dreamer", "Chaos Dreamer Toggle"),
("get_dreamer_stats", "Chaos Dreamer Stats"),
("_chat_stream", "Streaming Chat (split)"),
]
for method, label in v3_features:
if method in code:
print(f"[OK] v3 Feature [{label}]: FOUND")
else:
print(f"[FAIL] v3 Feature [{label}]: MISSING")
ok = False
# v3.0 UI Tabs
v3_tabs = ["Live Preview", "Vision Debugger", "Chaos Dreamer"]
for tab in v3_tabs:
if tab in code:
print(f"[OK] UI Tab [{tab}]: FOUND")
else:
print(f"[FAIL] UI Tab [{tab}]: MISSING")
ok = False
if ok:
print("\nAll validations passed! (v3.0)")
return 0
else:
print("\nSome validations FAILED.")
return 1
if __name__ == "__main__":
sys.exit(validate())
|