chore(docker-compose): 更新PADDLEX_URI和NO_PROXY配置,调整GPU设备ID,优化环境变量设置

This commit is contained in:
Wenjie Zhang 2025-07-27 02:56:50 +08:00
parent 316bc609c2
commit c14bd06db6
6 changed files with 40 additions and 37 deletions

View File

@ -32,6 +32,8 @@ https://github.com/user-attachments/assets/15f7f315-003d-4e41-a260-739c2529f824
### 系统要求
项目本身不需要显卡支持,可以运行在任何设备上。对于模型推理或者文档解析服务都可以和项目本身解耦,通过环境变量配置对应的服务即可。同时项目也提供了本地部署基于 vllm 的脚本。
- Docker 和 Docker Compose
- 2GB+ 可用内存
- 可选CUDA 支持的 GPU用于 OCR 服务)
@ -71,16 +73,13 @@ https://github.com/user-attachments/assets/15f7f315-003d-4e41-a260-739c2529f824
### 故障排除
- **镜像拉取失败**:如果拉取镜像失败,可以尝试手动拉取:
```bash
bash docker/pull_image.sh python:3.13-slim # 替换后面的 repo_name 即可
```
- **内存不足**:如果 Milvus 启动失败,执行 `docker compose up milvus -d && docker restart api-dev`
- **查看日志**`docker logs api-dev -f`
## 📋 更新日志
- **2025.05.07** - 新增三级权限控制系统 [PR#173](https://github.com/xerrors/Yuxi-Know/pull/173)
- **2025.03.30** - 智能体功能集成 [PR#96](https://github.com/xerrors/Yuxi-Know/pull/96)
- **2025.02.24** - 新增网页检索功能,支持实时信息获取
- **2025.02.23** - SiliconFlow Rerank 和 Embedding 模型支持
- **2025.02.20** - DeepSeek-R1 模型支持
## 🤖 模型配置
@ -108,10 +107,15 @@ DEEPSEEK_API_KEY=sk-your-deepseek-key
TAVILY_API_KEY=your-tavily-key # 联网搜索功能
```
### 本地模型部署
### OpenAI 兼容模型
支持通过 vLLM 或 Ollama 部署本地模型:
然后在 Web 界面的"设置"中添加本地模型地址。
项目理论上兼容任何 OpenAI 兼容的模型,包括但不限于:
- vLLM
- Ollama
- 其他 API 中转或者代理服务
在 Web 界面的"设置"中添加本地模型地址。
![本地模型配置](./docs/images/custom_models.png)
@ -140,18 +144,19 @@ TAVILY_API_KEY=your-tavily-key # 联网搜索功能
3. **现有图谱接入**:修改 `docker-compose.yml` 中的 `NEO4J_URI` 配置
### 高级功能
- **联网搜索**:配置 `TAVILY_API_KEY` 获取实时信息
- **智能体开发**:支持自定义智能体逻辑
- **权限管理**:三级用户权限体系
- **OCR 增强**:可选 MinerU 或 PP-Structure-V3 服务
## 🔧 高级配置
### OCR 服务(可选)
提升 PDF 解析准确性,需要 GPU 支持:
对于基础的 OCR 服务RapidOCR onnx 版本),可以使用 SWHL/RapidOCR 的 onnx 版本,但是需要提前将模型下载到 `$MODEL_DIR` 目录下。
```bash
huggingface-cli download SWHL/RapidOCR --local-dir ${MODEL_DIR:-./models}/SWHL/RapidOCR
```
*如果提示 `[Errno 13] Permission denied` 则需要使用 sudo 修改权限之后再执行*
提升 PDF 解析准确性,可以选择使用 MinerU 或 PP-Structure-V3 服务,但是需要 GPU 支持:
```bash
# MinerU需要 CUDA 12.4+
@ -191,13 +196,7 @@ your_provider:
## ❓ 常见问题
### 安装和部署
**Q: 如何优雅拉取镜像?**
```bash
bash docker/pull_image.sh python:3.12
```
暂无
## 🤝 参与贡献

View File

@ -27,12 +27,12 @@ services:
- MILVUS_URI=${MILVUS_URI:-http://milvus:19530}
- MILVUS_TOKEN=${MILVUS_TOKEN:-}
- MINERU_OCR_URI=${MINERU_OCR_URI:-http://mineru:30000}
- PADDLEX_URI=${PADDLEX_URI:-http://paddlex-ocr:8080}
- PADDLEX_URI=${PADDLEX_URI:-http://paddlex:8080}
- MINIO_URI=${MINIO_URI:-http://milvus-minio:9000}
- MODEL_DIR=/models
- RUNNING_IN_DOCKER=true
- NO_PROXY=localhost,127.0.0.1,milvus,graph,milvus-minio,milvus-etcd-dev,etcd,minio
- no_proxy=localhost,127.0.0.1,milvus,graph,milvus-minio,milvus-etcd-dev,etcd,minio
- NO_PROXY=localhost,127.0.0.1,milvus,graph,milvus-minio,milvus-etcd-dev,etcd,minio,mineru,paddlex
- no_proxy=localhost,127.0.0.1,milvus,graph,milvus-minio,milvus-etcd-dev,etcd,minio,mineru,paddlex
command: uv run uvicorn server.main:app --host 0.0.0.0 --port 5050 --reload
restart: unless-stopped
healthcheck:
@ -223,7 +223,7 @@ services:
reservations:
devices:
- driver: nvidia
device_ids: ["1"]
device_ids: ["0"]
capabilities: [gpu]
networks:
- app-network

View File

@ -9,7 +9,7 @@
- [x] 优化现有向量模型的逻辑,全局配置的向量模型作为新建知识库的默认模型,但是查询的时候,使用对应数据库的向量模型查询(单例模式)(🌟🌟🌟)
- [x] 多类型知识库支持(🌟🌟🌟🌟🌟)
- [x] 设计问答知识库,支持针对问答对的调优
- [ ] 进一步优化知识库的设计,需要将 chroma 和 milvus 知识库合并在一起,只是说使用的后端存储不同,这个应该放在创建知识库的时候选择,如果选择的是 CommonRAG 知识库的话就是用这种。
- [x] 添加了批量上传文件的脚本,并优化文件信息
🐛**BUGs**
- [x] 智能体的工具切换有问题

View File

@ -29,7 +29,6 @@ dependencies = [
"llama-index-readers-file>=0.4.7",
"markdownify>=1.1.0",
"mcp>=1.12.0",
"mineru>=2.0.6",
"neo4j>=5.28.1",
"networkx>=3.5",
"openai>=1.76.0",
@ -48,6 +47,11 @@ dependencies = [
"tavily-python>=0.7.0",
"unstructured>=0.17.2",
"uvicorn[standard]>=0.34.2",
"httpx>=0.27.0",
"tqdm>=4.66.4",
"rich>=13.7.1",
"typer>=0.16.0",
"mineru>=2.1.6",
]
[tool.ruff]
line-length = 210 # 代码最大行宽

View File

@ -220,7 +220,7 @@ async def check_ocr_services_health(current_user: User = Depends(get_admin_user)
health_status["mineru_ocr"]["message"] = f"MinerU服务运行正常 ({mineru_uri})"
else:
health_status["mineru_ocr"]["status"] = "unhealthy"
health_status["mineru_ocr"]["message"] = f"MinerU服务响应异常: {response.status_code}"
health_status["mineru_ocr"]["message"] = f"MinerU服务响应异常({mineru_uri}): {response.status_code}"
except requests.exceptions.ConnectionError:
health_status["mineru_ocr"]["status"] = "unavailable"
health_status["mineru_ocr"]["message"] = "MinerU服务无法连接请检查服务是否启动"
@ -239,16 +239,16 @@ async def check_ocr_services_health(current_user: User = Depends(get_admin_user)
response = requests.get(health_url, timeout=5)
if response.status_code == 200:
health_status["paddlex_ocr"]["status"] = "healthy"
health_status["paddlex_ocr"]["message"] = f"PaddleX服务运行正常 ({paddlex_uri})"
health_status["paddlex_ocr"]["message"] = f"PaddleX服务运行正常({paddlex_uri})"
else:
health_status["paddlex_ocr"]["status"] = "unhealthy"
health_status["paddlex_ocr"]["message"] = f"PaddleX服务响应异常: {response.status_code}"
health_status["paddlex_ocr"]["message"] = f"PaddleX服务响应异常({paddlex_uri}): {response.status_code}"
except requests.exceptions.ConnectionError:
health_status["paddlex_ocr"]["status"] = "unavailable"
health_status["paddlex_ocr"]["message"] = "PaddleX服务无法连接请检查服务是否启动"
health_status["paddlex_ocr"]["message"] = "PaddleX服务无法连接请检查服务是否启动({paddlex_uri})"
except requests.exceptions.Timeout:
health_status["paddlex_ocr"]["status"] = "timeout"
health_status["paddlex_ocr"]["message"] = "PaddleX服务连接超时"
health_status["paddlex_ocr"]["message"] = "PaddleX服务连接超时({paddlex_uri})"
except Exception as e:
health_status["paddlex_ocr"]["status"] = "error"
health_status["paddlex_ocr"]["message"] = f"PaddleX服务检查失败: {str(e)}"

View File

@ -71,7 +71,7 @@ const props = defineProps({
h1 {
margin: 0;
font-size: 20px;
font-size: 18px;
font-weight: 500;
color: rgba(0, 0, 0, 0.85);
}