docs(prediction): 说明 AI 预测服务配置

This commit is contained in:
2026-05-11 22:21:57 +08:00
parent 1a2ff19cf4
commit c936167fc8
3 changed files with 28 additions and 2 deletions
+11 -1
View File
@@ -33,6 +33,14 @@ Environment variable:
DATABASE_URL=mysql://user:password@host:3306/database
```
Optional AI prediction service:
```bash
SOH_PREDICTION_API_BASE_URL=http://127.0.0.1:8000
SOH_PREDICTION_CACHE_TTL_SECONDS=86400
SOH_PREDICTION_TIMEOUT_MS=10000
```
Customer table: `ls_battery_info`.
| Column | Type | Meaning |
@@ -56,6 +64,7 @@ Rules:
- `power_status` is normalized to `0 | 1 | 2`.
- Without `mac`, battery list queries return the latest record per `mac`.
- With `mac`, battery list queries return history ordered by `create_time DESC, id DESC`, limited to 500 rows.
- Dashboard may call the external prediction API when `SOH_PREDICTION_API_BASE_URL` is configured. Prediction results are cached in memory by `mac` and latest history record.
## Layout
@@ -67,7 +76,8 @@ src/
│ └── api/ # ORPC handlers
├── server/
│ ├── api/ # contracts / routers / interceptors
── battery/mysql.ts
── battery/mysql.ts
│ └── prediction/client.ts
├── domain/battery.ts
├── client/orpc.ts
└── styles.css