MCPcopy
hub / github.com/agent0ai/agent-zero / process

Method process

api/chat_reset.py:9–27  ·  view source on GitHub ↗
(self, input: Input, request: Request)

Source from the content-addressed store, hash-verified

7
8class Reset(ApiHandler):
9 async def process(self, input: Input, request: Request) -> Output:
10 ctxid = input.get("context", "")
11
12 # attempt to stop any scheduler tasks bound to this context
13 TaskScheduler.get().cancel_tasks_by_context(ctxid, terminate_thread=True)
14
15 # context instance - get or create
16 context = self.use_context(ctxid)
17 context.reset()
18 persist_chat.save_tmp_chat(context)
19 persist_chat.remove_msg_files(ctxid)
20
21 # Reset updates context metadata (log guid/version) and must refresh other tabs' lists.
22 from helpers.state_monitor_integration import mark_dirty_all
23 mark_dirty_all(reason="api.chat_reset.Reset")
24
25 return {
26 "message": "Agent restarted.",
27 }

Callers 1

processMethod · 0.95

Calls 5

mark_dirty_allFunction · 0.90
getMethod · 0.45
use_contextMethod · 0.45
resetMethod · 0.45

Tested by

no test coverage detected