Commit c5693e360301d5d9e081d7fc2328b957bd63980a
1 parent
b794ae6e
fix(company): 修复前端心跳配置为 undefined 时后端的异常打印
Showing
6 changed files
with
37 additions
and
8 deletions
data/lemonv/agents/ceo/config.json
data/lemonv/agents/coo/config.json
data/lemonv/agents/cto/config.json
data/lemonv/agents/trend-hunter/config.json
| ... | ... | @@ -11,8 +11,18 @@ |
| 11 | 11 | "cli": { |
| 12 | 12 | "toolPolicy": { |
| 13 | 13 | "mode": "restricted", |
| 14 | - "allowedTools": ["WebFetch", "WebSearch", "Read", "Write", "Bash", "CronCreate"], | |
| 15 | - "forbiddenTools": ["Agent", "Edit"] | |
| 14 | + "allowedTools": [ | |
| 15 | + "WebFetch", | |
| 16 | + "WebSearch", | |
| 17 | + "Read", | |
| 18 | + "Write", | |
| 19 | + "Bash", | |
| 20 | + "CronCreate" | |
| 21 | + ], | |
| 22 | + "forbiddenTools": [ | |
| 23 | + "Agent", | |
| 24 | + "Edit" | |
| 25 | + ] | |
| 16 | 26 | } |
| 17 | 27 | }, |
| 18 | 28 | "gateway": { |
| ... | ... | @@ -28,5 +38,9 @@ |
| 28 | 38 | "maxMemoryMB": 512, |
| 29 | 39 | "maxDiskMB": 1024, |
| 30 | 40 | "maxProcesses": 5 |
| 41 | + }, | |
| 42 | + "heartbeat": { | |
| 43 | + "intervalMinutes": 5, | |
| 44 | + "enabled": true | |
| 31 | 45 | } |
| 32 | 46 | } |
| 33 | 47 | \ No newline at end of file | ... | ... |
data/lemonv/company.json
| ... | ... | @@ -2,9 +2,9 @@ |
| 2 | 2 | "id": "lemonv", |
| 3 | 3 | "name": "LemonV.cc", |
| 4 | 4 | "description": "AI 互动玩具创新公司,通过 AI 技术创造具有情感交互能力的智能玩具,结合热点内容与经典 IP 打造沉浸式互动体验", |
| 5 | - "status": "creating", | |
| 5 | + "status": "running", | |
| 6 | 6 | "createdAt": "2026-03-26T05:15:00.000Z", |
| 7 | - "updatedAt": "2026-03-26T05:15:00.000Z", | |
| 7 | + "updatedAt": "2026-03-26T08:25:39.676Z", | |
| 8 | 8 | "createdBy": "master", |
| 9 | 9 | "ceo": null, |
| 10 | 10 | "sop": null, |
| ... | ... | @@ -24,5 +24,6 @@ |
| 24 | 24 | "运营与反馈:内容发布后根据数据反馈迭代优化" |
| 25 | 25 | ] |
| 26 | 26 | } |
| 27 | - } | |
| 28 | -} | |
| 27 | + }, | |
| 28 | + "startedAt": "2026-03-26T08:25:39.676Z" | |
| 29 | +} | |
| 29 | 30 | \ No newline at end of file | ... | ... |
server/routes/company.js
| ... | ... | @@ -194,7 +194,12 @@ router.put('/:companyId/agents/:agentId/heartbeat', (req, res) => { |
| 194 | 194 | } |
| 195 | 195 | |
| 196 | 196 | const config = JSON.parse(fs.readFileSync(configPath, 'utf-8')); |
| 197 | - if (!config.heartbeat) config.heartbeat = {}; | |
| 197 | + if (!config.heartbeat) config.heartbeat = { intervalMinutes: 15, enabled: false }; | |
| 198 | + | |
| 199 | + // 保证有合理的默认值 | |
| 200 | + if (config.heartbeat.intervalMinutes === undefined) config.heartbeat.intervalMinutes = 15; | |
| 201 | + if (config.heartbeat.enabled === undefined) config.heartbeat.enabled = false; | |
| 202 | + | |
| 198 | 203 | if (intervalMinutes !== undefined) config.heartbeat.intervalMinutes = Number(intervalMinutes); |
| 199 | 204 | if (enabled !== undefined) config.heartbeat.enabled = Boolean(enabled); |
| 200 | 205 | fs.writeFileSync(configPath, JSON.stringify(config, null, 2), 'utf-8'); | ... | ... |