fix: resolve cron task creation and execution failures

This commit is contained in:
Zhang Rui 2026-04-14 19:42:33 +08:00
parent 08fc305d5e
commit c8ac5e5ecc

View file

@ -8,7 +8,6 @@ import (
"github.com/sipeed/picoclaw/pkg/bus"
"github.com/sipeed/picoclaw/pkg/config"
"github.com/sipeed/picoclaw/pkg/constants"
"github.com/sipeed/picoclaw/pkg/cron"
"github.com/sipeed/picoclaw/pkg/utils"
)
@ -199,9 +198,6 @@ func (t *CronTool) addJob(ctx context.Context, args map[string]any) *ToolResult
if !t.execEnabled {
return ErrorResult("command execution is disabled")
}
if !constants.IsInternalChannel(channel) {
return ErrorResult("scheduling command execution is restricted to internal channels")
}
if !t.allowCommand && !commandConfirm {
return ErrorResult("command_confirm=true is required when allow_command is disabled")
}
@ -318,6 +314,7 @@ func (t *CronTool) ExecuteJob(ctx context.Context, job *cron.CronJob) string {
}
args := map[string]any{
"action": "run",
"command": job.Payload.Command,
"__channel": channel,
"__chat_id": chatID,