Revamp documentation structure in mkdocs.yml by reorganizing navigation for improved accessibility. Remove outdated content from previous sections and introduce new topics including detailed guides on assistant management, configuration options, and tool integrations. Enhance API reference documentation with comprehensive error codes and WebSocket protocol details. Add new sections for automated testing, data analysis, and knowledge base management, ensuring a cohesive and user-friendly documentation experience.

This commit is contained in:
Xin Wang
2026-03-01 22:38:50 +08:00
parent 6a46ec69f4
commit 2418df80e5
33 changed files with 3664 additions and 693 deletions

View File

@@ -0,0 +1,161 @@
# Docker 部署
Docker 是推荐的部署方式,可以快速启动服务并确保环境一致性。
## 前提条件
- Docker 20.10+
- Docker Compose 2.0+(可选)
## 构建镜像
### Web 前端
```bash
docker build -t ai-video-assistant-web ./web
```
### API 服务
```bash
docker build -t ai-video-assistant-api ./api
```
### Engine 服务
```bash
docker build -t ai-video-assistant-engine ./engine
```
## 运行容器
### 单独运行
```bash
# Web 前端
docker run -d \
--name ai-assistant-web \
-p 3000:80 \
ai-video-assistant-web
# API 服务
docker run -d \
--name ai-assistant-api \
-p 8080:8080 \
ai-video-assistant-api
# Engine 服务
docker run -d \
--name ai-assistant-engine \
-p 8000:8000 \
ai-video-assistant-engine
```
## Docker Compose
推荐使用 Docker Compose 管理多个服务:
```yaml
version: '3.8'
services:
web:
build: ./web
ports:
- "3000:80"
environment:
- VITE_API_URL=http://api:8080
depends_on:
- api
api:
build: ./api
ports:
- "8080:8080"
environment:
- DATABASE_URL=postgresql://postgres:password@db:5432/ai_assistant
depends_on:
- db
engine:
build: ./engine
ports:
- "8000:8000"
environment:
- BACKEND_URL=http://api:8080
db:
image: postgres:15
environment:
- POSTGRES_DB=ai_assistant
- POSTGRES_PASSWORD=password
volumes:
- postgres_data:/var/lib/postgresql/data
volumes:
postgres_data:
```
### 启动服务
```bash
# 启动所有服务
docker-compose up -d
# 查看日志
docker-compose logs -f
# 停止服务
docker-compose down
```
## 镜像优化
### 多阶段构建
Web 前端 Dockerfile 示例:
```dockerfile
# 构建阶段
FROM node:18-alpine AS builder
WORKDIR /app
COPY package*.json ./
RUN npm ci
COPY . .
RUN npm run build
# 运行阶段
FROM nginx:alpine
COPY --from=builder /app/dist /usr/share/nginx/html
COPY nginx.conf /etc/nginx/nginx.conf
EXPOSE 80
CMD ["nginx", "-g", "daemon off;"]
```
## 健康检查
```yaml
services:
api:
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:8080/health"]
interval: 30s
timeout: 10s
retries: 3
```
## 常见问题
### 容器启动失败
```bash
# 查看容器日志
docker logs ai-assistant-web
# 进入容器调试
docker exec -it ai-assistant-web sh
```
### 端口冲突
修改 `docker-compose.yml` 中的端口映射,例如 `3001:80`