🎉 Complete AI-Enhanced University Portal - Ready for Production

 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!
This commit is contained in:
Krikorios
2025-07-20 08:26:25 +04:00
parent 868c9b252c
commit aa459f4bd6
159 changed files with 25019 additions and 16607 deletions
+127
View File
@@ -0,0 +1,127 @@
import { PrismaClient } from '@prisma/client';
const prisma = new PrismaClient();
async function createTestUniversity() {
try {
// Check if test university already exists
const existingUniversity = await prisma.university.findUnique({
where: { slug: 'test-university' }
});
if (existingUniversity) {
console.log('✅ Test university already exists');
return existingUniversity;
}
// Create test university
const university = await prisma.university.create({
data: {
slug: 'test-university',
name: 'Test University',
shortName: 'TU',
domain: 'test-university.localhost',
subdomain: 'test',
branding: {
primaryColor: '#2563eb',
secondaryColor: '#1e40af',
logo: '/images/logo.png',
favicon: '/favicon.ico',
theme: 'modern'
},
contact: {
email: 'info@test-university.edu',
phone: '+1-555-0123',
address: '123 University Ave, Test City, TC 12345',
website: 'https://test-university.edu'
},
features: {
chatbot: true,
multiLanguage: true,
onlineApplications: true,
studentPortal: true,
courseManagement: true,
contentManagement: true
},
ai: {
provider: 'openrouter',
model: 'anthropic/claude-3.5-sonnet',
apiKey: process.env.OPENROUTER_API_KEY || '',
knowledgeBase: true,
chatHistory: true,
languageSupport: ['en', 'ar']
},
status: 'ACTIVE'
}
});
console.log('✅ Test university created successfully:');
console.log(` Name: ${university.name}`);
console.log(` Slug: ${university.slug}`);
console.log(` Domain: ${university.domain}`);
console.log(` Status: ${university.status}`);
// Create some sample content
await prisma.universityContent.create({
data: {
universityId: university.id,
contentType: 'ABOUT',
title: 'About Test University',
titleAr: 'عن الجامعة التجريبية',
content: 'Test University is a leading institution dedicated to academic excellence and innovation.',
contentAr: 'الجامعة التجريبية هي مؤسسة رائدة مكرسة للتميز الأكاديمي والابتكار.',
isPublished: true
}
});
// Create sample programs
await prisma.academicProgram.create({
data: {
universityId: university.id,
title: 'Bachelor of Computer Science',
titleAr: 'بكالوريوس علوم الحاسوب',
description: 'A comprehensive program in computer science and software engineering.',
descriptionAr: 'برنامج شامل في علوم الحاسوب وهندسة البرمجيات.',
level: 'UNDERGRADUATE',
duration: '4 years',
fees: '$15,000 per year',
entryRequirements: 'High school diploma with mathematics and science',
isActive: true
}
});
// Create sample knowledge base entries
await prisma.aIKnowledgeBase.create({
data: {
universityId: university.id,
category: 'Admissions',
question: 'How do I apply for admission?',
questionAr: 'كيف أتقدم للقبول؟',
answer: 'You can apply online through our website or contact our admissions office.',
answerAr: 'يمكنك التقديم عبر الإنترنت من خلال موقعنا الإلكتروني أو الاتصال بمكتب القبول.',
priority: 1,
isActive: true
}
});
console.log('✅ Sample content created successfully');
return university;
} catch (error) {
console.error('❌ Error creating test university:', error);
throw error;
} finally {
await prisma.$disconnect();
}
}
// Run the script
createTestUniversity()
.then(() => {
console.log('🎉 Test university setup completed!');
process.exit(0);
})
.catch((error) => {
console.error('💥 Setup failed:', error);
process.exit(1);
});
+262
View File
@@ -0,0 +1,262 @@
#!/bin/bash
# University Portal Production Deployment Script
# This script sets up the application for production deployment
set -e
echo "🚀 Starting University Portal Production Deployment..."
# Check if running as root
if [ "$EUID" -eq 0 ]; then
echo "❌ Please don't run this script as root"
exit 1
fi
# Check if Node.js is installed
if ! command -v node &> /dev/null; then
echo "❌ Node.js is not installed. Please install Node.js 18+ first."
exit 1
fi
# Check if npm is installed
if ! command -v npm &> /dev/null; then
echo "❌ npm is not installed. Please install npm first."
exit 1
fi
echo "✅ Node.js and npm are installed"
# Install dependencies
echo "📦 Installing dependencies..."
npm ci --only=production
# Build the application
echo "🔨 Building the application..."
npm run build
# Set up environment variables
echo "⚙️ Setting up environment variables..."
if [ ! -f .env.local ]; then
cat > .env.local << EOF
# Production Environment Configuration
NODE_ENV=production
DATABASE_URL=file:./prod.db
JWT_SECRET=$(openssl rand -base64 32)
OLLAMA_HOST=http://localhost:11434
OLLAMA_MODEL=llama2
NEXT_PUBLIC_APP_URL=https://your-domain.com
EOF
echo "✅ Created .env.local file"
else
echo "⚠️ .env.local already exists, skipping creation"
fi
# Set up database
echo "🗄️ Setting up database..."
npx prisma migrate deploy
npx prisma generate
# Seed database if needed
read -p "Do you want to seed the database with sample data? (y/N): " -n 1 -r
echo
if [[ $REPLY =~ ^[Yy]$ ]]; then
echo "🌱 Seeding database..."
npx prisma db seed
fi
# Set up PM2 for process management (if available)
if command -v pm2 &> /dev/null; then
echo "📋 Setting up PM2 process manager..."
cat > ecosystem.config.js << EOF
module.exports = {
apps: [{
name: 'university-portal',
script: 'npm',
args: 'start',
instances: 'max',
exec_mode: 'cluster',
env: {
NODE_ENV: 'production',
PORT: 3000
},
error_file: './logs/err.log',
out_file: './logs/out.log',
log_file: './logs/combined.log',
time: true
}]
}
EOF
mkdir -p logs
echo "✅ PM2 configuration created"
else
echo "⚠️ PM2 not found. Consider installing it for production process management:"
echo " npm install -g pm2"
fi
# Create systemd service (if running as root or with sudo)
if [ "$EUID" -eq 0 ]; then
echo "🔧 Creating systemd service..."
cat > /etc/systemd/system/university-portal.service << EOF
[Unit]
Description=University Portal
After=network.target
[Service]
Type=simple
User=$SUDO_USER
WorkingDirectory=$(pwd)
ExecStart=/usr/bin/npm start
Restart=always
RestartSec=10
Environment=NODE_ENV=production
[Install]
WantedBy=multi-user.target
EOF
systemctl daemon-reload
systemctl enable university-portal
echo "✅ Systemd service created and enabled"
fi
# Set up Nginx configuration (if available)
if command -v nginx &> /dev/null; then
echo "🌐 Setting up Nginx configuration..."
cat > nginx.conf << EOF
server {
listen 80;
server_name your-domain.com www.your-domain.com;
location / {
proxy_pass http://localhost:3000;
proxy_http_version 1.1;
proxy_set_header Upgrade \$http_upgrade;
proxy_set_header Connection 'upgrade';
proxy_set_header Host \$host;
proxy_set_header X-Real-IP \$remote_addr;
proxy_set_header X-Forwarded-For \$proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto \$scheme;
proxy_cache_bypass \$http_upgrade;
}
# Static files
location /_next/static {
alias $(pwd)/.next/static;
expires 1y;
add_header Cache-Control "public, immutable";
}
# Security headers
add_header X-Frame-Options "SAMEORIGIN" always;
add_header X-XSS-Protection "1; mode=block" always;
add_header X-Content-Type-Options "nosniff" always;
add_header Referrer-Policy "no-referrer-when-downgrade" always;
add_header Content-Security-Policy "default-src 'self' http: https: data: blob: 'unsafe-inline'" always;
}
EOF
echo "✅ Nginx configuration created"
echo "📝 Copy nginx.conf to /etc/nginx/sites-available/ and enable the site"
fi
# Set up SSL with Let's Encrypt (if certbot is available)
if command -v certbot &> /dev/null; then
echo "🔒 Setting up SSL certificate..."
echo "📝 Run the following command to get SSL certificate:"
echo " sudo certbot --nginx -d your-domain.com -d www.your-domain.com"
fi
# Create startup script
cat > start.sh << 'EOF'
#!/bin/bash
# University Portal Startup Script
echo "🚀 Starting University Portal..."
# Check if Ollama is running
if ! curl -s http://localhost:11434/api/tags > /dev/null; then
echo "⚠️ Ollama is not running. Starting Ollama..."
ollama serve &
sleep 5
fi
# Start the application
if command -v pm2 &> /dev/null; then
pm2 start ecosystem.config.js
pm2 save
pm2 startup
else
npm start
fi
echo "✅ University Portal started successfully!"
EOF
chmod +x start.sh
# Create maintenance script
cat > maintenance.sh << 'EOF'
#!/bin/bash
# University Portal Maintenance Script
echo "🔧 University Portal Maintenance Mode"
case "$1" in
backup)
echo "📦 Creating database backup..."
cp prod.db "backup-$(date +%Y%m%d-%H%M%S).db"
echo "✅ Backup created"
;;
update)
echo "🔄 Updating application..."
git pull
npm ci --only=production
npm run build
npx prisma migrate deploy
npx prisma generate
echo "✅ Application updated"
;;
logs)
echo "📋 Showing logs..."
if command -v pm2 &> /dev/null; then
pm2 logs university-portal
else
tail -f logs/combined.log
fi
;;
restart)
echo "🔄 Restarting application..."
if command -v pm2 &> /dev/null; then
pm2 restart university-portal
else
pkill -f "npm start" || true
npm start &
fi
echo "✅ Application restarted"
;;
*)
echo "Usage: $0 {backup|update|logs|restart}"
exit 1
;;
esac
EOF
chmod +x maintenance.sh
echo ""
echo "🎉 Production deployment setup completed!"
echo ""
echo "📋 Next steps:"
echo "1. Update .env.local with your production settings"
echo "2. Configure your domain in nginx.conf"
echo "3. Set up SSL certificate with Let's Encrypt"
echo "4. Start the application: ./start.sh"
echo "5. Monitor logs: ./maintenance.sh logs"
echo ""
echo "🔧 Maintenance commands:"
echo " ./maintenance.sh backup - Create database backup"
echo " ./maintenance.sh update - Update application"
echo " ./maintenance.sh logs - View logs"
echo " ./maintenance.sh restart - Restart application"
echo ""
echo "🌐 Access your application at: http://localhost:3000"
echo "📚 Documentation: README.md"
+236
View File
@@ -0,0 +1,236 @@
import { PrismaClient } from '@prisma/client';
const prisma = new PrismaClient();
const sampleKnowledgeBase = [
// Admissions Category
{
category: 'Admissions',
question: 'What are the admission requirements for international students?',
questionAr: 'ما هي متطلبات القبول للطلاب الدوليين؟',
answer: 'International students need: 1) High school diploma with minimum GPA 3.0, 2) English proficiency (IELTS 6.0+ or TOEFL 80+), 3) Valid passport, 4) Financial documentation showing ability to pay tuition, 5) Completed application form with all supporting documents. Contact admissions@university.edu for detailed requirements.',
answerAr: 'يحتاج الطلاب الدوليون إلى: 1) شهادة الثانوية العامة بمعدل تراكمي لا يقل عن 3.0، 2) إتقان اللغة الإنجليزية (IELTS 6.0+ أو TOEFL 80+)، 3) جواز سفر صالح، 4) وثائق مالية تثبت القدرة على دفع الرسوم الدراسية، 5) استمارة طلب مكتملة مع جميع المستندات الداعمة. اتصل بـ admissions@university.edu للحصول على المتطلبات التفصيلية.',
priority: 3,
isActive: true
},
{
category: 'Admissions',
question: 'When is the application deadline for the fall semester?',
questionAr: 'متى هو الموعد النهائي للتقديم للفصل الدراسي الخريفي؟',
answer: 'The application deadline for the fall semester is May 15th. Early decision applications are due by March 1st. We recommend submitting your application at least 2 weeks before the deadline to ensure all documents are processed on time.',
answerAr: 'الموعد النهائي للتقديم للفصل الدراسي الخريفي هو 15 مايو. طلبات القبول المبكر مستحقة في 1 مارس. نوصي بتقديم طلبك قبل أسبوعين على الأقل من الموعد النهائي لضمان معالجة جميع المستندات في الوقت المحدد.',
priority: 3,
isActive: true
},
{
category: 'Admissions',
question: 'How much is the application fee?',
questionAr: 'كم رسوم التقديم؟',
answer: 'The application fee is $50 USD for international students and $25 USD for domestic students. This fee is non-refundable and must be paid online when submitting your application.',
answerAr: 'رسوم التقديم 50 دولار أمريكي للطلاب الدوليين و 25 دولار أمريكي للطلاب المحليين. هذه الرسوم غير قابلة للاسترداد ويجب دفعها عبر الإنترنت عند تقديم طلبك.',
priority: 2,
isActive: true
},
// Programs Category
{
category: 'Programs',
question: 'What engineering programs do you offer?',
questionAr: 'ما هي برامج الهندسة التي تقدمونها؟',
answer: 'We offer: Computer Engineering, Mechanical Engineering, Electrical Engineering, Civil Engineering, Chemical Engineering, and Biomedical Engineering. All programs are ABET-accredited and include hands-on laboratory work, industry internships, and capstone projects.',
answerAr: 'نقدم: هندسة الحاسوب، الهندسة الميكانيكية، الهندسة الكهربائية، الهندسة المدنية، الهندسة الكيميائية، وهندسة الطب الحيوي. جميع البرامج معتمدة من ABET وتشمل العمل المخبري العملي، التدريب الصناعي، ومشاريع التخرج.',
priority: 2,
isActive: true
},
{
category: 'Programs',
question: 'What is the duration of undergraduate programs?',
questionAr: 'ما هي مدة برامج البكالوريوس؟',
answer: 'Most undergraduate programs are 4 years (8 semesters) with 120-130 credit hours required for graduation. Some programs may take longer if you choose to study part-time or need to complete prerequisite courses.',
answerAr: 'معظم برامج البكالوريوس مدتها 4 سنوات (8 فصول دراسية) مع 120-130 ساعة معتمدة مطلوبة للتخرج. قد تستغرق بعض البرامج وقتًا أطول إذا اخترت الدراسة بدوام جزئي أو تحتاج إلى إكمال دورات متطلبات مسبقة.',
priority: 2,
isActive: true
},
{
category: 'Programs',
question: 'Do you offer online programs?',
questionAr: 'هل تقدمون برامج عبر الإنترنت؟',
answer: 'Yes, we offer several online programs including: Master of Business Administration (MBA), Master of Computer Science, and various certificate programs. Online students have access to the same resources and support as on-campus students.',
answerAr: 'نعم، نقدم عدة برامج عبر الإنترنت تشمل: ماجستير إدارة الأعمال (MBA)، ماجستير علوم الحاسوب، وبرامج شهادات متنوعة. الطلاب عبر الإنترنت لديهم إمكانية الوصول إلى نفس الموارد والدعم مثل الطلاب في الحرم الجامعي.',
priority: 2,
isActive: true
},
// Campus Life Category
{
category: 'Campus Life',
question: 'What housing options are available for students?',
questionAr: 'ما خيارات السكن المتاحة للطلاب؟',
answer: 'We offer on-campus dormitories, apartment-style housing, and off-campus housing assistance. On-campus housing includes meal plans and is guaranteed for first-year students. Off-campus housing options include university-affiliated apartments and private rentals.',
answerAr: 'نقدم مساكن داخل الحرم الجامعي، سكن على طراز الشقق، ومساعدة السكن خارج الحرم الجامعي. السكن داخل الحرم الجامعي يشمل خطط الوجبات ومضمون لطلاب السنة الأولى. خيارات السكن خارج الحرم الجامعي تشمل شقق مرتبطة بالجامعة وإيجارات خاصة.',
priority: 2,
isActive: true
},
{
category: 'Campus Life',
question: 'What sports and recreation facilities are available?',
questionAr: 'ما المرافق الرياضية والترفيهية المتاحة؟',
answer: 'Our campus features: Olympic-size swimming pool, fitness center with modern equipment, tennis courts, basketball courts, soccer field, running track, and indoor sports complex. We also offer intramural sports, fitness classes, and outdoor adventure programs.',
answerAr: 'يتميز حرمنا الجامعي بـ: مسبح بحجم أولمبي، مركز لياقة بدنية بمعدات حديثة، ملاعب تنس، ملاعب كرة سلة، ملعب كرة قدم، مضمار جري، ومجمع رياضي داخلي. نقدم أيضًا رياضات داخلية، دروس لياقة بدنية، وبرامج مغامرات في الهواء الطلق.',
priority: 1,
isActive: true
},
{
category: 'Campus Life',
question: 'What student clubs and organizations are available?',
questionAr: 'ما النوادي والمنظمات الطلابية المتاحة؟',
answer: 'We have over 100 student organizations including: academic clubs, cultural organizations, professional societies, volunteer groups, and special interest clubs. Students can also start new organizations with faculty sponsorship.',
answerAr: 'لدينا أكثر من 100 منظمة طلابية تشمل: نوادي أكاديمية، منظمات ثقافية، جمعيات مهنية، مجموعات تطوعية، ونوادي اهتمامات خاصة. يمكن للطلاب أيضًا إنشاء منظمات جديدة برعاية أعضاء هيئة التدريس.',
priority: 1,
isActive: true
},
// Financial Aid Category
{
category: 'Financial Aid',
question: 'What scholarships are available for international students?',
questionAr: 'ما المنح الدراسية المتاحة للطلاب الدوليين؟',
answer: 'We offer: Merit-based scholarships (up to $10,000/year), Academic Excellence scholarships, Leadership scholarships, and Country-specific scholarships. All international students are automatically considered for merit-based scholarships.',
answerAr: 'نقدم: منح دراسية على أساس الجدارة (حتى 10,000 دولار/سنة)، منح التميز الأكاديمي، منح القيادة، ومنح خاصة بالدول. جميع الطلاب الدوليين مؤهلون تلقائيًا للمنح الدراسية على أساس الجدارة.',
priority: 3,
isActive: true
},
{
category: 'Financial Aid',
question: 'How much is the tuition for international students?',
questionAr: 'كم الرسوم الدراسية للطلاب الدوليين؟',
answer: 'Tuition for international students is $25,000 USD per academic year. This includes: tuition, health insurance, and student services fees. Additional costs include: housing ($8,000-12,000/year), meals ($3,000-5,000/year), and personal expenses.',
answerAr: 'الرسوم الدراسية للطلاب الدوليين 25,000 دولار أمريكي لكل عام دراسي. هذا يشمل: الرسوم الدراسية، التأمين الصحي، ورسوم الخدمات الطلابية. التكاليف الإضافية تشمل: السكن (8,000-12,000 دولار/سنة)، الوجبات (3,000-5,000 دولار/سنة)، والمصروفات الشخصية.',
priority: 3,
isActive: true
},
{
category: 'Financial Aid',
question: 'Can international students work on campus?',
questionAr: 'هل يمكن للطلاب الدوليين العمل في الحرم الجامعي؟',
answer: 'Yes, international students can work up to 20 hours per week on campus during the academic year and full-time during breaks. Popular on-campus jobs include: library assistant, research assistant, dining services, and administrative support.',
answerAr: 'نعم، يمكن للطلاب الدوليين العمل حتى 20 ساعة في الأسبوع في الحرم الجامعي خلال العام الدراسي وبدوام كامل خلال العطلات. الوظائف الشائعة في الحرم الجامعي تشمل: مساعد مكتبة، مساعد بحث، خدمات الطعام، والدعم الإداري.',
priority: 2,
isActive: true
},
// Research Category
{
category: 'Research',
question: 'What research opportunities are available for undergraduate students?',
questionAr: 'ما فرص البحث المتاحة لطلاب البكالوريوس؟',
answer: 'Undergraduate students can participate in: faculty-led research projects, summer research programs, independent study projects, and research internships. We also offer research grants and travel funding for students presenting at conferences.',
answerAr: 'يمكن لطلاب البكالوريوس المشاركة في: مشاريع بحثية بقيادة أعضاء هيئة التدريس، برامج البحث الصيفية، مشاريع الدراسة المستقلة، وتدريبات البحث. نقدم أيضًا منح بحثية وتمويل سفر للطلاب الذين يقدمون في المؤتمرات.',
priority: 2,
isActive: true
},
{
category: 'Research',
question: 'What are the main research areas at the university?',
questionAr: 'ما مجالات البحث الرئيسية في الجامعة؟',
answer: 'Our main research areas include: Artificial Intelligence and Machine Learning, Renewable Energy, Biomedical Engineering, Environmental Science, Cybersecurity, and Sustainable Development. We have state-of-the-art research facilities and collaborate with industry partners.',
answerAr: 'تشمل مجالات البحث الرئيسية لدينا: الذكاء الاصطناعي والتعلم الآلي، الطاقة المتجددة، هندسة الطب الحيوي، العلوم البيئية، الأمن السيبراني، والتنمية المستدامة. لدينا مرافق بحثية متطورة ونتعاون مع شركاء الصناعة.',
priority: 2,
isActive: true
}
];
async function seedKnowledgeBase() {
try {
console.log('🌱 Starting knowledge base seeding...');
// Get the first university (or create one if none exists)
let university = await prisma.university.findFirst();
if (!university) {
console.log('No university found, creating a default university...');
university = await prisma.university.create({
data: {
slug: 'default-university',
name: 'Default University',
shortName: 'DU',
domain: 'default-university.localhost',
subdomain: 'default',
branding: {
primaryColor: '#2563eb',
secondaryColor: '#1e40af',
logo: '/images/logo.png',
favicon: '/favicon.ico',
theme: 'modern'
},
contact: {
email: 'info@default-university.edu',
phone: '+1-555-0123',
address: '123 University Ave, Default City, DC 12345',
website: 'https://default-university.edu'
},
features: {
chatbot: true,
multiLanguage: true,
onlineApplications: true,
studentPortal: true,
courseManagement: true,
contentManagement: true
},
ai: {
provider: 'openrouter',
model: 'anthropic/claude-3.5-sonnet',
apiKey: '',
knowledgeBase: true,
chatHistory: true,
languageSupport: ['en', 'ar']
},
status: 'ACTIVE'
}
});
console.log('✅ Default university created');
}
// Clear existing knowledge base items for this university
await prisma.aIKnowledgeBase.deleteMany({
where: { universityId: university.id }
});
console.log('🗑️ Cleared existing knowledge base items');
// Create new knowledge base items
const createdItems = await Promise.all(
sampleKnowledgeBase.map(item =>
prisma.aIKnowledgeBase.create({
data: {
...item,
universityId: university.id
}
})
)
);
console.log(`✅ Successfully created ${createdItems.length} knowledge base items`);
// Display summary
const categories = [...new Set(sampleKnowledgeBase.map(item => item.category))];
console.log('\n📊 Knowledge Base Summary:');
console.log(`- Total Items: ${createdItems.length}`);
console.log(`- Categories: ${categories.join(', ')}`);
console.log(`- Bilingual Items: ${sampleKnowledgeBase.filter(item => item.questionAr && item.answerAr).length}`);
console.log(`- High Priority Items: ${sampleKnowledgeBase.filter(item => item.priority === 3).length}`);
console.log('\n🎉 Knowledge base seeding completed successfully!');
console.log('\n📝 Next Steps:');
console.log('1. Start the development server: npm run dev');
console.log('2. Navigate to /admin/knowledge-base to manage the knowledge base');
console.log('3. Test the AI chat with conversation memory');
console.log('4. Customize the knowledge base for your specific university');
} catch (error) {
console.error('❌ Error seeding knowledge base:', error);
} finally {
await prisma.$disconnect();
}
}
seedKnowledgeBase();
+49
View File
@@ -0,0 +1,49 @@
#!/bin/bash
# Evolution Images Setup Script
# This script helps you set up the campus evolution images
echo "🎓 University Evolution Images Setup"
echo "====================================="
echo ""
echo "Please copy your 4 campus images to the following locations:"
echo ""
# Create the evolution directory if it doesn't exist
mkdir -p public/images/evolution
echo "📁 Target Directory: public/images/evolution/"
echo ""
echo "📸 Required Image Files:"
echo ""
echo "1. 🏛️ Traditional Campus"
echo " File: public/images/evolution/traditional-campus.jpg"
echo " Description: Classic university with brick buildings (TRITON HALL image)"
echo ""
echo "2. 💻 Digital Transition"
echo " File: public/images/evolution/transitional-campus.jpg"
echo " Description: Students walking towards university with digital signs"
echo ""
echo "3. 🏢 Modern Smart Campus"
echo " File: public/images/evolution/modern-campus.jpg"
echo " Description: Modern campus with digital displays and blue schematics"
echo ""
echo "4. 🚀 Future-Ready University"
echo " File: public/images/evolution/futuristic-campus.jpg"
echo " Description: Futuristic building with extensive blue digital displays"
echo ""
echo "📋 Instructions:"
echo "1. Copy your 4 campus images to the university-portal/public/images/evolution/ directory"
echo "2. Rename them to match the filenames above"
echo "3. Ensure they are in JPG or PNG format"
echo "4. Recommended size: 1200x800 pixels or larger"
echo ""
echo "✅ Once you've added the images, the evolution showcase will automatically display them!"
echo ""
echo "🌐 Access the evolution showcase at: http://localhost:3000/evolution"
+63
View File
@@ -0,0 +1,63 @@
#!/bin/bash
echo "🚀 Setting up Ollama for University Portal AI Chat"
# Check if Ollama is already installed
if command -v ollama &> /dev/null; then
echo "✅ Ollama is already installed"
else
echo "📥 Installing Ollama..."
# Detect OS and install Ollama
if [[ "$OSTYPE" == "darwin"* ]]; then
# macOS
echo "Installing Ollama for macOS..."
curl -fsSL https://ollama.ai/install.sh | sh
elif [[ "$OSTYPE" == "linux-gnu"* ]]; then
# Linux
echo "Installing Ollama for Linux..."
curl -fsSL https://ollama.ai/install.sh | sh
elif [[ "$OSTYPE" == "msys" ]] || [[ "$OSTYPE" == "cygwin" ]]; then
# Windows
echo "For Windows, please install Ollama manually from: https://ollama.ai/download"
echo "After installation, run: ollama serve"
exit 1
else
echo "❌ Unsupported operating system: $OSTYPE"
echo "Please install Ollama manually from: https://ollama.ai/download"
exit 1
fi
fi
# Start Ollama service
echo "🔄 Starting Ollama service..."
ollama serve &
# Wait a moment for the service to start
sleep 3
# Check if Ollama is running
if curl -s http://localhost:11434/api/tags &> /dev/null; then
echo "✅ Ollama service is running"
else
echo "❌ Failed to start Ollama service"
echo "Please try running 'ollama serve' manually"
exit 1
fi
# Pull the default model (llama2)
echo "📦 Pulling Llama2 model (this may take a while)..."
ollama pull llama2
echo "🎉 Setup complete! Ollama is ready to use with the University Portal AI Chat."
echo ""
echo "To use the AI chat:"
echo "1. Make sure Ollama is running: ollama serve"
echo "2. Start the development server: npm run dev"
echo "3. Click the AI chat button in the bottom-right corner of the portal"
echo ""
echo "Available commands:"
echo "- Start Ollama: ollama serve"
echo "- Stop Ollama: pkill ollama"
echo "- List models: ollama list"
echo "- Pull a model: ollama pull <model-name>"
-26
View File
@@ -1,26 +0,0 @@
import dotenv from 'dotenv';
// Load environment variables from .env.local
dotenv.config({ path: '.env.local' });
import UTASChatBot from '../src/lib/chatbot';
async function runTests() {
const apiKey = process.env.OPENROUTER_API_KEY;
if (!apiKey) {
console.error('Missing OPENROUTER_API_KEY in environment');
process.exit(1);
}
const bot = new UTASChatBot(apiKey);
console.log('=== English Test ===');
const engResponse = await bot.generateResponse('Hello, what scholarships do you offer?');
console.log(engResponse);
console.log('\n=== Arabic Test ===');
const arResponse = await bot.generateResponse('ما هي المنح المتاحة؟');
console.log(arResponse);
}
runTests().catch(err => {
console.error('Error during chatbot tests:', err);
process.exit(1);
});