Skip to content

letuandatt/LexMindChatbot

Repository files navigation

LexMind - Vietnam Law Chatbot

Hệ thống hỏi đáp thông minh về văn bản quy phạm pháp luật Việt Nam sử dụng AI.

Tính năng

  • Tra cứu văn bản pháp luật - Tìm kiếm và hỏi đáp về các Chỉ thị, Nghị định, Quyết định
  • Phân tích PDF - Upload tài liệu và chat trực tiếp với nội dung
  • Phân tích ảnh - Chụp ảnh văn bản để trích xuất thông tin
  • Multi-Agent System - Kiến trúc đa tác tử với Supervisor điều phối
  • Quản lý phiên chat - Lưu trữ và quản lý lịch sử hội thoại

Screenshots

Trang chủ

Giao diện Chat

Đăng nhập

Đăng ký

Quản lý File

Hồ sơ người dùng

Tech Stack

Frontend

  • Next.js 14
  • TypeScript
  • Tailwind CSS

Backend

  • FastAPI (Python)
  • MongoDB
  • Redis

AI/ML

  • Google Gemini (LLM)
  • Google File Search Store (RAG)
  • LangChain + LangGraph
  • Cohere Rerank

Cấu trúc thư mục

LexMindChatbot/
├── frontend/                  # Next.js frontend
├── backend/                   # FastAPI backend (auth, sessions, routers)
├── chatbot/                   # Core chatbot (LLM, agents, tools, RAG)
├── docs/                      # Documentation & images
├── pyproject.toml             # Canonical Python project metadata
├── requirements.txt           # Core runtime deps (mirror of pyproject)
├── requirements-dev.txt       # Linters, type checker, tests
└── requirements-ingest.txt    # Data-crawler deps (selenium, bs4)

Cài đặt

1. Clone repository

git clone https://github.com/letuandatt/LexMindChatbot.git
cd LexMindChatbot

2. Backend

Chọn một trong hai cách cài đặt dưới đây.

Cách A — pip install -r (cổ điển):

pip install -r requirements.txt
# Optional extras:
pip install -r requirements-dev.txt      # linters + tests
pip install -r requirements-ingest.txt   # chỉ cần cho chatbot/crawl_data.py

Cách B — editable install qua pyproject.toml (khuyến nghị):

pip install -e ".[dev,test]"             # backend + chatbot + dev tooling
pip install -e ".[ingest]"               # crawler extras

Sau đó cấu hình env và chạy:

cp chatbot/.env.example chatbot/.env
# Edit .env with your API keys

uvicorn backend.main:app --reload --port 8000

3. Frontend

cd frontend
npm install
npm run dev

4. Environment Variables

# Google AI
GOOGLE_API_KEY=your_google_api_key
LAW_MAIN_STORE_NAME=your_file_store_name

# MongoDB
MONGO_URI=mongodb://localhost:27017

# Redis
REDIS_URL=redis://localhost:6379

# JWT
JWT_SECRET_KEY=your_secret_key

# Email (Gmail SMTP)
GMAIL_USER=your_email
GMAIL_APP_PASSWORD=your_app_password
FRONTEND_URL=http://localhost:3000

API Endpoints

Endpoint Method Description
/auth/register POST Đăng ký tài khoản
/auth/login POST Đăng nhập
/chat/text POST Chat văn bản
/chat/image POST Chat với ảnh
/chat/pdf POST Chat với PDF
/sessions/ GET Lấy danh sách phiên
/sessions/{id} GET Chi tiết phiên

Kiến trúc Multi-Agent

User Query
    ↓
┌─────────────┐
│  Supervisor │  ← Điều phối và phân loại câu hỏi
└─────────────┘
    ↓
┌─────────────────────────────────────────┐
│                                         │
↓                ↓                ↓       ↓
LawResearcher    PersonalAnalyst  Vision  General
(RAG Search)     (User Files)     (Image) (Chitchat)

License

MIT License

Author

Lê Tuấn Đạt - 2025

About

A Retrieval-Augmented Multi-Agent Conversational System for Legal Document Question Answering

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors