fix(controller): "agent task already running" (#1516)

* fix agent task already running bug

* attemp to fix "Current task state not recognized"

* Revert "attemp to fix "Current task state not recognized""

This reverts commit f5cbfe1ebb.

---------

Co-authored-by: Leo <ifuryst@gmail.com>
This commit is contained in:
Xingyao Wang
2024-05-02 23:33:51 +08:00
committed by GitHub
parent 24750ba04f
commit 1e50d58982

View File

@@ -184,7 +184,8 @@ class AgentUnit:
await self.send_error('No agent started. Please wait a second...')
return
try:
assert not self.agent_task, 'Agent task already running'
if self.agent_task:
self.agent_task.cancel()
self.agent_task = asyncio.create_task(
self.controller.start(task), name='agent start task loop'
)