Spaces:
Sleeping
Sleeping
Download scripts/verify_hf_config.py from GodRad/Rag_SaaS_Engine_v3_Latest: direct link, hf CLI and curl.
- Browser
- Download file 2.25 kB
-
https://huggingface.co/spaces/GodRad/Rag_SaaS_Engine_v3_Latest/resolve/main/scripts/verify_hf_config.py
- Command line
-
hf download hf://spaces/GodRad/Rag_SaaS_Engine_v3_Latest/scripts/verify_hf_config.py
-
curl -L -o verify_hf_config.py https://huggingface.co/spaces/GodRad/Rag_SaaS_Engine_v3_Latest/resolve/main/scripts/verify_hf_config.py
2.25 kB
| import os | |
| import sys | |
| from app.core.config import settings | |
| from app.adapters.local_vector import LocalVectorStore | |
| def verify_config(): | |
| print("Verifying HF Spaces Configuration...") | |
| # 1. Check Database URL | |
| db_url = settings.DATABASE_URL | |
| print(f"DATABASE_URL: {db_url}") | |
| if os.path.exists("/app/data"): | |
| if "sqlite:////app/data/sql_app.db" not in db_url: | |
| print("β FAIL: DATABASE_URL should point to /app/data/sql_app.db when /app/data exists") | |
| return False | |
| else: | |
| if "sqlite:///./sql_app.db" not in db_url: | |
| print(f"β οΈ NOTE: DATABASE_URL is {db_url} (Expected for non-container env)") | |
| # 2. Check Vector DB Path | |
| vector_path = settings.VECTOR_DB_PATH | |
| print(f"VECTOR_DB_PATH: {vector_path}") | |
| if os.path.exists("/app/data"): | |
| if "/app/data/vector_store.db" not in vector_path: | |
| print("β FAIL: VECTOR_DB_PATH should point to /app/data/vector_store.db when /app/data exists") | |
| return False | |
| # 3. Check Base URL and Redirects | |
| base_url = settings.BASE_URL | |
| print(f"BASE_URL: {base_url}") | |
| gdrive_redirect = settings.GOOGLE_REDIRECT_URI | |
| if base_url not in gdrive_redirect: | |
| print(f"β FAIL: Google Redirect URI {gdrive_redirect} does not contain BASE_URL {base_url}") | |
| return False | |
| print("β Configuration Verification Passed!") | |
| return True | |
| def verify_vector_store(): | |
| print("\nVerifying Local Vector Store Persistence...") | |
| try: | |
| store = LocalVectorStore() | |
| print(f"LocalVectorStore initialized at: {store.db_path}") | |
| if store.db_path != settings.VECTOR_DB_PATH: | |
| print(f"β FAIL: LocalVectorStore using {store.db_path}, expected {settings.VECTOR_DB_PATH}") | |
| return False | |
| print("β Vector Store Verification Passed!") | |
| return True | |
| except Exception as e: | |
| print(f"β FAIL: Vector Store initialization failed: {e}") | |
| return False | |
| if __name__ == "__main__": | |
| config_ok = verify_config() | |
| vector_ok = verify_vector_store() | |
| if config_ok and vector_ok: | |
| sys.exit(0) | |
| else: | |
| sys.exit(1) | |