|
|
1 month ago | |
|---|---|---|
| __pycache__ | 1 month ago | |
| backend | 1 month ago | |
| frontend | 1 month ago | |
| templates | 1 month ago | |
| README.md | 1 month ago | |
| main.py | 1 month ago | |
| test.http | 1 month ago |
一套基于 FastAPI + Vue 的端到端运营系统,支持:
backend/
app/ FastAPI 应用(模板 API、渲染服务)
data/templates.json 默认模板库
requirements.txt Python 依赖
frontend/ Vue 3 + Vite WebUI
main.py uvicorn 入口(指向 backend.app.main:app)
cd backend
python -m venv .venv
source .venv/bin/activate
pip install -r requirements.txt
uvicorn main:app --reload # 或 uvicorn backend.app.main:app --reload
接口示例:
GET /api/templates:获取模板列表;POST /api/templates:创建模板;POST /api/templates/render:根据 template_id + 参数生成播报;POST /api/templates/preview:任意 Jinja 正文快速预览。当前 Vite 版本需要 Node.js ≥ 20.19。在 Node 18 环境下 npm run build 会失败(crypto.hash 报错),请升级 Node 后再执行构建或预览。
cd frontend
npm install
npm run dev # 默认 http://localhost:5173,已允许跨域访问 FastAPI
npm run build # 需要 Node >=20.19
POST /api/templates/render 并传入参数列表即可生成播报语;