This commit is contained in:
Krikorios
2025-07-14 10:14:20 +04:00
parent 890acbd5bc
commit 868c9b252c
21 changed files with 615 additions and 97 deletions
+52 -1
View File
@@ -5,9 +5,10 @@ A modern, bilingual (Arabic/English) university portal for the University of Tas
## 🌟 Features
### 🤖 AI-Powered Chatbot
- **Real AI**: Uses OpenRouter API with Meta LLaMA model
- **Real AI**: Uses OpenRouter API with Meta LLaMA model or Ollama local models
- **Bilingual Support**: Automatically detects and responds in Arabic or English
- **UTAS Oman Context**: Specialized knowledge about campus, programs, and admissions
- **Personalized Responses**: Tailors answers based on user authentication and role
- **No Mock Data**: All responses generated by real AI
### 🎓 Academic Programs
@@ -64,6 +65,56 @@ A modern, bilingual (Arabic/English) university portal for the University of Tas
5. **Open your browser**
Navigate to [http://localhost:3000](http://localhost:3000)
## 🤖 Chatbot Setup
### Configuration
1. Create a `.env.local` file in the project root with the following variables:
```env
# OpenRouter API Key (for LLM access)
OPENROUTER_API_KEY=sk-your-key-here
# Ollama configuration (for local model fallback)
OLLAMA_URL=http://localhost:11434
MODEL_COMMAND_R7B=command-r7b-arabic
```
2. To use the Ollama fallback:
- Install Ollama from [https://ollama.ai/](https://ollama.ai/)
- Pull the Arabic-capable model: `ollama pull command-r7b-arabic`
- Start the Ollama server locally: `ollama serve`
3. The chatbot automatically:
- Tries OpenRouter first if API key is available
- Falls back to Ollama if OpenRouter key is missing
- Detects language (Arabic/English) and responds accordingly
- Personalizes responses based on user authentication status
### Testing the Chatbot
Run the built-in chatbot tests:
```bash
npm run test:chat
```
Or run the integration tests:
```bash
npm run test
```
### Personalization Features
The chatbot provides different responses based on authentication:
- **Anonymous Users**: Public information only (courses, admissions, etc.)
- **Authenticated Students**: Personalized responses with student profile data
- **Faculty/Staff**: More detailed institutional information
- **Administrators**: Full access to university systems information
## 🛠️ Technology Stack
- **Framework**: Next.js 14+ with React 19