only output error

This commit is contained in:
t 2026-03-08 19:43:21 +08:00
parent 50e4a1e1c7
commit 73d40d2e15

View file

@ -285,20 +285,17 @@ func (t *CronTool) ExecuteJob(ctx context.Context, job *cron.CronJob) string {
} }
result := t.execTool.Execute(ctx, args) result := t.execTool.Execute(ctx, args)
var output string // Only notify on error, silent on success
if result.IsError { if result.IsError {
output = fmt.Sprintf("Error executing scheduled command: %s", result.ForLLM) output := fmt.Sprintf("Error executing scheduled command: %s", result.ForLLM)
} else { pubCtx, pubCancel := context.WithTimeout(context.Background(), 5*time.Second)
output = fmt.Sprintf("Scheduled command '%s' executed:\n%s", job.Payload.Command, result.ForLLM) defer pubCancel()
t.msgBus.PublishOutbound(pubCtx, bus.OutboundMessage{
Channel: channel,
ChatID: chatID,
Content: output,
})
} }
pubCtx, pubCancel := context.WithTimeout(context.Background(), 5*time.Second)
defer pubCancel()
t.msgBus.PublishOutbound(pubCtx, bus.OutboundMessage{
Channel: channel,
ChatID: chatID,
Content: output,
})
return "ok" return "ok"
} }