only output error
This commit is contained in:
parent
50e4a1e1c7
commit
73d40d2e15
1 changed files with 9 additions and 12 deletions
|
|
@ -285,13 +285,9 @@ 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 {
|
|
||||||
output = fmt.Sprintf("Scheduled command '%s' executed:\n%s", job.Payload.Command, result.ForLLM)
|
|
||||||
}
|
|
||||||
|
|
||||||
pubCtx, pubCancel := context.WithTimeout(context.Background(), 5*time.Second)
|
pubCtx, pubCancel := context.WithTimeout(context.Background(), 5*time.Second)
|
||||||
defer pubCancel()
|
defer pubCancel()
|
||||||
t.msgBus.PublishOutbound(pubCtx, bus.OutboundMessage{
|
t.msgBus.PublishOutbound(pubCtx, bus.OutboundMessage{
|
||||||
|
|
@ -299,6 +295,7 @@ func (t *CronTool) ExecuteJob(ctx context.Context, job *cron.CronJob) string {
|
||||||
ChatID: chatID,
|
ChatID: chatID,
|
||||||
Content: output,
|
Content: output,
|
||||||
})
|
})
|
||||||
|
}
|
||||||
return "ok"
|
return "ok"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue