feat: task cancellation (wip)
This commit is contained in:
1 parent
25b5fbd22a
commit
77addb889d
10 files changed
+319
-60
No files matched your search
+8
-1
@@ -36,7 +36,6 @@ class App(ChatMixin):
|
||||
|
||||
self.replicate_client = replicate_token and replicate.Client(api_token=replicate_token) or None
|
||||
self.openrouter_client = openrouter_token and OpenRouter(api_key=openrouter_token) or None
|
||||
|
||||
|
||||
self.agent_classes = [
|
||||
agents_mod.ExpertAgent,
|
||||
@@ -332,6 +331,14 @@ class App(ChatMixin):
|
||||
)
|
||||
return run.id
|
||||
|
||||
async def cancel_agent_run(self, run_id):
|
||||
"""Cancel an ongoing agent run by ID."""
|
||||
run = self.tmp.runs.get(run_id)
|
||||
if run:
|
||||
run.cancel()
|
||||
return True
|
||||
return False
|
||||
|
||||
async def get_agent_runs(self, agent_id=None, user_id=None):
|
||||
runs = list(self.tmp.runs.values())
|
||||
if agent_id:
|
||||
|
||||
Reference in new issue
Block a user