main
py 17 lines 553 Bytes
Raw
1 from helpers.api import ApiHandler, Input, Output, Request, Response
2
3 from helpers import persist_chat
4
5 class ExportChat(ApiHandler):
6 async def process(self, input: Input, request: Request) -> Output:
7 ctxid = input.get("ctxid", "")
8 if not ctxid:
9 raise Exception("No context id provided")
10
11 context = self.use_context(ctxid)
12 content = persist_chat.export_json_chat(context)
13 return {
14 "message": "Chats exported.",
15 "ctxid": context.id,
16 "content": content,
17 }