Files
Crawl_demo/README.md
2026-03-18 18:57:58 +08:00

71 lines
1.7 KiB
Markdown
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# Crawl_demo — BI 看板 + 趋势引擎 + AI 分析
本项目从 MySQL`sql.md`)抽取电商数据,生成 BI 数据看板,并实现:
- 实时曲线:销量/GMV/排名等核心指标的近实时刷新
- 趋势预测:潜伏期识别、爆发力评分、时间序列预测
- 决策辅助:跟卖指数、生命周期预警
- AI 分析:基于向量库检索 + LLM总结“为什么它在涨、是否值得跟卖、风险点”
## 目录
- `backend/`FastAPI指标 API、趋势引擎、AI 检索/分析、ETL 任务)
- `frontend/`Next.jsBI 看板 UI
## 快速开始
1) 复制环境变量
```bash
cp backend/.env.example backend/.env
cp frontend/.env.example frontend/.env.local
```
### 一键 Docker 启动(推荐)
在项目根目录执行:
```bash
sh dev.sh
```
然后打开:
- 前端:`http://localhost:3001`
- 后端:`http://localhost:8000/docs`
启动脚本会自动输出:
- 容器 `ps` 状态
- 前后端最近日志tail
- HTTP 快速自检结果backend/frontend/api-proxy
2) 启动后端与前端(本地开发)
```bash
cd backend && python -m venv .venv && source .venv/bin/activate
pip install -r requirements.txt
uvicorn app.main:app --reload --port 8000
```
```bash
cd frontend
npm install
npm run dev
```
3) 打开页面
- 前端:`http://localhost:3000`
- 后端:`http://localhost:8000/docs`
## AI / 向量库
本项目默认支持 Milvus向量数据库。你也可以替换为 Azure SQL / Azure AI Search 等“MS 系”向量能力:
- 先把 embedding 与 upsert 部分抽象在 `backend/app/vector/`
- 替换实现即可
> 如果未配置 `OPENAI_API_KEY`AI 分析接口会降级为规则引擎的“可解释摘要”,不调用 LLM。