(self, **kwargs)
| 205 | return Response(message=json.dumps(serialize_task(task), indent=4), break_loop=False) |
| 206 | |
| 207 | async def run_task(self, **kwargs) -> Response: |
| 208 | task_uuid: str = kwargs.get("uuid", "") |
| 209 | if not task_uuid: |
| 210 | return Response(message="Task UUID is required", break_loop=False) |
| 211 | task_context: str | None = kwargs.get("context", None) |
| 212 | task: ScheduledTask | AdHocTask | PlannedTask | None = TaskScheduler.get().get_task_by_uuid(task_uuid) |
| 213 | if not task: |
| 214 | return Response(message=f"Task not found: {task_uuid}", break_loop=False) |
| 215 | await TaskScheduler.get().run_task_by_uuid(task_uuid, task_context) |
| 216 | if task.context_id == self.agent.context.id: |
| 217 | break_loop = True # break loop if task is running in the same context, otherwise it would start two conversations in one window |
| 218 | else: |
| 219 | break_loop = False |
| 220 | return Response(message=f"Task started: {task_uuid}", break_loop=break_loop) |
| 221 | |
| 222 | async def delete_task(self, **kwargs) -> Response: |
| 223 | task_uuid: str = kwargs.get("uuid", "") |
no test coverage detected