An intelligent AI-powered assistant that helps users understand and navigate the Somali Provisional Constitution.
# 🇸🇴 Dastuur Agent - Somali Constitution AI Assistant
An intelligent AI-powered assistant that helps users understand and navigate the Somali Provisional Constitution. Built with Next.js, Google Gemini, and Memvid AI.
---
## ✨ Features
### 🤖 **AI-Powered Constitutional Assistant**
- Natural language understanding in Somali
- Accurate answers based on the Somali Provisional Constitution
- Context-aware responses using RAG technology
### 💬 **Advanced Chat Interface**
- **Multi-chat support** - Create and manage multiple conversation threads
- **Chat history** - Persistent storage using localStorage
- **Sidebar navigation** - Easy access to all your conversations
- **Real-time responses** - Streaming AI responses with loading indicators
- **Markdown support** - Rich text formatting in responses
### 🎨 **Premium UI/UX**
- Modern, glassmorphic design
- Smooth animations and transitions
- Responsive layout for all devices
- Dark mode ready
- Accessible and user-friendly interface
### 🔍 **Intelligent Search**
- Hybrid search combining vector embeddings and keyword matching
- Special optimization for article number queries (e.g., "Qodobka 3aad")
- Contextual relevance scoring
- Top-K retrieval for accurate results
---
## 🚀 Getting Started
### Prerequisites
- **Node.js** 18.x or higher
- **npm** or **yarn**
- **Google Gemini API Key** (Get one here)
### Installation
1. **Clone the repository**
```bash
git clone
github.com
cd Dastuur-agent-
```
2. **Install dependencies**
```bash
npm install
```
3. **Set up environment variables**
Create a `.env` file in the root directory:
```env
GEMINI_API_KEY=your_gemini_api_key_here
```
4. **Prepare the knowledge base**
Place your Somali Constitution PDF in the `pdf/` directory:
```
pdf/Dastuurka_KMG_Soomaaliya.pdf
```
5. **Generate embeddings**
Run the ingestion script to process the PDF and create embeddings:
```bash
npm run ingest
```
This will:
- Extract text from …