TCM-Sage is an FYP academic project, currently single-developer, but contributions and feedback are welcome. This guide covers how to report issues, propose changes, and follow the project's conventions.
See README.md for prerequisites and installation steps. In short:
- Clone the repo and create a Python venv
venv\Scripts\python.exe -m pip install -r requirements.txtcd web && npm install- Copy
.env.example→.envand configure at least one LLM provider key
See docs/CONFIGURATION.md for all environment variables.
Open an issue on GitHub Issues. Please include:
- A clear description of the problem or request
- Steps to reproduce (for bugs): query text used, provider/model, relevant
.envsettings (omit API keys) - Expected behaviour vs. actual behaviour
- Python version, OS, and Node.js version if applicable
- Fork the repository and create a branch from
main - Use descriptive branch names, e.g.
feat/add-provider-xorfix/citation-panel-scroll - Make focused commits — one logical change per commit
- Verify your changes manually (see Running Tests)
- Open a PR against
mainwith a description of what changed and why
No CI is currently configured. The reviewer (project author) will test PRs locally.
Python (src/, scripts/):
snake_casefor files, functions, and variables- Type hints on public functions; Pydantic models for API request/response types
sys.pathbootstrap before local imports —src/is not a package- Never include
"Sources:"or"References:"sections in LLM output — the UI strips them - Never use
"KG"or"Knowledge Graph"in text sent to the LLM (leaks RAG identity in Arena) - Use
HybridRetrieverfromsrc/retriever.py— do not create parallel retrieval implementations - DashScope API batch limit is 10 (embeddings and reranker) — respect this in any new ingestion code
TypeScript/Next.js (web/):
PascalCase.tsxfor components,camelCase.tsfor utilities and hooks- Path alias
@/*resolves toweb/*— use@/lib/...,@/components/... - Always route backend calls through the
/api/backend/Next.js proxy — never calllocalhost:8000directly - Keep
web/lib/types.tsin sync withsrc/citation_types.pyTypedDicts - No barrel
index.tsfiles — import from concrete paths
Linting:
# Frontend
cd web && npm run lintNo Python linter is currently configured. Follow the conventions above.
There is no pytest setup. Tests are standalone scripts run directly with the project venv:
# Python
venv\Scripts\python.exe src/test_citations.py
venv\Scripts\python.exe src/test_graph.py
venv\Scripts\python.exe src/test_hybrid_retriever.py
venv\Scripts\python.exe scripts/verify_symmap_retrieval.py
# Frontend build check
cd web && npm run buildRun relevant test scripts before submitting a PR to confirm nothing is broken.
By contributing, you agree that your contributions will be licensed under the MIT License.