chore: 工作台产品化进行中的改动

把工作区里其余在制品一并入库,主要是工作台产品化的推进:

  后端:新增 capability_definition / project / my_app_center / office_skill
        接口与 action_definition / skill_definition / project / user_app_center
        模型,config 加路由健康上报。
  前端:新增 frontend/src/skills(Office 技能与 workbuddy 复刻)、
        项目管理、应用中心、能力目录页,以及配套 api / store / config;
        聊天侧新增 SpecialistChip / SpecialistPanel / SkillStrip / AppChatRail
        等组件。
  清理:移除旧 views/tools 下的单页工具(已并入工作台)、_frozen 冻结组件、
        cmd/inspect_oa_debug 调试入口,以及两份调试笔记。
  其它:文档与启动脚本同步。

(这批改动与上一提交的 SY23 工作并行进行,此前已在同一工作区内交织。)

Co-Authored-By: Claude Code <noreply@anthropic.com>
This commit is contained in:
eaiadmin
2026-09-17 21:32:35 +08:00
co-authored by Claude Code
parent 8b136d4a10
commit 16d63de4e1
180 changed files with 22283 additions and 13850 deletions
+56 -62
View File
@@ -1,9 +1,9 @@
# AR04 — 部署架构设计
> **版本:V1.1 | 部署模式:纯本地离线**
> **完整部署步骤请见 docs/deploy.md**
>
> **⚠️ 本文档为 V1.1 设计期历史快照(Docker + FastAPI 拓扑),不再反映当前实现。** 当前部署为 **Go 单二进制 + MySQL 8.0 + FAISS + systemd + Clonezilla 整盘克隆**,无 Docker、无 Python 运行时,以 `docs/deploy.md` 为准。
> **版本:V1.3 | 部署模式:纯本地离线 · Go 单二进制 + SQLite · systemd**
> **当前实现**:**Go 单二进制 + SQLite(eai_agentplatform.db) + 内网 Ollama(LLM/embedding) + systemd**,无 Docker、无 MySQL、无 FAISS、无 Python 运行时。
> **知识链路**:检索为 Go 原生实施(embed_gen 路由嵌入候选块 + 余弦召回,对齐 D07/D13);分类/入库已彻底迁移到 Go,Python 的 `knowledge_service` 已删除。
> **完整部署步骤请见 docs/deploy.md。**
---
@@ -27,19 +27,19 @@
┌──────────────┘ └──────────────┐
│ │
┌─────▼──────┐ ┌────────▼────────┐
│ FastAPI │ │ Vue 静态打包 │
│ :8000 │ │ nginx html/ │
│ │ └─────────────────┘
│ · JWT │
│ · 业务 │
│ eai_agentplatform-server │ Vue 静态打包 │
│ :8080 │ │ nginx html/ │
│ 单二进制 │ └─────────────────┘
│ · Gin + │
│ · SQLite │
└──┬──┬──┬──┘
│ │ │
┌───────────┘ │ └──────────────┐
│ │ │
┌──▼─────┐ ┌────▼───────┐ ┌──────▼──────────┐
│ MySQL │ │ data/media │ │ LibreOffice │
│ 8.0 │ │ 文件存储 │ │ 预览容器 │
│ :3306 │ │ │ │ :8100 │
│ SQLite │ │ data/kb_data│ │ LibreOffice │
│ 单文件 │ │ 文件存储 │ │ + pdftotext │
│ eai_platform.db │ │ │ (裸进程) │
└────────┘ └────────────┘ └─────────────────┘
│
│ (文档转换)
@@ -54,13 +54,15 @@
## 2. 服务清单
| 服务 | 端口 | 基础镜像/依赖 | 说明 |
|------|------|-------------|------|
| Nginx | 80/443 | nginx:alpine | HTTP 反代 + 前端静态资源 |
| FastAPI | 8000 | python:3.10 | 后端 API(uvicorn 启动) |
| MySQL | 3306 | mysql:8.0 | 数据库 |
| LibreOffice | 8100 | 自定义 Docker 镜像 | 文档转 PDF 预览 |
| LLM 服务 | 11434 | ollama/vllm | 内网 AI 推理 |
| 服务 | 端口/路径 | 运行方式 | 说明 |
|------|-----------|---------|------|
| Nginx | 80/443 | 系统包 | HTTP 反代 + 前端静态资源托管 |
| eai_agentplatform-server | 8080 | Go 单二进制(CGO_ENABLED=0,静态链接) | Gin + GORM 后端 API(内嵌 SQLite) |
| SQLite | data/eai_agentplatform.db | 内嵌 | 单文件关系数据(glebarez/sqlite 纯 Go 驱动,无需 CGO) |
| LibreOffice + pdftotext | 裸进程 | exec 调用 | 文档转 PDF/文本预览(非容器,不监听端口) |
| LLM 服务 | 11434 | 外置 | 内网 OpenAI 兼容接口(Ollama / vLLM / 网关) |
**核心特征**:无 Docker、无 Python 运行时、无 MySQL、无 FAISS。后端为 Go 单二进制,数据为 SQLite 单文件;知识检索为 Go 原生向量/关键词召回(align D07/D13)。
## 3. Nginx 关键配置
@@ -72,60 +74,51 @@ location / {
# API 反代 + SSE
location /api/ {
proxy_pass http://127.0.0.1:8000;
proxy_pass http://127.0.0.1:8080;
proxy_buffering off;
proxy_cache off;
proxy_read_timeout 300s;
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 Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
}
# 媒体文件预览(仅内部)
location /media/ {
alias /opt/eai_agentplatform/backend/data/media/;
internal;
# 媒体文件预览(Go 二进制直出)
location /api/media/ {
proxy_pass http://127.0.0.1:8080;
}
client_max_body_size 2048M;
```
## 4. docker-compose 服务拓扑
## 4. systemd 管理
```yaml
version: '3.8'
services:
mysql:
image: mysql:8.0
environment:
MYSQL_DATABASE: eai_agentplatform
MYSQL_USER: eai_agentplatform
MYSQL_PASSWORD: ${DB_PASSWORD}
volumes:
- mysql_data:/var/lib/mysql
```ini
[Unit]
Description=eai_agentplatform Server
After=network.target
backend:
build: ./backend
environment:
DATABASE_URL: mysql+pymysql://eai_agentplatform:${DB_PASSWORD}@mysql:3306/eai_agentplatform
JWT_SECRET: ${JWT_SECRET}
LLM_BASE_URL: http://llm-server:11434/v1
volumes:
- ./data/media:/app/data/media
depends_on:
- mysql
[Service]
Type=simple
User=eai_agentplatform
Group=eai_agentplatform
WorkingDirectory=/opt/eai_agentplatform
ExecStart=/opt/eai_agentplatform/eai_agentplatform-server
Restart=on-failure
RestartSec=5
EnvironmentFile=/opt/eai_agentplatform/.env
libreoffice:
image: libreoffice-preview:latest
volumes:
- ./data/media:/data/media
# 安全加固
ExecStartPre=/opt/eai_agentplatform/eai_agentplatform-server migrate
ProtectSystem=strict
ProtectHome=true
NoNewPrivileges=true
PrivateTmp=true
nginx:
image: nginx:alpine
ports:
- "80:80"
volumes:
- ./frontend/dist:/usr/share/nginx/html
- ./nginx.conf:/etc/nginx/conf.d/default.conf
depends_on:
- backend
[Install]
WantedBy=multi-user.target
```
## 5. 安全边界
@@ -135,6 +128,7 @@ services:
| 网络 | 仅监听内网,不暴露公网端口 |
| 认证 | JWT token 校验 + bcrypt 密码 |
| 鉴权 | 后端 API role 校验(非前端) |
| 文件 | 白名单扩展名 + UUID 命名 + 只读预览 |
| 数据库 | 独立用户 + 最小权限 |
| LLM | 仅内网地址,严禁公网 API |
| 文件 | 白名单扩展名 + UUID 命名 + proxy_pass 内部预览 |
| 数据库 | SQLite 单文件(系统级文件权限,systemd ProtectSystem=strict) |
| 备份 | 内建定期 VACUUM INTO,默认 24h 间隔,保留 7 份 |
| LLM | 仅内网地址,严禁公网 API |