| 1 | from helpers.api import ApiHandler, Input, Output, Request, Response |
| 2 | |
| 3 | |
| 4 | from helpers import persist_chat |
| 5 | |
| 6 | class LoadChats(ApiHandler): |
| 7 | async def process(self, input: Input, request: Request) -> Output: |
| 8 | chats = input.get("chats", []) |
| 9 | if not chats: |
| 10 | raise Exception("No chats provided") |
| 11 | |
| 12 | ctxids = persist_chat.load_json_chats(chats) |
| 13 | |
| 14 | return { |
| 15 | "message": "Chats loaded.", |
| 16 | "ctxids": ctxids, |
| 17 | } |