This project is a full-stack chatbot application designed to support collaborative fact-checking. Users can submit questions and upload documents, and the system extracts factual claims, ranks them, and allows users to vote on which claim to explore further.
The chatbot consists of:
- Frontend: A React-based interface where users interact with the chatbot, submit questions, upload files, and vote on claims.
- Backend: A FastAPI service that handles file processing, claim extraction, caching, and claim weight updates.
Users submit a question and optionally attach documents (e.g. PDFs, DOCs).
The backend uses a mock LLM (LLMGenerator) to generate multiple claims from the input. Each claim has:
id: Unique identifiertext: The statement extractedweight: A numerical score representing relevance
Claims are ranked by weight. If multiple claims share the highest weight, the frontend prompts the user to choose one.
When a user selects a claim:
- The backend updates the weight of the selected claim (
+1) - The updated claim set is cached for future reference
- Accepts:
question,files - Returns:
claims,answer,referenced_documents
- Accepts:
question,files,claim_id - Action: Increments the weight of the selected claim and updates the cache
chatbot/
├── backend/
│ ├── src/
│ │ ├── api/ # FastAPI route definitions
│ │ ├── helpers/ # Claim and question handling
│ │ ├── utils/ # LLM mock, cache, config
│ │ ├── config.yaml # App configuration
│ │ ├── main.py # FastAPI entry point
│ │ └── requirements.txt # Python dependencies
│ ├── test/ # Backend tests
│ └── Dockerfile # Backend container
├── frontend/
│ ├── src/
│ │ ├── components/ # React components
│ │ ├── api.ts # Axios API calls
│ │ ├── App.tsx # Main app component
│ │ └── main.tsx # Entry point
│ ├── index.html # HTML template
│ ├── nginx.conf # NGINX config
│ ├── package.json # Node dependencies
│ ├── vite.config.ts # Vite build config
│ └── Dockerfile # Frontend container
├── .gitignore # Git ignore rules
├── docker-compose.yml # Docker orchestration
└── README.md # Project documentationMake sure Docker is installed, then run:
docker-compose up --buildThis will:
- Start the FastAPI backend on http://localhost:7373
- Start the React frontend on http://localhost:3000
cd backend
python -m venv env
source env/bin/activate
pip install -r requirements.txt
uvicorn main:app --reload --port 7373cd frontend
npm install
npm run dev