1.2 KiB
1.2 KiB
财务大模型智能问答客服系统后端
Python FastAPI 后端首版 MVP,生产目标数据库为 PostgreSQL,当前 ADP、SMS、文件存储均通过可替换集成层提供 mock 实现。
本地启动
cd code/backend
python -m uvicorn app.main:app --reload --port 8000
默认会使用 sqlite:///./finance_ai.db。生产环境请复制 .env.example 为 .env,并配置:
DATABASE_URL=postgresql+psycopg://finai:finai@127.0.0.1:5432/finai
JWT_SECRET_KEY=replace-with-secret
默认账号
启动时自动创建默认系统管理员:
- 手机号:
13800000000 - Mock 验证码:
123456
已实现接口
GET /healthPOST /api/auth/sms-codePOST /api/auth/loginGET /api/auth/mePOST /api/auth/logoutGET/POST/PATCH /api/usersGET/POST/PATCH/DELETE /api/documentsPOST /api/documents/{id}/retry-parseGET/POST /api/chat/sessionsGET /api/chat/sessions/{id}/messagesPOST /api/chat/streamPOST /api/chat/upload-imagePOST /api/chat/messages/{id}/feedbackGET /api/audit-logsGET /api/stats/overview
测试
cd code/backend
python -m unittest discover -s tests -p "test_*.py"
测试使用临时 SQLite 数据库,不需要 PostgreSQL。