From 73d40d2e15d297d89121e0af07510a7566e494a4 Mon Sep 17 00:00:00 2001 From: t <452214834@qq.com> Date: Sun, 8 Mar 2026 19:43:21 +0800 Subject: [PATCH] only output error --- pkg/tools/cron.go | 21 +++++++++------------ 1 file changed, 9 insertions(+), 12 deletions(-) diff --git a/pkg/tools/cron.go b/pkg/tools/cron.go index 6af0aa9e1..c27ea55ac 100644 --- a/pkg/tools/cron.go +++ b/pkg/tools/cron.go @@ -285,20 +285,17 @@ func (t *CronTool) ExecuteJob(ctx context.Context, job *cron.CronJob) string { } result := t.execTool.Execute(ctx, args) - var output string + // Only notify on error, silent on success if result.IsError { - output = fmt.Sprintf("Error executing scheduled command: %s", result.ForLLM) - } else { - output = fmt.Sprintf("Scheduled command '%s' executed:\n%s", job.Payload.Command, result.ForLLM) + output := fmt.Sprintf("Error executing scheduled command: %s", result.ForLLM) + pubCtx, pubCancel := context.WithTimeout(context.Background(), 5*time.Second) + 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" }