How chutungduongg/chatbot_answering_vietnamese_history works
Vietnamese History LLM provides a chat UI for grounded answers, with Hybrid RAG and a tool-using Central Agent as distinct inference modes. The main flow runs from a user question through the frontend and API to retrieval and model generation, then streams the response and citations back. Conversations and uploaded documents add persistent history and temporary retrieval; evaluation is a separate capability. Some runtime wiring is documented but not visible in the excerpts, so those relationships cite the README rather than implying unsampled calls.
Main entry points: registry.py Tool registry · main.py FastAPI assembly · api.js API client · routes.py Chat routes
Components 23
Chat interface
- Chat UI
frontend/src/App.jsx - Chat streaming
frontend/src/hooks/useChatStream.js - Conversation state
frontend/src/hooks/useChatSession.js - API client
frontend/src/services/api.js
API and sessions
- FastAPI assembly
app/main.py - Chat routes
app/api/routes.py - Conversation API
app/api/conversations.py - Conversation store
app/chat/store.py
Retrieval and documents
- Attachment processing
app/chat/attachments.py - RAG service
app/services/rag_service.py - Hybrid retrieval
app/rag/retrieval.py
Inference and tools
- Hybrid runtime
app/rag/hybrid_runtime.py - Qwen generation
app/models/qwen.py - Central agent
app/central/runtime.py - Tool registry
app/tools/registry.py - History search
app/tools/local_search.py - Attachment search
app/tools/attachment_search.py - Web search
app/tools/web_search.py - Wikipedia tools
app/tools/wikipedia.py - Page fetcher
app/tools/page_fetcher.py
Evaluation
- Retrieval and answer evaluation
evaluation/runner.py - Retrieval metrics
evaluation/metrics/retrieval.py
Other components
- User
Connections 31
- User → Chat UI: asks
- Chat UI → Chat streaming: streams chat
frontend/src/App.jsx - Chat UI → Conversation state: manages sessions
frontend/src/App.jsx - Chat streaming → API client: calls
frontend/src/hooks/useChatStream.js - Conversation state → API client: calls
frontend/src/hooks/useChatSession.js - API client → Chat routes: sends chat requests
- API client → Conversation API: requests conversations
- FastAPI assembly → Chat routes: mounts routes
app/main.py - FastAPI assembly → Conversation API: mounts routes
app/main.py - Chat routes → Hybrid runtime: dispatches hybrid
- Chat routes → Central agent: dispatches central
- Conversation API → Conversation store: reads and writes
app/api/conversations.py - FastAPI assembly → RAG service: initializes retrieval
app/main.py - FastAPI assembly → Hybrid runtime: initializes runtime
app/main.py - FastAPI assembly → Central agent: initializes runtime
app/main.py - Attachment processing → Conversation store: stores documents
app/chat/attachments.py - Attachment processing → RAG service: uses embeddings
app/chat/attachments.py - RAG service → Hybrid retrieval: provides shared retriever
app/rag/retrieval.py - Hybrid runtime → Hybrid retrieval: retrieves context
- Hybrid runtime → Qwen generation: generates answer
- Central agent → Qwen generation: generates answer
- Central agent → Tool registry: dispatches tools
app/central/runtime.py - FastAPI assembly → Tool registry: registers tools
app/main.py - Tool registry → History search: registers
app/main.py - Tool registry → Attachment search: registers
app/main.py - Tool registry → Web search: registers
app/main.py - Tool registry → Wikipedia tools: registers
app/main.py - Tool registry → Page fetcher: registers
app/main.py - History search → Hybrid retrieval: searches history
app/tools/local_search.py - Attachment search → Attachment processing: searches uploads
app/tools/attachment_search.py - Retrieval and answer evaluation → Retrieval metrics: scores retrieval