第一次提交
This commit is contained in:
157
verify_v3_code.py
Normal file
157
verify_v3_code.py
Normal file
@@ -0,0 +1,157 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
"""
|
||||
Verify streamlit_app_v3.py code structure and functionality
|
||||
"""
|
||||
import sys
|
||||
from pathlib import Path
|
||||
|
||||
print("=" * 70)
|
||||
print("Streamlit V3 - Code Verification")
|
||||
print("=" * 70)
|
||||
print()
|
||||
|
||||
# 1. Check file existence
|
||||
print("1. Checking file existence...")
|
||||
v3_file = Path("frontend/streamlit_app_v3.py")
|
||||
if v3_file.exists():
|
||||
print(f" [OK] frontend/streamlit_app_v3.py exists ({v3_file.stat().st_size:,} bytes)")
|
||||
else:
|
||||
print(f" [ERROR] frontend/streamlit_app_v3.py not found")
|
||||
sys.exit(1)
|
||||
print()
|
||||
|
||||
# 2. Check key functions
|
||||
print("2. Checking key functions...")
|
||||
with open(v3_file, 'r', encoding='utf-8') as f:
|
||||
content = f.read()
|
||||
|
||||
required_functions = [
|
||||
"init_session_state",
|
||||
"display_agent_status_row",
|
||||
"display_active_agent_banner",
|
||||
"display_chat_flow",
|
||||
"create_agents",
|
||||
"add_message",
|
||||
"main"
|
||||
]
|
||||
|
||||
for func in required_functions:
|
||||
if f"def {func}(" in content:
|
||||
print(f" [OK] {func}() defined")
|
||||
else:
|
||||
print(f" [MISSING] {func}() not found")
|
||||
print()
|
||||
|
||||
# 3. Check Agent configuration
|
||||
print("3. Checking Agent configuration...")
|
||||
agents = ["PM_Agent", "QA_Agent", "Dev_Agent", "Orchestrator", "User_Proxy"]
|
||||
for agent in agents:
|
||||
if f'"{agent}"' in content:
|
||||
print(f" [OK] {agent} configured")
|
||||
else:
|
||||
print(f" [MISSING] {agent} not configured")
|
||||
print()
|
||||
|
||||
# 4. Check CSS styles
|
||||
print("4. Checking CSS styles...")
|
||||
css_classes = [
|
||||
"agent-status-card",
|
||||
"agent-chat-bubble",
|
||||
"active-agent-banner",
|
||||
"task-badge",
|
||||
"chat-flow-indicator"
|
||||
]
|
||||
|
||||
for css_class in css_classes:
|
||||
if css_class in content:
|
||||
print(f" [OK] .{css_class} defined")
|
||||
else:
|
||||
print(f" [MISSING] .{css_class} not found")
|
||||
print()
|
||||
|
||||
# 5. Check core features
|
||||
print("5. Checking core features...")
|
||||
features = {
|
||||
"Real-time Agent Status": "agent_status",
|
||||
"Task Badge": "task",
|
||||
"Chat Flow": "chat_flow",
|
||||
"Current Agent": "current_agent",
|
||||
"Flow Arrow": "flow-arrow"
|
||||
}
|
||||
|
||||
for feature_name, feature_key in features.items():
|
||||
if feature_key in content:
|
||||
print(f" [OK] {feature_name} implemented")
|
||||
else:
|
||||
print(f" [MISSING] {feature_name} not found")
|
||||
print()
|
||||
|
||||
# 6. Check imports
|
||||
print("6. Checking imports...")
|
||||
required_imports = [
|
||||
"import streamlit as st",
|
||||
"from autogen import",
|
||||
"from config.llm_config import"
|
||||
]
|
||||
|
||||
for imp in required_imports:
|
||||
if imp in content:
|
||||
print(f" [OK] {imp}")
|
||||
else:
|
||||
print(f" [MISSING] {imp}")
|
||||
print()
|
||||
|
||||
# 7. Syntax check
|
||||
print("7. Python syntax check...")
|
||||
import py_compile
|
||||
try:
|
||||
py_compile.compile(str(v3_file), doraise=True)
|
||||
print(f" [OK] Syntax valid")
|
||||
except py_compile.PyCompileError as e:
|
||||
print(f" [ERROR] Syntax error: {e}")
|
||||
print()
|
||||
|
||||
# 8. File structure comparison
|
||||
print("8. Comparing with v2...")
|
||||
v2_file = Path("frontend/streamlit_app.py")
|
||||
v3_file_path = Path("frontend/streamlit_app_v3.py")
|
||||
|
||||
print(f" v2 (streamlit_app.py): {v2_file.stat().st_size:,} bytes")
|
||||
print(f" v3 (streamlit_app_v3.py): {v3_file_path.stat().st_size:,} bytes")
|
||||
if v2_file.exists():
|
||||
size_diff = v3_file_path.stat().st_size - v2_file.stat().st_size
|
||||
print(f" Size increase: {size_diff:,} bytes")
|
||||
print()
|
||||
|
||||
# 9. Summary
|
||||
print("=" * 70)
|
||||
print("Verification Summary")
|
||||
print("=" * 70)
|
||||
print()
|
||||
|
||||
all_checks_passed = True
|
||||
checks = [
|
||||
v3_file.exists(),
|
||||
all(f"def {func}(" in content for func in required_functions),
|
||||
all(f'"{agent}"' in content for agent in agents),
|
||||
all(css_class in content for css_class in css_classes),
|
||||
all(feature_key in content for feature_key in features.values()),
|
||||
]
|
||||
|
||||
if all(checks):
|
||||
print("[OK] All checks passed!")
|
||||
print()
|
||||
print("New features in V3:")
|
||||
print(" - Real-time Agent Status Row (with task badges)")
|
||||
print(" - Active Agent Banner (green highlight)")
|
||||
print(" - Chat Flow Display (colored bubbles)")
|
||||
print(" - Task Badge System")
|
||||
print(" - Flow Direction Arrows")
|
||||
print(" - Timestamp Display")
|
||||
print()
|
||||
print("Usage:")
|
||||
print(" streamlit run frontend/streamlit_app_v3.py")
|
||||
else:
|
||||
print("Warning: Some checks failed. Please review the output above.")
|
||||
|
||||
print()
|
||||
Reference in New Issue
Block a user