Files
XH-202619/run_paper_example.py

47 lines
1.5 KiB
Python

import json
import os
import sys
from pathlib import Path
# 添加根目录到 path
root_dir = Path(__file__).resolve().parent
if str(root_dir) not in sys.path:
sys.path.insert(0, str(root_dir))
from src.agent.engine import AIScientistEngine
from src.config import Config
def main():
print("=" * 60)
print("🚀 启动 AI Scientist 端到端论文与研究计划生成实例")
print("=" * 60)
problem_statement = "利用 SDSS DR18 光学测光与脉冲星计时数据,探索致密双星系统 J0740+6620 中自转周期的微小突变(Glitch)与伴星物质吸积及磁场衰减的耦合机制。"
engine = AIScientistEngine()
print(f"\n[任务目标]: {problem_statement}\n")
final_report = None
for step in engine.run_discovery_flow(problem_statement, category="astro-ph"):
stage = step.get("stage")
msg = step.get("msg")
status = step.get("status")
if status == "running":
print(f"⏳ [{stage}] {msg}")
elif status == "completed":
print(f"✅ [{stage}] {msg}")
if "report_md" in step:
final_report = step["report_md"]
elif status == "round_complete":
rev = step.get("review", {})
print(f"🔍 [{stage}] 第 {step.get('round')} 轮审查得分: {rev.get('total_score')}/50 | 裁决: {rev.get('decision')}")
print("\n" + "=" * 60)
print("🎉 生成完毕!论文研究计划报告已成功保存至 outputs 目录。")
print("=" * 60)
if __name__ == "__main__":
main()