a beta of an ai chatbot for government inquiry solely based in nigeria
# Nigerian Government Service Assistant
An AI-powered chatbot for Nigerian government services, supporting English, Yoruba, Hausa, and Igbo languages. Built with Next.js, Firebase, and Google Gemini AI.
## Features
- **Multi-language Support**: English, Yoruba, Hausa, and Igbo
- **AI-Powered Responses**: Using Google Gemini AI with Nigeria-specific prompts
- **Real-time Web Search**: Integrated with Serper API for current information
- **State-Aware Search**: Automatically detects and prioritizes Nigerian states (especially Ogun State)
- **Context-Aware Queries**: Enhances searches with state-specific terms and government sites
- **Authentication System**:
- Anonymous users: 10 messages limit with local storage token
- Registered users: Unlimited messages with Firebase Auth
- **Memory Management**: Automatic cleanup of old conversations and messages
- **Real-time Chat**: Firebase Realtime Database integration
- **Markdown Support**: Rich formatting for AI responses
- **Search Toggle**: Users can enable/disable real-time search functionality
## Authentication System
### Anonymous Users
- Users can try the service anonymously with a 10-message limit
- Token stored in localStorage with 24-hour expiration
- Automatic cleanup when token expires
### Registered Users
- Sign up with email/password for unlimited messages
- Conversations persist across sessions
- Memory management prevents excessive data storage
## Setup
### Prerequisites
- Node.js 18+
- Firebase project with Realtime Database
- Google Gemini API key
### Environment Variables
Create a `.env.local` file:
```env
# Firebase Configuration
FIREBASE_API_KEY=your_firebase_api_key
FIREBASE_AUTH_DOMAIN=your_project.firebaseapp.com
FIREBASE_PROJECT_ID=your_project_id
FIREBASE_STORAGE_BUCKET=your_project.appspot.com
FIREBASE_MESSAGING_SENDER_ID=your_sender_id
FIREBASE_APP_ID=your_app_id
FIREBASE_MEASUREMENT_ID=your_measurement_id
FIREBASE_DATABASE_URL=
your_project.firebaseio.com
# Google Gemini AI
GEM …