Spaces:
Runtime error
Runtime error
Download tests/create_chat_session_collection.py from Darshankumarr03/Swift-Query: direct link, hf CLI and curl.
- Browser
- Download file 500 Bytes
-
https://huggingface.co/spaces/Darshankumarr03/Swift-Query/resolve/main/tests/create_chat_session_collection.py
- Command line
-
hf download hf://spaces/Darshankumarr03/Swift-Query/tests/create_chat_session_collection.py
-
curl -L -o create_chat_session_collection.py https://huggingface.co/spaces/Darshankumarr03/Swift-Query/resolve/main/tests/create_chat_session_collection.py
500 Bytes
| import sys | |
| import os | |
| sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), '../../'))) | |
| from main import app | |
| from utils.db.db import mongo | |
| def create_chat_session_collection(): | |
| with app.app_context(): | |
| try: | |
| mongo.db.create_collection("chatsession") | |
| print("Collection 'chatsession' created successfully.") | |
| except Exception as e: | |
| print(f"An error occurred: {e}") | |
| if __name__ == "__main__": | |
| create_chat_session_collection() | |