[AC-AISVC-50] 合入第一个稳定版本 #2

Merged
MerCry merged 32 commits from feature/prompt-unification-and-logging into main 2026-02-26 13:03:31 +00:00
3 changed files with 91 additions and 3 deletions
Showing only changes of commit b6218dec1a - Show all commits

View File

@ -99,12 +99,14 @@ docker compose logs -f ai-service
| 服务 | 地址 | 说明 |
|------|------|------|
| 前端管理界面 | http://服务器IP:3000 | Vue 管理后台 |
| 前端管理界面 | http://服务器IP:8181 | Vue 管理后台 |
| 后端 API | http://服务器IP:8080 | FastAPI 服务 |
| API 文档 | http://服务器IP:8080/docs | Swagger UI |
| Qdrant 控制台 | http://服务器IP:6333/dashboard | 向量数据库管理 |
| Ollama API | http://服务器IP:11434 | 嵌入模型服务 |
> **注意**: 如果宿主机 8080 端口已被占用,可以只通过前端管理界面 (8181) 访问,前端会自动代理后端 API 请求。
## 服务架构
```
@ -114,7 +116,7 @@ docker compose logs -f ai-service
┌─────────────────────────────────────────────────────────┐
│ ai-service-admin (端口3000) │
│ ai-service-admin (端口8181) │
│ - Nginx 静态文件服务 │
│ - 反向代理 /api/* → ai-service:8080 │
└─────────────────────────────────────────────────────────┘
@ -161,6 +163,24 @@ docker compose down
docker compose down -v
```
## 宿主机 Nginx 配置(可选)
如果需要通过宿主机 Nginx 统一管理入口配置域名、SSL证书可参考 `deploy/nginx.conf.example`
```bash
# 复制配置文件
sudo cp deploy/nginx.conf.example /etc/nginx/conf.d/ai-service.conf
# 修改配置中的域名
sudo vim /etc/nginx/conf.d/ai-service.conf
# 测试配置
sudo nginx -t
# 重载 Nginx
sudo nginx -s reload
```
## 本地开发
### 后端开发

68
deploy/nginx.conf.example Normal file
View File

@ -0,0 +1,68 @@
# AI Service Nginx Configuration
# 将此文件放置于 /etc/nginx/conf.d/ai-service.conf
# 或 include 到主配置文件中
upstream ai_service_admin {
server 127.0.0.1:8181;
}
server {
listen 80;
server_name your-domain.com; # 替换为你的域名或服务器IP
# 访问日志
access_log /var/log/nginx/ai-service.access.log;
error_log /var/log/nginx/ai-service.error.log;
location / {
proxy_pass http://ai_service_admin;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection 'upgrade';
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_cache_bypass $http_upgrade;
# SSE 流式响应支持
proxy_read_timeout 300s;
proxy_connect_timeout 75s;
proxy_buffering off;
}
}
# HTTPS 配置示例 (使用 Let's Encrypt)
# server {
# listen 443 ssl http2;
# server_name your-domain.com;
#
# ssl_certificate /etc/letsencrypt/live/your-domain.com/fullchain.pem;
# ssl_certificate_key /etc/letsencrypt/live/your-domain.com/privkey.pem;
#
# ssl_protocols TLSv1.2 TLSv1.3;
# ssl_ciphers ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256;
# ssl_prefer_server_ciphers off;
#
# location / {
# proxy_pass http://ai_service_admin;
# proxy_http_version 1.1;
# proxy_set_header Upgrade $http_upgrade;
# proxy_set_header Connection 'upgrade';
# proxy_set_header Host $host;
# proxy_set_header X-Real-IP $remote_addr;
# proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
# proxy_set_header X-Forwarded-Proto $scheme;
# proxy_cache_bypass $http_upgrade;
# proxy_read_timeout 300s;
# proxy_connect_timeout 75s;
# proxy_buffering off;
# }
# }
# HTTP 重定向到 HTTPS
# server {
# listen 80;
# server_name your-domain.com;
# return 301 https://$server_name$request_uri;
# }

View File

@ -40,7 +40,7 @@ services:
container_name: ai-service-admin
restart: unless-stopped
ports:
- "3000:80"
- "8181:80"
depends_on:
- ai-service
networks: