app.pycomposes the public FastAPI surface by mounting the UI at/and the research API under/research.frontend/hosts the user-facing FastAPI router (main.py), templates infrontend/templates/, and UI assets infrontend/static/; shared landing files live in the rootstatic/.research/implements the Gemini-backed report engine with routes inresearch/main.py, client logic inresearch/gemini_client.py, and shared schemas/settings inresearch/models.py.- Mirror runtime modules in
tests/(for example,tests/test_research.py,tests/frontend/test_routes.py) when adding coverage.
uv venv .venv && source .venv/bin/activateinitializes and activates a local virtual environment.uv pip install -e .installs the package in editable mode so live code edits take effect without reinstalling.uvicorn app:app --reload --port 8000serves the unified experience athttp://localhost:8000.uvicorn frontend.main:app --reloadanduvicorn research.main:app --reloadtarget the UI or Gemini API independently during focused work.python -m pytestruns the automated suite; add-k <pattern>to scope the run.
- Follow PEP 8 with 4-space indentation and
snake_casenames for functions, modules, and variables; keep Pydantic models, settings classes, and FastAPI routers inPascalCase. - Prefer explicit imports, typed signatures, and reusable dependency helpers as demonstrated in
research/models.pyandapp.py. - Co-locate module constants with their usage, such as static directory paths in
frontend/main.py, to simplify maintenance.
- Use
pytestfixtures to stub Gemini and HTTP dependencies; favor behavior-first names liketest_generate_report_returns_citations. - Validate new routes across success and error paths, covering schema enforcement, Gemini fallbacks, and Markdown sanitization before shipping.
- Keep commits small, scoped, and imperative (e.g., “Improve mobile UI”, “Guard chat prompt”), with subjects under roughly 50 characters.
- Pull requests should summarize user-facing impact, list verification steps (commands run, screenshots for UI changes), and link relevant issues or research notes.
- Load
GOOGLE_API_KEY,GEMINI_MODEL, andGEMINI_TEMPERATUREfrom.envviapydantic-settings; never commit secrets or sampled responses. - Gate outbound requests and experimental toggles in
frontend/main.pyto safeguard credentials and preview-only features.
- Gemini-grounded chat ships through
/research/chatandGeminiReportGenerator.generate_chat_reply, providing trimmed context, system instructions, and finish-reason handling to the frontend chat UI.