5c028d7952
包含 FastAPI 后端、React 前端、队列/OCR/标签/待办等完整功能。 Co-authored-by: Cursor <cursoragent@cursor.com>
45 lines
1.2 KiB
Markdown
45 lines
1.2 KiB
Markdown
# snapAna Backend
|
||
|
||
基于 FastAPI 的截图分析与分类后端。
|
||
|
||
## 安装
|
||
|
||
```bash
|
||
cd backend
|
||
python -m venv .venv
|
||
.venv\Scripts\activate # Windows
|
||
pip install -r requirements.txt
|
||
```
|
||
|
||
可选依赖:
|
||
|
||
- 本地 OCR:安装 [Tesseract OCR](https://github.com/UB-Mannheim/tesseract/wiki) 并放入 PATH,下载 `chi_sim` 中文语言包。
|
||
- 本地 VLM:安装 [Ollama](https://ollama.com),拉取 `qwen2.5vl:7b` 等多模态模型。
|
||
|
||
## 启动
|
||
|
||
```bash
|
||
copy .env.example .env # 按需修改
|
||
python run.py
|
||
```
|
||
|
||
默认监听 `http://127.0.0.1:8765`。OpenAPI 在 `/docs`。
|
||
|
||
## 数据目录
|
||
|
||
- SQLite 主库:`backend/.data/snapana.db`
|
||
- 缩略图缓存:`backend/.data/thumbs/`
|
||
|
||
可通过 `.env` 的 `DATA_DIR` 自定义。
|
||
|
||
## Provider 配置
|
||
|
||
在前端 `设置` 页或通过 `/api/settings/providers/{key}` 接口配置:
|
||
|
||
- OCR:`tesseract`(本地)或 `none`(仅靠 VLM 看图)
|
||
- VLM:`openai_compat`,`base_url` 形如:
|
||
- 本地 Ollama:`http://localhost:11434/v1`,model 例如 `qwen2.5vl:7b`
|
||
- 智谱 GLM:`https://open.bigmodel.cn/api/paas/v4`,model 例如 `glm-4v-flash`
|
||
- MiniMax:`https://api.minimaxi.com/v1`
|
||
- OpenAI:`https://api.openai.com/v1`,model 例如 `gpt-4o-mini`
|