第二版

This commit is contained in:
ZhuJW
2026-03-13 18:12:31 +08:00
parent 078f928f75
commit 402adfdcd3
28 changed files with 2408 additions and 3068 deletions

133
check_config.py Normal file
View File

@@ -0,0 +1,133 @@
"""
Configuration Check Script
Verify project configuration is correct
"""
import sys
from pathlib import Path
def check_python_version():
"""Check Python version"""
print("Checking Python version...")
if sys.version_info < (3, 10):
print(f"[ERROR] Python version too low: {sys.version}")
print(" Required: Python 3.10+")
return False
print(f"[OK] Python version: {sys.version.split()[0]}")
return True
def check_dependencies():
"""Check required packages"""
print("\nChecking dependencies...")
required_packages = {
'crewai': 'CrewAI',
'fastapi': 'FastAPI',
'uvicorn': 'Uvicorn',
'pydantic': 'Pydantic',
'pydantic_settings': 'Pydantic Settings',
'dotenv': 'python-dotenv'
}
all_ok = True
for package, name in required_packages.items():
try:
__import__(package)
print(f"[OK] {name}: Installed")
except ImportError:
print(f"[ERROR] {name}: Not installed")
all_ok = False
return all_ok
def check_env_file():
"""Check environment file"""
print("\nChecking environment configuration...")
env_file = Path('.env')
env_example = Path('.env.example')
if not env_example.exists():
print("[ERROR] .env.example file not found")
return False
print("[OK] .env.example exists")
if not env_file.exists():
print("[WARNING] .env file not found. Please copy from .env.example and configure")
print(" Command: cp .env.example .env")
return False
print("[OK] .env file exists")
# Check API Key
with open(env_file, 'r', encoding='utf-8') as f:
content = f.read()
if 'DASHSCOPE_API_KEY=your_dashscope_api_key_here' in content:
print("[WARNING] Please configure valid DashScope API Key in .env file")
return False
elif 'DASHSCOPE_API_KEY=' in content:
print("[OK] DashScope API Key configured")
return True
def check_project_structure():
"""Check project structure"""
print("\nChecking project structure...")
required_files = [
'main.py',
'agents/__init__.py',
'agents/pm_agent.py',
'agents/qa_agent.py',
'agents/dev_agent.py',
'crews/__init__.py',
'crews/sdlc_crew.py',
'models/__init__.py',
'models/qwen_config.py',
'static/index.html',
'requirements.txt'
]
all_ok = True
for file_path in required_files:
if Path(file_path).exists():
print(f"[OK] {file_path}")
else:
print(f"[ERROR] {file_path} not found")
all_ok = False
return all_ok
def main():
"""Main function"""
print("=" * 60)
print("SDLC Agent Demo - Configuration Check")
print("=" * 60)
checks = [
check_python_version(),
check_dependencies(),
check_env_file(),
check_project_structure()
]
print("\n" + "=" * 60)
if all(checks):
print("All checks passed! Ready to start the service.")
print("\nStart command:")
print(" uvicorn main:app --reload --host 0.0.0.0 --port 8000")
print("\nAccess URL:")
print(" http://localhost:8000/static/index.html")
else:
print("Some checks failed. Please fix the issues first.")
print("=" * 60)
if __name__ == '__main__':
main()