@@ -313,10 +313,13 @@ Cron 表达式格式:
313313 } ) ;
314314 const channelLabel = channelLabels . join ( '+' ) ;
315315 const jobName = `GitHub 热榜 ${ periodLabel } ${ channelLabel } ` ;
316-
317- // 修复:使用自然语言格式而不是 JSON 格式,这样 Agent 可以正确理解和调用工具
318- const channelsParam = channelList . join ( ',' ) ;
319- const systemEventText = `请获取 GitHub ${ sinceLower === 'daily' ? '今日' : sinceLower === 'weekly' ? '本周' : '本月' } 热榜项目,使用 openclaw-github-trending 工具,参数 since=${ sinceLower } , channels=[${ channelsParam } ],推送到${ channelList . map ( c => c === 'feishu' ? '飞书' : '邮箱' ) . join ( '和' ) } ` ;
316+
317+ // 修复:使用简洁的自然语言,避免特殊字符和过长文本
318+ const sinceText = sinceLower === 'daily' ? '今日' : sinceLower === 'weekly' ? '本周' : '本月' ;
319+ const channelText = channelLabels . join ( ',' ) ;
320+
321+ // 简洁格式:使用 openclaw-github-trending 工具,获取本月热榜,推送到飞书,邮箱
322+ const systemEventText = `使用 openclaw-github-trending 工具,获取${ sinceText } 热榜,推送到${ channelText } ` ;
320323
321324 // 修复:使用 spawn 而不是 exec,避免缓冲区限制,支持低内存服务器
322325 const cp = await import ( 'child_process' ) ;
@@ -334,7 +337,7 @@ Cron 表达式格式:
334337 '--system-event' , systemEventText
335338 ] , {
336339 stdio : [ 'ignore' , 'pipe' , 'pipe' ] ,
337- timeout : 30000 // 30 秒超时
340+ timeout : 120000 // 120 秒超时
338341 } ) ;
339342
340343 let stdout = '' ;
@@ -390,11 +393,8 @@ Cron 表达式格式:
390393 // 备用方案:直接调用 Gateway API
391394 const execFile = cp . execFile ;
392395
393- // 简化命令,减少参数长度
394- const simpleEvent = `GitHub 热榜 ${ sinceLower } ${ channelList . join ( ',' ) } ` ;
395-
396396 const result = await new Promise < string > ( ( resolve , reject ) => {
397- execFile ( 'openclaw' , [ 'cron' , 'add' , '--name' , jobName , '--cron' , schedule ! , '--system-event' , simpleEvent ] , {
397+ execFile ( 'openclaw' , [ 'cron' , 'add' , '--name' , jobName , '--cron' , schedule ! , '--system-event' , systemEventText ] , {
398398 timeout : 15000 as any ,
399399 maxBuffer : 5 * 1024 * 1024 as any
400400 } , ( error : any , stdout : string , stderr : string ) => {
0 commit comments