版本1.0.4 - 发布前准备

- 修复system.py缩进错误
- 优化前端页面样式(待重构)
- 改进API接口结构
- 完善文档和自动化脚本
- 平台基本功能稳定运行
This commit is contained in:
lt
2026-04-29 09:32:43 +08:00
parent 0a31ae09af
commit e1ba31afda
96 changed files with 165251 additions and 376 deletions
+49
View File
@@ -0,0 +1,49 @@
from pathlib import Path
import subprocess
import sys
PROJECT_ROOT = Path(__file__).resolve().parents[4]
def run_publisher(topic_id: str = None):
"""运行发布包生成脚本
Args:
topic_id: 可选,指定单个选题ID
Returns:
dict: 包含 ok, result/error, topic_id 等字段
"""
try:
script_path = PROJECT_ROOT / "scripts" / "publisher.py"
if not script_path.exists():
return {"ok": False, "error": f"Publisher script not found: {script_path}"}
cmd = [sys.executable, str(script_path)]
if topic_id:
cmd.extend(["--topic-id", topic_id])
result = subprocess.run(
cmd,
capture_output=True,
text=True,
cwd=PROJECT_ROOT,
timeout=300 # 5分钟超时
)
if result.returncode == 0:
return {
"ok": True,
"result": result.stdout,
"topic_id": topic_id
}
else:
return {
"ok": False,
"error": result.stderr,
"result": result.stdout,
"topic_id": topic_id
}
except subprocess.TimeoutExpired:
return {"ok": False, "error": "Publisher timed out after 5 minutes", "topic_id": topic_id}
except Exception as e:
return {"ok": False, "error": str(e), "topic_id": topic_id}