✨ Major Features Added: - AI Chat with conversation memory and university-specific knowledge base - Multi-tenant university support with white-label capabilities - Professional admin interface for knowledge base management - Advanced database schema with Prisma ORM - Comprehensive documentation and guides - Modern Next.js 15 + React 19 architecture - Bilingual support (English/Arabic) - Role-based access control - Real-time chat interface with loading states 🔧 Technical Improvements: - Fixed all linter errors and TypeScript issues - Cleaned up codebase and removed legacy files - Added comprehensive .gitignore - Updated README with detailed setup instructions - Optimized database schema and migrations - Enhanced error handling and user experience 📚 Documentation: - AI Conversation Memory Guide - AI Enhancement Summary - Developer Guide - User Guide - Complete setup and deployment instructions 🚀 Ready for GitHub deployment and production use!
217 lines
6.7 KiB
Markdown
217 lines
6.7 KiB
Markdown
# University Portal - AI-Enhanced Multi-Tenant Platform
|
|
|
|
A modern, AI-powered university portal built with Next.js 15, React 19, and Prisma. Features advanced AI integration with conversation memory, university-specific knowledge bases, and multi-tenant architecture.
|
|
|
|
## 🚀 Features
|
|
|
|
### Core Features
|
|
- **Multi-University Support**: White-label solution for multiple universities
|
|
- **AI-Powered Chat**: Intelligent chatbot with conversation memory
|
|
- **Knowledge Base Management**: University-specific Q&A system
|
|
- **Modern UI/UX**: Beautiful, responsive design with Tailwind CSS
|
|
- **Multi-Language Support**: English and Arabic support
|
|
- **Role-Based Access**: Student, Staff, Admin, and Super Admin roles
|
|
|
|
### AI Integration
|
|
- **Conversation Memory**: AI remembers entire conversations
|
|
- **University-Specific Knowledge**: Custom Q&A for each university
|
|
- **Personalized Responses**: Context-aware based on user role and profile
|
|
- **Ollama Integration**: Local AI models with fallback to cloud APIs
|
|
- **Real-time Chat**: Professional chat interface with loading states
|
|
|
|
### Technical Features
|
|
- **Next.js 15**: Latest App Router with Turbopack
|
|
- **React 19**: Latest React features and optimizations
|
|
- **Prisma ORM**: Type-safe database operations
|
|
- **SQLite Database**: Lightweight, file-based database
|
|
- **TypeScript**: Full type safety throughout
|
|
- **Tailwind CSS**: Utility-first styling
|
|
- **ESLint**: Code quality and consistency
|
|
|
|
## 🛠️ Installation
|
|
|
|
### Prerequisites
|
|
- Node.js 18+
|
|
- npm or yarn
|
|
- Ollama (for local AI models)
|
|
|
|
### Setup
|
|
1. **Clone the repository**
|
|
```bash
|
|
git clone <repository-url>
|
|
cd university-portal
|
|
```
|
|
|
|
2. **Install dependencies**
|
|
```bash
|
|
npm install
|
|
```
|
|
|
|
3. **Set up the database**
|
|
```bash
|
|
npx prisma generate
|
|
npx prisma db push
|
|
```
|
|
|
|
4. **Seed the database**
|
|
```bash
|
|
npm run seed
|
|
npm run seed:knowledge-base
|
|
```
|
|
|
|
5. **Start the development server**
|
|
```bash
|
|
npm run dev
|
|
```
|
|
|
|
6. **Open your browser**
|
|
Navigate to [http://localhost:3000](http://localhost:3000)
|
|
|
|
## 🗄️ Database Setup
|
|
|
|
The project uses SQLite with Prisma ORM. Key models include:
|
|
|
|
- **University**: Multi-tenant university configurations
|
|
- **User**: User accounts with role-based access
|
|
- **AcademicProgram**: University programs and courses
|
|
- **AIKnowledgeBase**: University-specific Q&A for AI
|
|
- **ChatSession/ChatMessage**: Conversation memory system
|
|
- **DomainConfig**: Multi-domain support for universities
|
|
|
|
## 🤖 AI Configuration
|
|
|
|
### Local AI (Ollama)
|
|
1. **Install Ollama**: [https://ollama.ai](https://ollama.ai)
|
|
2. **Start Ollama service**:
|
|
```bash
|
|
ollama serve
|
|
```
|
|
3. **Pull a model**:
|
|
```bash
|
|
ollama pull llama2
|
|
```
|
|
|
|
### Environment Variables
|
|
Create a `.env.local` file:
|
|
```env
|
|
# Database
|
|
DATABASE_URL="file:./dev.db"
|
|
|
|
# AI Configuration
|
|
OLLAMA_HOST="http://localhost:11434"
|
|
OPENROUTER_API_KEY="your-api-key" # Optional fallback
|
|
|
|
# Authentication
|
|
NEXTAUTH_SECRET="your-secret-key"
|
|
NEXTAUTH_URL="http://localhost:3000"
|
|
```
|
|
|
|
## 📁 Project Structure
|
|
|
|
```
|
|
university-portal/
|
|
├── src/
|
|
│ ├── app/ # Next.js App Router
|
|
│ │ ├── api/ # API routes
|
|
│ │ │ ├── chat/ # AI chat endpoints
|
|
│ │ │ └── knowledge-base/ # Knowledge base management
|
|
│ │ ├── admin/ # Admin dashboard
|
|
│ │ └── ... # Public pages
|
|
│ ├── components/ # React components
|
|
│ │ ├── Chat/ # AI chat components
|
|
│ │ ├── Navigation/ # Navigation components
|
|
│ │ └── ... # Other components
|
|
│ └── lib/ # Utility libraries
|
|
├── prisma/ # Database schema and migrations
|
|
├── public/ # Static assets
|
|
├── docs/ # Documentation
|
|
└── scripts/ # Utility scripts
|
|
```
|
|
|
|
## 🎯 Key Features in Detail
|
|
|
|
### AI Chat System
|
|
- **Conversation Memory**: Stores chat history in database
|
|
- **University Context**: Uses university-specific knowledge base
|
|
- **User Personalization**: Adapts responses based on user role
|
|
- **Real-time Interface**: Professional chat UI with typing indicators
|
|
|
|
### Knowledge Base Management
|
|
- **Admin Interface**: Full CRUD operations for Q&A items
|
|
- **Bilingual Support**: English and Arabic content
|
|
- **Priority System**: Important items appear first in AI responses
|
|
- **Active/Inactive Toggle**: Control which items are used by AI
|
|
|
|
### Multi-University Support
|
|
- **White-Label**: Each university gets its own branded experience
|
|
- **Domain Management**: Custom domains and subdomains
|
|
- **Content Isolation**: University-specific content and assets
|
|
- **Branch Management**: Multiple campuses per university
|
|
|
|
## 🧪 Testing
|
|
|
|
### Manual Testing
|
|
1. **AI Chat**: Test conversation memory and knowledge base integration
|
|
2. **Knowledge Base**: Add/edit/delete Q&A items in admin panel
|
|
3. **Multi-University**: Test different university contexts
|
|
4. **Responsive Design**: Test on mobile and desktop
|
|
|
|
### API Testing
|
|
```bash
|
|
# Test AI chat
|
|
curl -X POST http://localhost:3000/api/chat/ollama \
|
|
-H "Content-Type: application/json" \
|
|
-d '{"message": "What are admission requirements?", "universitySlug": "default-university"}'
|
|
|
|
# Test knowledge base
|
|
curl http://localhost:3000/api/knowledge-base
|
|
```
|
|
|
|
## 🚀 Deployment
|
|
|
|
### Vercel (Recommended)
|
|
1. **Connect repository** to Vercel
|
|
2. **Set environment variables** in Vercel dashboard
|
|
3. **Deploy automatically** on push to main branch
|
|
|
|
### Other Platforms
|
|
- **Netlify**: Compatible with Next.js
|
|
- **Railway**: Good for full-stack applications
|
|
- **DigitalOcean App Platform**: Scalable deployment
|
|
|
|
## 📚 Documentation
|
|
|
|
- [AI Conversation Memory Guide](docs/AI_CONVERSATION_MEMORY_GUIDE.md)
|
|
- [AI Enhancement Summary](docs/AI_ENHANCEMENT_SUMMARY.md)
|
|
- [Developer Guide](docs/DEVELOPER_GUIDE.md)
|
|
- [User Guide](docs/USER_GUIDE.md)
|
|
|
|
## 🤝 Contributing
|
|
|
|
1. **Fork the repository**
|
|
2. **Create a feature branch**: `git checkout -b feature/amazing-feature`
|
|
3. **Commit your changes**: `git commit -m 'Add amazing feature'`
|
|
4. **Push to the branch**: `git push origin feature/amazing-feature`
|
|
5. **Open a Pull Request**
|
|
|
|
## 📄 License
|
|
|
|
This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.
|
|
|
|
## 🆘 Support
|
|
|
|
- **Issues**: Create an issue on GitHub
|
|
- **Documentation**: Check the `/docs` folder
|
|
- **AI Configuration**: See AI setup guide in documentation
|
|
|
|
## 🎉 Acknowledgments
|
|
|
|
- **Next.js Team**: For the amazing framework
|
|
- **Prisma Team**: For the excellent ORM
|
|
- **Tailwind CSS**: For the utility-first CSS framework
|
|
- **Ollama Team**: For local AI model support
|
|
|
|
---
|
|
|
|
**Built with ❤️ for modern university portals**
|