mirror of
https://github.com/jxxghp/MoviePilot.git
synced 2026-09-05 23:47:41 +08:00
feat(agent): record task run history (#6305)
This commit is contained in:
@@ -164,11 +164,16 @@ class UpdateAgentTaskTool(MoviePilotTool):
|
||||
if payload.enabled and task.last_status != "interrupted":
|
||||
update_payload["last_status"] = "waiting"
|
||||
|
||||
oper.update(
|
||||
updated = oper.update(
|
||||
task_id=payload.task_id,
|
||||
payload=update_payload,
|
||||
user_id=str(self._user_id),
|
||||
)
|
||||
if not updated:
|
||||
current = oper.get(task_id=payload.task_id, user_id=str(self._user_id))
|
||||
if current and current.last_status == "running":
|
||||
return {"error": f"Agent 定时任务 {payload.task_id} 正在执行,请稍后再修改"}
|
||||
return None
|
||||
scheduler = Scheduler()
|
||||
next_run_at = scheduler.update_agent_task_job(payload.task_id)
|
||||
updated_task = oper.get(task_id=payload.task_id, user_id=str(self._user_id))
|
||||
|
||||
Reference in New Issue
Block a user