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
| @@ -23,5 +23,9 @@ | @@ -23,5 +23,9 @@ | ||
| 23 | "maxMemoryMB": 512, | 23 | "maxMemoryMB": 512, |
| 24 | "maxDiskMB": 1024, | 24 | "maxDiskMB": 1024, |
| 25 | "maxProcesses": 5 | 25 | "maxProcesses": 5 |
| 26 | + }, | ||
| 27 | + "heartbeat": { | ||
| 28 | + "intervalMinutes": 5, | ||
| 29 | + "enabled": true | ||
| 26 | } | 30 | } |
| 27 | } | 31 | } |
| 28 | \ No newline at end of file | 32 | \ No newline at end of file |
data/lemonv/agents/cto/config.json
| @@ -23,5 +23,9 @@ | @@ -23,5 +23,9 @@ | ||
| 23 | "maxMemoryMB": 512, | 23 | "maxMemoryMB": 512, |
| 24 | "maxDiskMB": 1024, | 24 | "maxDiskMB": 1024, |
| 25 | "maxProcesses": 5 | 25 | "maxProcesses": 5 |
| 26 | + }, | ||
| 27 | + "heartbeat": { | ||
| 28 | + "intervalMinutes": 5, | ||
| 29 | + "enabled": true | ||
| 26 | } | 30 | } |
| 27 | } | 31 | } |
| 28 | \ No newline at end of file | 32 | \ No newline at end of file |
data/lemonv/agents/trend-hunter/config.json
| @@ -11,8 +11,18 @@ | @@ -11,8 +11,18 @@ | ||
| 11 | "cli": { | 11 | "cli": { |
| 12 | "toolPolicy": { | 12 | "toolPolicy": { |
| 13 | "mode": "restricted", | 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 | "gateway": { | 28 | "gateway": { |
| @@ -28,5 +38,9 @@ | @@ -28,5 +38,9 @@ | ||
| 28 | "maxMemoryMB": 512, | 38 | "maxMemoryMB": 512, |
| 29 | "maxDiskMB": 1024, | 39 | "maxDiskMB": 1024, |
| 30 | "maxProcesses": 5 | 40 | "maxProcesses": 5 |
| 41 | + }, | ||
| 42 | + "heartbeat": { | ||
| 43 | + "intervalMinutes": 5, | ||
| 44 | + "enabled": true | ||
| 31 | } | 45 | } |
| 32 | } | 46 | } |
| 33 | \ No newline at end of file | 47 | \ No newline at end of file |
data/lemonv/company.json
| @@ -2,9 +2,9 @@ | @@ -2,9 +2,9 @@ | ||
| 2 | "id": "lemonv", | 2 | "id": "lemonv", |
| 3 | "name": "LemonV.cc", | 3 | "name": "LemonV.cc", |
| 4 | "description": "AI 互动玩具创新公司,通过 AI 技术创造具有情感交互能力的智能玩具,结合热点内容与经典 IP 打造沉浸式互动体验", | 4 | "description": "AI 互动玩具创新公司,通过 AI 技术创造具有情感交互能力的智能玩具,结合热点内容与经典 IP 打造沉浸式互动体验", |
| 5 | - "status": "creating", | 5 | + "status": "running", |
| 6 | "createdAt": "2026-03-26T05:15:00.000Z", | 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 | "createdBy": "master", | 8 | "createdBy": "master", |
| 9 | "ceo": null, | 9 | "ceo": null, |
| 10 | "sop": null, | 10 | "sop": null, |
| @@ -24,5 +24,6 @@ | @@ -24,5 +24,6 @@ | ||
| 24 | "运营与反馈:内容发布后根据数据反馈迭代优化" | 24 | "运营与反馈:内容发布后根据数据反馈迭代优化" |
| 25 | ] | 25 | ] |
| 26 | } | 26 | } |
| 27 | - } | ||
| 28 | -} | 27 | + }, |
| 28 | + "startedAt": "2026-03-26T08:25:39.676Z" | ||
| 29 | +} | ||
| 29 | \ No newline at end of file | 30 | \ No newline at end of file |
server/routes/company.js
| @@ -194,7 +194,12 @@ router.put('/:companyId/agents/:agentId/heartbeat', (req, res) => { | @@ -194,7 +194,12 @@ router.put('/:companyId/agents/:agentId/heartbeat', (req, res) => { | ||
| 194 | } | 194 | } |
| 195 | 195 | ||
| 196 | const config = JSON.parse(fs.readFileSync(configPath, 'utf-8')); | 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 | if (intervalMinutes !== undefined) config.heartbeat.intervalMinutes = Number(intervalMinutes); | 203 | if (intervalMinutes !== undefined) config.heartbeat.intervalMinutes = Number(intervalMinutes); |
| 199 | if (enabled !== undefined) config.heartbeat.enabled = Boolean(enabled); | 204 | if (enabled !== undefined) config.heartbeat.enabled = Boolean(enabled); |
| 200 | fs.writeFileSync(configPath, JSON.stringify(config, null, 2), 'utf-8'); | 205 | fs.writeFileSync(configPath, JSON.stringify(config, null, 2), 'utf-8'); |