(self, input: Input, request: Request)
| 7 | |
| 8 | class 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 | } |
no test coverage detected