The chatbot's _build_corpus() function is tightly coupled and hard to test.
Refactoring improves testability and extensibility.
Relevant part of the codebase:
- backend/app/routers/chatbot.py
Expected outcome:
- Extract corpus building into a service class
- Use dependency injection for database access
- Make it easier to add new data sources (e.g., external APIs)
- Add unit tests for corpus building logic