Spaces:
Sleeping
Sleeping
Download settings.py from Shakeel401/TIQ-Test-Backend: direct link, hf CLI and curl.
- Browser
- Download file 809 Bytes
-
https://huggingface.co/spaces/Shakeel401/TIQ-Test-Backend/resolve/main/settings.py
- Command line
-
hf download hf://spaces/Shakeel401/TIQ-Test-Backend/settings.py
-
curl -L -o settings.py https://huggingface.co/spaces/Shakeel401/TIQ-Test-Backend/resolve/main/settings.py
809 Bytes
| from fastapi import APIRouter | |
| from supabase import create_client | |
| import os | |
| from dotenv import load_dotenv | |
| load_dotenv() | |
| router = APIRouter() | |
| supabase = create_client( | |
| os.getenv("SUPABASE_URL"), | |
| os.getenv("SUPABASE_KEY") | |
| ) | |
| # ========================= | |
| # GET AI STATUS | |
| # ========================= | |
| def get_ai_status(): | |
| res = supabase.table("bot_settings").select("*").limit(1).execute() | |
| return {"ai_enabled": res.data[0]["ai_enabled"]} | |
| # ========================= | |
| # TOGGLE AI | |
| # ========================= | |
| def toggle_ai(status: bool): | |
| res = supabase.table("bot_settings").update({ | |
| "ai_enabled": status | |
| }).eq("id", res.data[0]["id"]).execute() | |
| return {"success": True, "ai_enabled": status} |