Spaces:
Running
Running
Download api/chat_load.py from Leon4gr45/openoperator: direct link, hf CLI and curl.
- Browser
- Download file 467 Bytes
-
https://huggingface.co/spaces/Leon4gr45/openoperator/resolve/main/api/chat_load.py
- Command line
-
hf download hf://spaces/Leon4gr45/openoperator/api/chat_load.py
-
curl -L -o chat_load.py https://huggingface.co/spaces/Leon4gr45/openoperator/resolve/main/api/chat_load.py
467 Bytes
| from helpers.api import ApiHandler, Input, Output, Request, Response | |
| from helpers import persist_chat | |
| class LoadChats(ApiHandler): | |
| async def process(self, input: Input, request: Request) -> Output: | |
| chats = input.get("chats", []) | |
| if not chats: | |
| raise Exception("No chats provided") | |
| ctxids = persist_chat.load_json_chats(chats) | |
| return { | |
| "message": "Chats loaded.", | |
| "ctxids": ctxids, | |
| } | |