How alen-saji-05/real-time-halu-detect works
HalluGuard combines a browser extension and Flask-backed workflow that gathers evidence for an answer, detects unsupported answer spans, and returns results to the page. A separate detection API exposes the detector directly. The main workflow and detector internals are supported by sampled source; web UI wiring and some extension presentation behavior are only represented where the tree or excerpts identify them.
Main entry points: main.py QA pipeline · app.py Pipeline API · background.js Extension worker · transformer.py Transformer detector
Components 20
Browser extension
- Page monitor
extension/content.js - Extension worker
extension/background.js - Extension popup
extension/popup.js
Evidence pipeline
- QA pipeline
main.py - Keyword extraction
keyword_extractor.py - Context retrieval
context_genarator.py
Detection engine
- Detector façade
halluguard/models/inference.py - Detector factory
halluguard/detectors/factory.py - Transformer detector
halluguard/detectors/transformer.py - Detector interface
halluguard/detectors/base.py - Token preparation
halluguard/datasets/hallucination_dataset.py
HTTP services
- Pipeline API
app.py - Detector API
server.py - Saved results
app.py - Web application
webapp.py
Other components
- Chat user
- AI chat page
- SERP search
- Wikipedia content
- Classifier model
Connections 23
- Chat user → AI chat page: asks question
- AI chat page → Page monitor: renders response
- Page monitor → Extension worker: sends Q&A
- Extension worker → Pipeline API: POSTs Q&A
- Pipeline API → Saved results: saves Q&A/results
- Pipeline API → QA pipeline: runs pipeline
- QA pipeline → Keyword extraction: extracts keywords
- QA pipeline → Context retrieval: retrieves context
- Context retrieval → SERP search: searches web
- Context retrieval → Wikipedia content: fetches articles
- QA pipeline → Detector façade: checks answer
- Detector façade → Detector factory: creates detector
- Detector factory → Transformer detector: selects implementation
- Transformer detector → Detector interface: implements interface
- Transformer detector → Token preparation: prepares tokens
- Transformer detector → Classifier model: runs inference
- QA pipeline → Pipeline API: returns analysis
- Pipeline API → Extension worker: returns detection
- Extension worker → Page monitor: forwards results
- Page monitor → AI chat page: shows findings
- Detector API → Detector façade: predicts spans
- Extension popup → Extension worker: reads state
- Web application → Saved results: reads results