🤖 AI Chatbot for Personal Portfolio

Your website now has a fully functional AI chatbot that runs locally on your machine using Ollama. No API costs, no privacy concerns, completely free!

✨ Features

  • 🏠 Runs Locally: Uses Ollama - no cloud APIs needed
  • 💰 Zero Cost: Completely free, no API charges
  • 🔒 Private: All data stays on your machine
  • 🎯 Trained on You: Knows everything from your resume
  • 💬 Natural Conversations: Powered by Llama 3.2
  • 📱 Mobile Responsive: Works on all devices
  • 🌓 Theme Aware: Matches your site’s dark/light mode
  • ⚡ Fast: Local processing, no network latency

🚀 Quick Start (3 Steps)

1. Install Ollama

# macOS (your system)
brew install ollama

# Or download from: https://ollama.ai/download

2. Run Setup Script

./start-chatbot.sh

This will:

  • Check if Ollama is installed
  • Start the Ollama service
  • Download the base model (llama3.2:3b, ~2GB)
  • Create your custom model with your resume data
  • Verify everything is working

3. Start Your Website

# Option 1: Python (recommended)
python3 -m http.server 8000

# Option 2: PHP
php -S localhost:8000

# Option 3: Node.js
npx http-server -p 8000

Then open: http://localhost:8000

💬 Try These Questions

Once the chatbot is running, try asking:

About Skills

  • “What programming languages does Darya know?”
  • “Tell me about Darya’s machine learning experience”
  • “What tools and technologies is Darya familiar with?”
  • “Does Darya have cloud computing experience?”

About Research

  • “What research is Darya doing?”
  • “Tell me about her work with Graph Neural Networks”
  • “What’s Darya’s research focus?”
  • “Has Darya published any research?”

About Projects

  • “What projects has Darya built?”
  • “Tell me about the quantitative trading project”
  • “What was the Monte Carlo simulator?”
  • “Show me Darya’s C++ projects”

About Experience

  • “Where does Darya work?”
  • “What’s Darya’s role at FSU?”
  • “Tell me about her DevOps experience”
  • “What leadership positions has Darya held?”

About Education

  • “Where does Darya go to school?”
  • “What’s Darya’s GPA?”
  • “What courses has Darya taken?”
  • “What honors has Darya received?”

General

  • “How can I contact Darya?”
  • “Is Darya looking for internships?”
  • “What languages does Darya speak?”
  • “Tell me about Darya’s interests”

🔧 Manual Setup (If Script Doesn’t Work)

Step 1: Install Ollama

brew install ollama

Step 2: Start Ollama Service

ollama serve

Keep this terminal open.

Step 3: Download Base Model

# In a new terminal
ollama pull llama3.2:3b

Step 4: Create Custom Model

# Make sure you're in the project directory
ollama create darya-assistant -f Modelfile

Step 5: Test the Model

ollama run darya-assistant

Try asking: “What are Darya’s technical skills?”

Type /bye to exit.

Step 6: Start Website

python3 -m http.server 8000

📊 Model Information

Current Model: Llama 3.2 (3B)

  • Size: ~2GB download
  • RAM Required: 4GB minimum, 8GB recommended
  • Speed: Very fast responses (1-2 seconds)
  • Quality: Excellent for Q&A tasks
  • Context Window: 4096 tokens

Alternative Models

If you want different performance characteristics:

Faster & Lighter

ollama pull phi3:3.8b
ollama create darya-assistant -f Modelfile

Better Quality

ollama pull llama3.1:8b
ollama create darya-assistant -f Modelfile

Best Quality (Slower)

ollama pull llama3.1:70b
ollama create darya-assistant -f Modelfile

🎨 Customization

Update Your Information

Edit Modelfile to add or change information about yourself. Then rebuild:

ollama create darya-assistant -f Modelfile

Change Model Parameters

In Modelfile, adjust:

  • PARAMETER temperature 0.7 - Higher = more creative (0.0-1.0)
  • PARAMETER num_ctx 4096 - Context window size
  • PARAMETER top_p 0.9 - Response diversity

Modify Chatbot Appearance

Edit chatbot.css to change:

  • Colors and gradients
  • Button styles
  • Chat bubble appearance
  • Animations

Change Chatbot Position

In chatbot.css, find .chat-widget:

.chat-widget {
    bottom: 2rem;  /* Distance from bottom */
    right: 2rem;   /* Distance from right */
    /* Change to left: 2rem; for left side */
}

🔍 Troubleshooting

Chatbot Says “Ollama not running”

Solution 1: Start Ollama service

ollama serve

Solution 2: Check if it’s already running

ps aux | grep ollama

Solution 3: Restart Ollama

killall ollama
ollama serve

Model Not Found Error

# List available models
ollama list

# If darya-assistant is missing, create it
ollama create darya-assistant -f Modelfile

Slow Responses

Option 1: Use a smaller model

ollama pull llama3.2:3b

Option 2: Reduce max tokens in chatbot.js:

maxTokens: 300  // Instead of 500

Option 3: Close other applications to free RAM

CORS Errors

Start Ollama with CORS enabled:

OLLAMA_ORIGINS=* ollama serve

Connection Refused

Check if Ollama is running:

curl http://localhost:11434/api/tags

If not working, restart Ollama:

ollama serve

📈 Performance Tips

Speed Optimization

  1. Use quantized models (smaller, faster):
    ollama pull llama3.2:3b-q4_0
    
  2. Reduce context window in Modelfile:
    PARAMETER num_ctx 2048
    
  3. Lower temperature for faster, more focused responses:
    PARAMETER temperature 0.5
    

Memory Optimization

  • Close unnecessary applications
  • Use smaller models (phi3:3.8b)
  • Reduce num_ctx parameter

🌐 Deployment Options

Option 1: Local Only (Current)

  • Runs on your machine
  • Perfect for demos and development
  • No hosting costs

Option 2: Deploy to Server

  1. Get a VPS (DigitalOcean, AWS, etc.)
  2. Install Ollama on server
  3. Update chatbot.js endpoint:
    ollamaEndpoint: 'https://your-server.com:11434'
    
  4. Add authentication and rate limiting

Option 3: Hybrid Approach

  • Use local LLM for development
  • Switch to OpenAI for production
  • Change provider in chatbot.js

💰 Cost Comparison

Local LLM (Ollama) - Current Setup

  • Setup: $0
  • Running: $0
  • Electricity: ~$0.01/hour
  • Total: FREE ✅

Cloud API (OpenAI)

  • GPT-3.5: ~$0.002 per 1K tokens
  • GPT-4: ~$0.03 per 1K tokens
  • Estimated: $10-50/month for moderate traffic

🔐 Privacy & Security

Local LLM Benefits

✅ All conversations stay on your machine ✅ No data sent to third parties ✅ Complete control over the model ✅ No API key management needed ✅ Works offline

For Production

If deploying publicly, consider:

  • Rate limiting to prevent abuse
  • Input sanitization
  • Logging for monitoring
  • Authentication for sensitive info

📚 Additional Resources

🆘 Getting Help

Check Status

# Is Ollama running?
ollama ps

# List models
ollama list

# Test API
curl http://localhost:11434/api/tags

View Logs

# macOS
tail -f ~/Library/Logs/Ollama/server.log

Test Model Directly

ollama run darya-assistant

Browser Console

Press F12 and check Console tab for errors

🎯 Next Steps

  1. ✅ Install Ollama
  2. ✅ Run ./start-chatbot.sh
  3. ✅ Start web server
  4. ✅ Test the chatbot
  5. ⬜ Customize responses (edit Modelfile)
  6. ⬜ Adjust styling (edit chatbot.css)
  7. ⬜ Deploy to production (optional)

📝 Files Overview

  • chatbot.js - Main chatbot logic and Ollama integration
  • chatbot.css - Chatbot styling and animations
  • Modelfile - Your custom model definition with resume data
  • start-chatbot.sh - Automated setup script
  • setup-local-llm.md - Detailed setup instructions
  • CHATBOT-README.md - This file

🎉 You’re All Set!

Your AI chatbot is ready to answer questions about your skills, experience, and projects. It runs completely locally with no API costs!

Questions? Check the troubleshooting section or test the model directly with ollama run darya-assistant.


Status: ✅ Ready to use Cost: $0 (completely free) Privacy: 100% local Speed: Fast (1-2 second responses)