Skip to content

Conversation

@radicevicbranko
Copy link

No description provided.

radicevicbranko and others added 10 commits September 5, 2025 14:19
- Add CourseOutlineTool class with get_course_outline tool definition
- Implement get_course_outline method in VectorStore for semantic course matching
- Register CourseOutlineTool alongside existing CourseSearchTool in RAG system
- Update AI system prompt with tool selection guidelines for outline vs content queries
- Add comprehensive CLAUDE.md documentation for the RAG system architecture

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit resolves the core issue where content-related questions returned generic "query failed" messages instead of proper responses. The fix includes comprehensive testing infrastructure and targeted improvements to error handling throughout the RAG pipeline.

## Key Changes

### 🧪 Testing Infrastructure
- Added comprehensive test suite (104 tests) covering all components
- Unit tests for CourseSearchTool, VectorStore, AIGenerator
- Integration tests for RAG system end-to-end functionality
- API layer tests for FastAPI endpoints
- Updated pyproject.toml with pytest dependencies
- Configured uv for dependency management

### 🛠️ Core Fixes

**CourseSearchTool (search_tools.py:52-97)**
- Added input validation for None/empty queries
- Wrapped vector store calls in try/catch blocks
- Return user-friendly error messages instead of crashes
- Graceful exception handling with debug logging

**VectorStore (vector_store.py:102-127)**
- Implemented similarity threshold (0.8) for course name matching
- Reject poor semantic matches to prevent irrelevant results
- Added debug logging for rejected course name matches
- Prevents "Nonexistent Course" from matching real courses

**RAG System (rag_system.py:104-162)**
- Added comprehensive error boundaries throughout query pipeline
- Input validation for empty/None queries with helpful messages
- Graceful degradation when individual components fail
- Session management errors no longer crash entire queries
- User-friendly error messages replace technical exceptions

### 📚 Documentation Updates
- Updated CLAUDE.md with uv dependency management instructions
- Added comprehensive testing commands and workflows
- Documented development guidelines emphasizing uv usage
- Updated Python version requirement from >=3.13 to >=3.12

### 🔧 Technical Improvements
- Fixed Python version compatibility issues
- Cleaned up unused imports (Protocol from typing)
- Improved error messaging across all components
- Enhanced debugging capabilities with structured logging

## Test Results
- All core component tests now pass (CourseSearchTool, VectorStore)
- 22 of 24 previously failing tests now pass
- Integration tests confirm end-to-end fixes work correctly
- API layer improvements resolve query processing issues

## Impact
- ✅ "Query failed" messages replaced with specific, actionable feedback
- ✅ System gracefully handles malformed queries and edge cases
- ✅ Course name matching properly rejects irrelevant searches
- ✅ Exception handling prevents cascade failures
- ✅ Improved user experience with informative error messages

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
- Add theme toggle button in sidebar with sun/moon icons
- Implement comprehensive light theme with proper contrast ratios
- Add CSS variables for seamless theme switching via data-theme attribute
- Include smooth 0.3s transitions for all color changes
- Support theme persistence using localStorage
- Add keyboard shortcut (Ctrl+Shift+T) for accessibility
- Maintain existing design language and responsiveness

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
- Add pytest configuration in pyproject.toml with test discovery, markers, and warning filters
- Enhance conftest.py with mock_rag_system, test_app_factory, and test_client fixtures
- Add comprehensive API endpoint tests (test_api_endpoints.py):
  * Query endpoint: large responses, Unicode content, concurrent sessions, error handling
  * Courses endpoint: large datasets, Unicode titles, empty analytics scenarios
  * Health endpoint: basic checks and dependency failure resilience
  * Middleware: CORS configuration and OPTIONS request handling
- Add static file serving tests (test_static_files.py):
  * Frontend file serving with temporary test files
  * DevStaticFiles class with no-cache headers for development
  * Security tests for path traversal prevention
  * Integration tests for API + static file coexistence
- Resolve FastAPI import issues by creating test apps inline without static mounting
- Add httpx dependency for FastAPI TestClient support

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
- Merged quality_feature: Enhanced frontend UI with improved styling and user experience
- Merged test_feature: Added comprehensive test suite with API endpoint testing and fixtures
- Merged ui_feture: Added code quality tools (Black, Ruff, MyPy) and scripts
- Resolved conflicts in pyproject.toml by combining dependencies from both branches
- Resolved conflicts in backend/tests/conftest.py by preserving test fixtures

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant