Files
wecom_it_smart_desk/docs/04-运维文档/部署运维/本地AI服务部署指南.md
T
Simon facc04aa65 chore: docs 结构整改 + compose 双目录对齐(合并重建提交)
本提交为 .git 对象库损坏后的重建提交,内容等价于原先三个本地提交
(5e2fd4c2 / 57a53c98 / 5d7e1873)的累积结果,未做任何额外改动。

一、docs 结构整改(整改 #14)
根因:重构时新结构为 untracked 文件,执行 git stash(未带 -u)未纳入,
随后 git reset 拉回 HEAD 旧 tracked 树,导致旧树复活、新旧两棵目录
树并存于 docs/,共 791 文件、双分类体系冲突。

修复动作:
- b2 同名异主题文件改名迁移保全 9 个
- C 类 39 个孤立文件按主题正确归类
- A/B1 类 222 个重复文件删除(新结构已有内容副本)
- 9 个旧独有空目录删除
- 270 处内部引用按 verified 映射改写
- 整改记录 #14 登记于 04-运维文档/部署运维

结果:docs 791 → 569 文件,顶层仅规范 8 类 + 治理文件,单树恢复。
残留:约 20 处指向从未存在文件的陈旧死链,归入独立文档卫生任务。

二、compose 双目录对齐(消除踩坑 A)
- docker-compose.yml:nginx 前端挂载全部由根目录 frontend-*/dist
  改为 src/frontend-*/dist(h5 / agent / admin / terminal)
- docker-compose.dev.yml:dev 服务 build context 与卷同步改 src/
- 效果:本地 docker compose up 不再把根目录 stale dist 挂回,
  与线上一致,分叉隐患消除(已 docker compose config 校验通过)

防复发铁律:
- 重构须提交;仓库修复须 git stash -u 或先 commit
- 新结构须 git add 并提交,避免再次 untracked 复活
- H5 改动只动 src/frontend-h5/,禁改根目录遗留 frontend-*/
2026-08-07 22:31:32 +08:00

101 lines
2.2 KiB
Markdown
Raw 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.
# 本地 AI 服务部署指南(Dify + RAGFlow
> 更新日期:2026-07-06
## 系统要求
| 服务 | 最低内存 | 推荐内存 |
|------|----------|----------|
| Dify (CPU) | 8GB | 16GB |
| RAGFlow (CPU) | 8GB | 16GB |
| 两者同时 | 16GB | 32GB |
**当前可用内存:约 7.4GB**
---
## 方案一:仅部署 Dify(推荐)
### 步骤1:停止本地不需要的容器
```powershell
# 停止开发环境(如果不需要)
docker stop dev_wecom_backend dev_wecom_postgres dev_wecom_redis
```
### 步骤2:部署 Dify (CPU版)
```powershell
cd D:\资料\03-项目开发\wecom_it_smart_desk
mkdir dify && cd dify
# 下载 Docker Compose
curl -o docker-compose.yml https://github.com/langgenius/dify/raw/main/docker/docker-compose.middleware.yaml
# 启动
docker compose up -d
```
### 步骤3:访问
- Web UI: http://localhost:8080
- API: http://localhost:8081
- 默认管理员: admin@dify.local / admin
---
## 方案二:仅部署 RAGFlowCPU版)
### 步骤1:停止本地不需要的容器
```powershell
docker stop dev_wecom_backend dev_wecom_postgres dev_wecom_redis
```
### 步骤2:部署 RAGFlow
```powershell
cd D:\资料\03-项目开发\wecom_it_smart_desk
mkdir ragflow && cd ragflow
# 下载配置
curl -o docker-compose.yml https://raw.githubusercontent.com/infiniflow/ragflow/main/docker/docker-compose.yml
curl -o .env https://raw.githubusercontent.com/infiniflow/ragflow/main/docker/.env
# 启动(使用 CPU profile
docker compose --profile cpu up -d
```
### 步骤3:访问
- Web UI: http://localhost:9380
- API: http://localhost:9380/api
- 默认管理员: root / infiniflow
---
## 方案三:同时部署(需要16GB+内存)
1. 先停止开发容器
2. 部署 Dify(会占用约 4-6GB
3. 等待稳定后部署 RAGFlow(会占用约 4-6GB
---
## 生产环境已配置
| 服务 | 地址 | 用途 |
|------|------|------|
| Dify 生产 | http://yw-dify.dc.servyou-it.com/ | AI 对话、工作流 |
| RAGFlow 生产 | http://10.80.0.85:8080/ | 知识库管理 |
---
## 本地配置后端连接
修改 `backend/.env.dev`
```bash
# Dify
DIFY_BASE_URL=http://localhost:8081
DIFY_API_KEY=your-api-key
# RAGFlow
RAGFLOW_BASE_URL=http://localhost:9380
RAGFLOW_API_KEY=your-api-key
```