Added black as an automatic code formatter and created a development script for running quality checks.
- Added
black>=25.1.0to thedevdependency group - Added
[tool.black]configuration section withline-length = 88andtarget-version = ["py313"]
- Created a development script for running code quality checks
./quality.sh— checks formatting without making changes (useful for CI)./quality.sh format— auto-formats code with black
All Python files in backend/ and main.py were formatted with black for consistency:
backend/ai_generator.pybackend/app.pybackend/config.pybackend/document_processor.pybackend/models.pybackend/rag_system.pybackend/search_tools.pybackend/session_manager.pybackend/vector_store.pybackend/tests/test_ai_generator.pybackend/tests/test_course_search_tool.pybackend/tests/test_rag_system.py
Formatting changes were minimal — mostly trailing whitespace cleanup, consistent blank lines between classes/functions, and alignment comment spacing to match black's style.
No frontend files were modified. All changes were to the backend testing infrastructure.
backend/tests/conftest.py — Shared pytest fixtures:
mock_rag_system— Creates a RAGSystem with VectorStore, AIGenerator, and DocumentProcessor all mocked outmock_vector_store— Standalone mock VectorStore for tool-level testssample_query_payload/sample_query_with_session— Reusable request payloads for API tests
backend/tests/test_api.py — 16 API endpoint tests across 3 test classes:
TestQueryEndpoint(8 tests) — POST/api/query: success response, session creation/reuse, validation errors, 500 on RAG failure, response shape and source structureTestCoursesEndpoint(4 tests) — GET/api/courses: success response, response shape, 500 on error, empty catalogTestMiscRoutes(4 tests) — 404 on unknown routes, 405 on wrong HTTP methods, 422 on malformed JSON
The test app is built inline via create_test_app() to avoid importing backend/app.py which mounts static files from ../frontend (unavailable in the test environment).
pyproject.toml — Added:
httpxdev dependency (required by FastAPI'sTestClient)[tool.pytest.ini_options]section withtestpaths,pythonpath, andaddoptsfor cleaner test execution (uv run pytestfrom repo root now works without extra flags)
- Added
data-theme="dark"attribute to<body>for CSS theme switching - Added a fixed-position theme toggle button before the main container with:
- Sun icon (shown in dark mode, click to switch to light)
- Moon icon (shown in light mode, click to switch to dark)
aria-labelfor screen reader accessibility
- Bumped CSS cache version to
v=11
- Light theme CSS variables: Added
[data-theme="light"]block with light background/surface colors, dark text, adjusted borders and shadows for good contrast - Added
--code-bgvariable to both themes so inline code and pre blocks adapt to the theme (replaces hardcodedrgba(0,0,0,0.2)) - Theme toggle button styles: Fixed position top-right, circular 44px button, hover scale animation, focus ring for keyboard navigation
- Icon transition styles: Sun/moon icons crossfade with rotation using CSS opacity and transform transitions
- Global theme transition: Added
transitiononbackground-color,color,border-color, andbox-shadowfor smooth theme switching - Source link colors: Changed from hardcoded blue (
#5ebbf7) tovar(--primary-color)so links work in both themes
initTheme(): Reads saved theme fromlocalStorageon page load and applies it todata-themetoggleTheme(): Switches between dark/light, saves preference tolocalStorageupdateThemeAriaLabel(): Updates the toggle button'saria-labelto reflect the available action- Registered click listener for the theme toggle button in
setupEventListeners()
- Default theme is dark (matching the existing design)
- Theme preference persists across page reloads via
localStorage - The toggle button uses a 44px touch target for mobile accessibility
- Sun icon = "click to get light", Moon icon = "click to get dark"
- All transitions are 300ms ease for a smooth, non-jarring switch