#!/usr/bin/env python3
import sys, os, json, logging
from pathlib import Path

sys.path.insert(0, str(Path('.')).resolve())

# 导入 creator 模块中的函数
from scripts.creator import select_next_topic, run_pipeline_topic

# 设置日志
logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s')

# 选择并锁定 A01
topic = select_next_topic('A01')
if topic:
    print(f"✅ 选中选题: {topic['id']} - {topic['title']}")
    # 执行流水线
    result = run_pipeline_topic(topic)
    print("生成结果:", result)
else:
    print("❌ 无法选中选题 A01")
