docs: add ai prereq handling

This commit is contained in:
2026-01-26 12:25:40 +08:00
parent 8b44767f11
commit 54f55a072e
2 changed files with 29 additions and 35 deletions

View File

@@ -14,6 +14,18 @@
- Use MCP to connect at `http://10.1.1.104:9222` (SSH forwarded DevTools port).
- Open target URLs via MCP and run page-level assertions (no API-level calls required).
## AI Auto-Handling Prereqs
- **Seed 检查/执行**
- DB 查询(示例):`SELECT COUNT(*) FROM tenants;`
- 若结果为 0执行 `go run ./backend/main.go seed` 后再继续。
- **tenantCode 获取**
- DB 查询:`SELECT code FROM tenants ORDER BY id DESC LIMIT 1;`
- 将结果注入到 Portal URL `/t/:tenantCode`
- **清理浏览器存储**
- 在 MCP 中执行脚本:清理 `localStorage` / `sessionStorage`,并清除 cookies。
- 示例:`chrome-devtools_evaluate_script``() => { localStorage.clear(); sessionStorage.clear(); document.cookie.split(';').forEach(c => document.cookie = c.replace(/^ +/, '').replace(/=.*/, '=;expires=' + new Date().toUTCString() + ';path=/')); }`
### MCP Example Flow (AI Guidance)
1. **Open Portal Home**