Spaces:
Running
Running
fix: NCBI_API_KEY not loading - blast.py read os.environ before dotenv
Browse files- Add NCBI_API_KEY to Settings class in config.py
- blast.py now reads from settings instead of raw os.environ
- Fixes 429 rate limiting on all NCBI BLAST requests
Files changed (2)
27 unmodified lines2829303132333427 unmodified lines DEFAULT_MODEL: str = os.getenv("DEFAULT_MODEL", "groq/llama-3.3-70b-versatile") PRO_MODEL: str = os.getenv("PRO_MODEL", "claude-sonnet-4-20250514") NCBI_EMAIL: str = os.getenv("NCBI_EMAIL", "bioflow@example.com") NCBI_API_KEY: str = os.getenv("NCBI_API_KEY", "") DEMO_MODE: bool = os.getenv("DEMO_MODE", "false").lower() in ("true", "1", "yes") CORS_ORIGIN: str = os.getenv("CORS_ORIGIN", "https://bioai-platform.vercel.app") SENTRY_DSN: str = os.getenv("SENTRY_DSN", "")17 unmodified lines18192021222321222324252617 unmodified linesNCBI_BLAST_URL = "https://blast.ncbi.nlm.nih.gov/blast/Blast.cgi"RATE_LIMIT_SECONDS = 10
# NCBI API key — free tier gives 3 req/s instead of 1 req/10s.# Set NCBI_API_KEY env var in .env or HF Spaces secrets.NCBI_API_KEY = os.environ.get("NCBI_API_KEY", "")from app.config import settings
NCBI_API_KEY = settings.NCBI_API_KEY
def _api_key_param() -> dict:bioai-platform/backend/app/config.py+1
bioai-platform/backend/app/integrations/ncbi/blast.py+3-3