#!/usr/bin/env python3 """测试完整流水线(A05选题)""" import sys, subprocess, json from pathlib import Path PROJECT_ROOT = Path('/root/.openclaw/workspaces/yzr-yxl/projects/yu-zhi-ran') sys.path.insert(0, str(PROJECT_ROOT)) def run(cmd): print(f"\n▶️ {' '.join(cmd)}") result = subprocess.run(cmd, cwd=str(PROJECT_ROOT), capture_output=True, text=True, timeout=300) if result.returncode != 0: print(f"❌ 失败: {result.stderr}") return False print(f"✅ 完成: {result.stdout.strip()}") return True def main(): topic_id = "A05" steps = [ ["python3", "scripts/research.py", "--topic-id", topic_id], ["python3", "scripts/outline.py", "--topic-id", topic_id], ["python3", "scripts/writer.py", "--topic-id", topic_id] ] for step in steps: if not run(step): print(f"\n❌ 流水线在步骤 {step} 中断") return 1 print("\n✅ 全流程测试成功!") return 0 if __name__ == "__main__": sys.exit(main())