Spaces:
Sleeping
Sleeping
Commit History
5 days ago
-
fix: rate-limit each user, not the whole HF Space
The limiter keyed on X-Real-IP, set by the capstone nginx, and otherwise on the socket peer. On HF Spaces every request arrives from HF's proxy, so unless that proxy sets X-Real-IP, all users share one 10/min generate bucket (and an AI Tutor repair uses two requests). If it doesn't set the header, a client can also send its own X-Real-IP to get a fresh limit. - RATE_LIMIT_IP_SOURCE picks the trusted source: x-real-ip (default, unchanged capstone behavior), x-forwarded-for or peer - x-forwarded-for uses the FORWARDED_TRUSTED_HOPS-th entry from the right (default 1), so entries a client prepends are ignored - The HF Dockerfile sets x-forwarded-for with 1 trusted hop - The server logs the X-Forwarded-For entry count once (no addresses), so the hop count can be checked in the Space logs; app INFO logging is enabled for this, as uvicorn only configures its own loggers Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>5c6985c
6 days ago
-
feat: accept optional code and instructions in /api/generate
Clients like the AVP app used to pack their language rules, the editor code and the user's request into one `query`. All of it was embedded for retrieval, so the boilerplate rules swamped the search. - GenerateRequest gains optional `code` and `instructions`, plus length caps on every field (query 1-2000, code 20000, instructions 8000) - Retrieval searches the query plus the code; instructions only go into the prompt, in their own section - The generation cache key covers all fields (plain-query keys unchanged) Requests with only `query` produce the same prompt as before. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>1e1e82b
13 days ago
-
Refactor into avp_rag package, split frontend, prune deps
- Move ingest/retrieve/generate/providers/tracking and the ANTLR parser into an avp_rag/ package with central config (absolute paths) and a single knowledge-base reader; drop sys.path/os.chdir hacks in api/ - Keep root ingest.py/retrieve.py/generate.py as thin CLI shims - Fix: generate_solution retrieved twice; EMBEDDING_DEVICE was never read; FlagEmbedding import failure called sys.exit at import time - /health uses is_retriever_loaded() instead of a private global - Remove PseudocodeListener.py and unused chromadb/qdrant-client/rank-bm25; move antlr4-tools to dev deps - Split ChatPanel into api client, useChat hook, MessageBubble, ChatInput - Add tests for knowledge_base, tracking, ingest, generate, retrieve Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>915a861
-
Update the structure of API call for /api/generate
0b9bfd9
-
Update the interfaces & dependencies
33152a2
-
Quality of life update for code
fc2011e -
fix: resolve Pyright diagnostics introduced by simplification
- pyrightconfig.json: point Pyright at .venv so package imports resolve - providers.py: reference _call_anthropic/_call_vllm via .__name__ so Pyright sees them as accessed while getattr still supports mock.patch - tracking.py: replace deprecated datetime.utcnow() with datetime.now(timezone.utc); output format unchanged - ingest.py: add # type: ignore on ANTLR4 ctx attribute accesses — antlr4-python3-runtime ships no type stubs so these are false positives - api/main.py: rename unused lifespan `app` param to `_app` - api/routes.py: remove unused `request: Request` from health endpoint (not rate-limited, slowapi doesn't require it there) 13/13 tests pass. Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>118a5dc
-
Add Qwen models with tests for different LLM providers
a533d1f
-
Add python-dotenv for API keys handling, which fix the 503 error
4387809 -
add api and a chat interface in React
29ce3e6