101 lines
2.0 KiB
Markdown
101 lines
2.0 KiB
Markdown
# 森林AI
|
||
|
||
森林AI 是一个以项目为中心的私有化工作台 MVP。
|
||
|
||
## 本地开发
|
||
|
||
启动本地 PostgreSQL:
|
||
|
||
```powershell
|
||
docker compose -f infra/docker-compose.yml up -d
|
||
```
|
||
|
||
启动后端 API:
|
||
|
||
```powershell
|
||
Set-Location backend
|
||
go run ./cmd/api
|
||
```
|
||
|
||
启动 Web 客户端:
|
||
|
||
```powershell
|
||
Set-Location apps/web_v1
|
||
npm run dev
|
||
```
|
||
|
||
## 后端配置
|
||
|
||
后端配置不再从多个环境变量直接读取,而是从 `backend/etc/agent.<mode>.yaml` 读取。
|
||
|
||
配置模式由环境变量 `SENLIN_APP_MODE` 决定:
|
||
|
||
- 未设置 `SENLIN_APP_MODE` 时,默认读取 `backend/etc/agent.dev.yaml`。
|
||
- 设置 `SENLIN_APP_MODE=prod` 时,读取 `backend/etc/agent.prod.yaml`。
|
||
- 设置其他值时,按同样规则读取 `backend/etc/agent.<value>.yaml`。
|
||
|
||
默认开发配置文件:
|
||
|
||
```text
|
||
backend/etc/agent.dev.yaml
|
||
```
|
||
|
||
配置字段:
|
||
|
||
- `env`: 运行环境,例如 `development`。
|
||
- `port`: API 监听端口,默认开发值为 `8080`。
|
||
- `dsn`: PostgreSQL 连接串。不要提交真实生产或测试凭据。
|
||
- `storage_dir`: 服务端本地文件存储目录。
|
||
- `auth_secret`: 邀请 token 和 session token 的 HMAC 密钥。
|
||
- `system_ai_key`: 可选的系统级 AI provider fallback key。
|
||
- `ai_key_encryption_secret`: 用户 AI key 静态加密密钥。
|
||
|
||
## 前端
|
||
|
||
Web 客户端使用 React、TypeScript、Vite 和 Arco Design。登录界面允许用户输入服务器 IP 地址或域名,并将其保存为 API base URL。
|
||
|
||
## 桌面端
|
||
|
||
桌面端使用 Tauri 包装 Web 客户端。
|
||
|
||
构建桌面可执行文件:
|
||
|
||
```powershell
|
||
Set-Location apps/desktop
|
||
npm run build
|
||
```
|
||
|
||
生成安装包:
|
||
|
||
```powershell
|
||
Set-Location apps/desktop
|
||
npm run bundle
|
||
```
|
||
|
||
## 验证
|
||
|
||
后端:
|
||
|
||
```powershell
|
||
Set-Location backend
|
||
go test ./... -v
|
||
```
|
||
|
||
Web:
|
||
|
||
```powershell
|
||
Set-Location apps/web_v1
|
||
node scripts/visual-check.mjs
|
||
npm run build
|
||
npm run lint
|
||
```
|
||
|
||
桌面端:
|
||
|
||
```powershell
|
||
Set-Location apps/desktop
|
||
npm run build
|
||
```
|
||
|
||
更多验证说明见 `docs/mvp-verification.md`。
|