chore: initial commit of ai site platform

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
whm
2026-07-31 10:19:22 +08:00
commit 6366859bb3
222 changed files with 47313 additions and 0 deletions

85
README.md Normal file
View File

@@ -0,0 +1,85 @@
# 宇信达智建
## 要不要上 K8s
**现阶段不需要。** Docker Compose 已覆盖单机/小团队全栈;等出现多机部署、弹性扩缩容、灰度发布、服务网格等需求再上 Kubernetes。
## 推荐拓扑(默认 Docker
```text
浏览器
→ web :5173 (nginx)
→ gateway :8180
→ platform :8888
→ ai :8001
→ postgres :5432
```
数据挂载到仓库物理目录 `.runtime/`(不是仅存在容器层)。
## 一键启动
先启动 **Docker Desktop**Windows或确保 `docker compose` 可用。
### Windows
```powershell
.\start.ps1 # 默认 Compose 全栈
.\start.ps1 -Rebuild
.\stop.ps1
.\restart.ps1 # 先停再启
```
也可双击 `start.bat` / `restart.bat`
### Linux
```bash
chmod +x start.sh stop.sh restart.sh scripts/linux/*.sh
./start.sh # 默认 Compose
./start.sh --rebuild
./stop.sh
./restart.sh # 先停再启
```
无 Docker 时脚本会**自动回退**宿主机模式(`--host` 可强制)。
| 物理路径 | 内容 |
|----------|------|
| `.runtime/pgdata` | Postgres 数据 |
| `.runtime/uploads` | 对象存储 |
| `.runtime/logs` | (宿主机模式日志) |
打开 http://127.0.0.1:5173
演示账号:`demo` / `demo123`
等价手动命令:
```bash
docker compose up -d --build
docker compose down # 保留 .runtime
```
## 能力清单
| 能力 | 说明 |
|------|------|
| RBAC | JWT 含 `role`owner/editor/viewer |
| 对象存储 | 上传落 `.runtime/uploads` |
| 发布审计 | `GET /api/v1/audit/logs` |
| database_per_app | 独立库compose 内 platform 用户已具备建库权限 |
| 网关鉴权 | JWT 预检 + 中台二次校验 |
| 多模态 | 截图理解(可设 `OPENAI_API_KEY` |
## 自动化测试
```powershell
python scripts/e2e_flow.py
```
## 网关路由
| 路径 | 上游 |
|------|------|
| `/api/v1/*` | platform |
| `/ai/*` | AI |
| `/gateway/health` | 健康检查 |
可选 APISIX 仍见 `gateway/README.md``:9080`),日常用 Compose 里的 Go 网关即可。