feat: 完善 MVP-2 演示和进度体验

This commit is contained in:
meijiali
2026-07-03 16:57:39 +08:00
parent 867fd39419
commit 9935f67080
20 changed files with 1252 additions and 33 deletions
+87
View File
@@ -98,3 +98,90 @@ curl -f http://localhost:8000/health
docker compose up -d --build
curl -f http://localhost:8000/health
```
## 公网云服务器部署
第一版公网演示使用云服务器 + Docker Compose,不增加登录或密码。
上线前准备:
```bash
git pull
cp .env.example .env
```
`.env` 中填写真实 Key
```text
TIKHUB_API_KEY=
AI_BASE_URL=
AI_API_KEY=
AI_MODEL=
```
启动:
```bash
docker compose up -d --build
curl -f http://127.0.0.1:8000/health
```
如果服务器安全组直接开放端口,公网入口为:
```text
http://服务器公网 IP:8000
```
也可以用 Nginx 反向代理到本机 `127.0.0.1:8000`
注意:
- 第一版公网不加访问控制,任何知道地址的人都可以访问页面。
- 创建任务会消耗真实 TikHub 和 AI Key。
- 系统仍保持同一时间只允许一个 running 任务,避免多人同时触发造成成本和稳定性问题。
## 初始化 Demo 数据
公网演示建议先初始化脱敏 Demo 数据:
```bash
docker compose exec app python -m app.demo_seed
```
Demo 数据特点:
- 使用脱敏真实感评论文本。
- 不保存作者昵称、平台原始评论 ID、原始内容 URL 或 raw sensitive data。
- 可以和新创建的真实任务同时出现在任务列表中。
## 数据库异常备份与恢复
如果页面出现数据库不可用提示,先不要删除 `data` 目录。
系统会优先备份现有 SQLite 文件到:
```text
data/corrupt-backups/
```
手动诊断:
```bash
docker compose exec app python - <<'PY'
from app.db import engine
from sqlalchemy import text
with engine.connect() as c:
print(c.execute(text("PRAGMA integrity_check")).fetchall())
print(c.exec_driver_sql("PRAGMA wal_checkpoint(TRUNCATE)").fetchall())
PY
```
如果需要重新初始化演示数据:
```bash
docker compose down
mv data/app.db data/corrupt-backups/app.db.manual.bak
rm -f data/app.db-wal data/app.db-shm
docker compose up -d --build
docker compose exec app python -m app.demo_seed
```