GPU_GUARD_MONOREPO/README.md
2026-05-21 09:08:59 +08:00

84 lines
2.3 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.

# GPU Guard - GPU 智能监控与防护平台
> 基于 Midway.js + Vue 3 + AI引擎 的智能 GPU 监控平台Monorepo 架构
## 技术架构
| 层级 | 技术选型 | 端口 |
|------|---------|------|
| **后端** | Midway.js 3.20 + TypeScript 5.9 + TypeORM + Cool Admin | 8003 |
| **前端** | Vue 3.5 + Vite 5.4 + Element Plus 2.9 + Pinia | 9001 |
| **AI 引擎** | AI Agent 引擎 (ReAct 循环 + TypeBox Schema + WebSocket) | - |
| **数据库** | MySQL 8.0+ | 3306 |
## 项目结构
```
Neta-monorepo/
├── packages/
│ ├── backend/ # Midway.js 后端 (Cool Admin 框架)
│ ├── frontend/ # Vue 3 前端 (Cool Admin UI)
│ └── shared/ # 共享 TypeScript 类型
├── docs/ # 设计文档与实施计划
├── pnpm-workspace.yaml
└── package.json
```
## 快速开始
### 环境要求
- **Node.js**: >= 24.0.0
- **pnpm**: >= 8.0.0
- **MySQL**: >= 8.0.0
### 安装与启动
```bash
pnpm install
# 同时启动后端 + 前端
pnpm dev
# 单独启动
pnpm dev:backend # 后端 http://localhost:8003
pnpm dev:frontend # 前端 http://localhost:9001
```
## 核心模块
### 后端模块
| 模块 | 路径 | 用途 |
|------|------|------|
| **base** | `modules/base/` | 用户、角色、菜单、权限 (RBAC) |
| **netaclaw** | `modules/netaclaw/` | AI Agent 引擎 (ReAct + WebSocket) |
| **dict** | `modules/dict/` | 字典管理 |
| **task** | `modules/task/` | 定时任务 |
| **space** | `modules/space/` | 文件空间 |
| **user** | `modules/user/` | 应用用户 |
### 前端模块
| 模块 | 路由前缀 | 用途 |
|------|---------|------|
| **agent** | `/agent/*` | 智能体对话、技能管理、模型渠道管理 |
| **base** | `/` | 登录、用户、角色、菜单、部门 |
## 数据库
后端配置位于 `packages/backend/src/config/`
- 开发环境: `config.local.ts`
- 生产环境: `config.prod.ts`
数据库名: `cpu_guard`TypeORM 开发环境自动建表 (`synchronize: true`)。
## 开发规范
- **后端文件名**: 下划线法 (`model_channel.ts`)
- **Entity 字段**: 驼峰法 (`modelConfig`)
- **注释**: 中文
- **Entity**: 继承 BaseEntity不使用外键
- **Controller**: 使用 `@CoolController` 自动生成 CRUD
- **包管理器**: 必须使用 pnpm