Merge branch 'refactor/backend-architecture' into development

This commit is contained in:
yangshilin
2026-03-18 17:18:23 +08:00
parent 2070a03d35
commit 48b70e1350
266 changed files with 12386 additions and 9690 deletions

View File

@@ -78,17 +78,26 @@ ACCESS_TOKEN_EXPIRE_MINUTES=120
```bash
cd api
pip install -r requirements.txt
uv sync
```
### 4. 启动 FastAPI 服务
### 4. 数据库迁移(首次或 schema 变更后)
```bash
cd api
uv run alembic upgrade head
```
> 数据库 schema 由 Alembic 管理,不再在应用启动时自动建表。新库或 schema 变更后需执行上述命令。
### 5. 启动 FastAPI 服务
```bash
cd api
uvicorn main:app --reload --host 0.0.0.0 --port 8000
```
### 5. 启动 Celery Worker
### 6. 启动 Celery Worker
在另一个终端窗口:
@@ -242,7 +251,7 @@ asyncio.run(test())
### 手动触发 Celery 任务
```python
from tasks.memoir_tasks import process_memoir_segments
from app.tasks.memoir_tasks import process_memoir_segments
# 同步调用(测试)
result = process_memoir_segments.delay("user_id", ["segment_id_1", "segment_id_2"])