Skip to content

About

HOPE_M4

Resources

Stars

1 star

Watchers

0 watching

Forks

Latest commit

 

History

37 Commits

Folders and files

Repository files navigation

🤖 HOPE_JARVIS_MacOS

Local AI Assistant สำหรับ macOS - AI Assistant ที่ทำงานแบบ local ด้วย Ollama พร้อมฟีเจอร์ครบครัน

🌟 Features

  • 💬 Real-time Chat - สนทนากับ AI แบบ real-time
  • 🎤 Voice Interaction - รับฟังและพูดตอบ (STT/TTS)
  • 👁️ Vision Capabilities - วิเคราะห์ภาพผ่าน webcam
  • 📚 RAG System - ค้นหาข้อมูลส่วนตัวด้วย Retrieval-Augmented Generation
  • 🏠 Fully Local - ทำงานบนเครื่องของคุณ ไม่ต้องส่งข้อมูลไปไหน
  • ⚡ Fast & Responsive - ใช้ Ollama สำหรับ inference แบบ local

🛠️ Tech Stack

Backend

  • Python 3.8+ - ภาษาโปรแกรมหลัก
  • FastAPI - Web framework สำหรับ API
  • Ollama - Local LLM inference engine
  • ChromaDB - Vector database สำหรับ RAG
  • Uvicorn - ASGI server

Frontend

  • React 18 - UI framework
  • Vite - Build tool
  • TypeScript - Type safety
  • Tailwind CSS - Styling
  • Shadcn/ui - UI components

AI Models

  • Gemma3n:e4b - ภาษาไทยและภาษาอังกฤษ
  • LLaVA - Vision capabilities
  • Whisper - Speech-to-Text
  • Coqui TTS - Text-to-Speech

📋 Prerequisites

ระบบที่รองรับ

  • macOS (แนะนำ macOS 12+)
  • Python 3.8+
  • Node.js 18+
  • Ollama (ต้องติดตั้งก่อน)

Hardware Requirements

  • RAM: อย่างน้อย 8GB (แนะนำ 16GB+)
  • Storage: อย่างน้อย 10GB สำหรับ models
  • GPU: ไม่จำเป็น แต่จะช่วยให้เร็วขึ้น

🚀 Installation

1. Clone Repository

git clone https://github.com/Prach07/HOPE_JARVIS_MacOS.git
cd HOPE_JARVIS_MacOS

2. Install Ollama

# macOS
curl -fsSL https://ollama.ai/install.sh | sh

# Start Ollama service
ollama serve

3. Pull Required Models

# Pull chat model
ollama pull gemma3n:e4b

# Pull vision model (optional)
ollama pull llava

# Pull other models as needed
ollama list

4. Setup Backend

# Navigate to backend
cd backend

# Create virtual environment
python -m venv venv

# Activate virtual environment
source venv/bin/activate  # macOS/Linux
# venv\Scripts\activate  # Windows

# Install dependencies
pip install -r requirements.txt

# Start backend server
python -m uvicorn main:app --reload --host 0.0.0.0 --port 8000

5. Setup Frontend

# Navigate to frontend
cd frontend

# Install dependencies
npm install

# Start development server
npm run dev

🎯 Usage

การใช้งานพื้นฐาน

  1. เริ่มต้นระบบ:

    # Terminal 1: Start Ollama
    ollama serve
    
    # Terminal 2: Start Backend
    cd backend && source venv/bin/activate
    python -m uvicorn main:app --reload --port 8000
    
    # Terminal 3: Start Frontend
    cd frontend
    npm run dev
  2. เปิดเว็บไซต์:

    • ไปที่ http://localhost:5173
    • เริ่มสนทนากับ AI ได้เลย!

API Endpoints

Chat Endpoint

# Non-streaming chat
curl -X POST http://localhost:8000/api/chat \
  -H "Content-Type: application/json" \
  -d '{"message": "สวัสดีครับ", "stream": false}'

# Streaming chat
curl -X POST http://localhost:8000/api/chat \
  -H "Content-Type: application/json" \
  -d '{"message": "สวัสดีครับ", "stream": true}' \
  --no-buffer

Health Check

curl http://localhost:8000/
# Response: {"status": "HOPEM4 Backend is running!"}

📁 Project Structure

HOPE_JARVIS_MacOS/
├── backend/                 # FastAPI backend
│   ├── main.py             # Main server application
│   ├── requirements.txt    # Python dependencies
│   └── venv/              # Virtual environment
├── frontend/   # React frontend
│   ├── src/
│   │   ├── components/     # React components
│   │   ├── pages/         # Page components
│   │   └── main.tsx       # App entry point
│   ├── package.json       # Node.js dependencies
│   └── vite.config.ts     # Vite configuration
├── tests/                 # Test files (future)
└── README.md             # This file

🔧 Configuration

Environment Variables

สร้างไฟล์ .env ใน backend directory:

# Ollama Configuration
OLLAMA_HOST=http://localhost:11434
OLLAMA_MODEL=gemma3n:e4b

# Server Configuration
HOST=0.0.0.0
PORT=8000

# CORS Configuration
FRONTEND_URL=http://localhost:5173

Model Configuration

เปลี่ยน model ใน backend/main.py:

class ChatRequest(BaseModel):
    message: str
    model: str = "gemma3n:e4b"  # เปลี่ยนเป็น model ที่ต้องการ
    stream: bool = True

🧪 Testing

Test Backend

# Test root endpoint
curl http://localhost:8000/

# Test chat endpoint
curl -X POST http://localhost:8000/api/chat \
  -H "Content-Type: application/json" \
  -d '{"message": "ทดสอบ", "stream": false}'

Test Frontend

  • เปิด http://localhost:5173
  • ทดสอบการส่งข้อความ
  • ตรวจสอบ streaming response

🐛 Troubleshooting

ปัญหาที่พบบ่อย

  1. Ollama ไม่ทำงาน:

    # ตรวจสอบ Ollama service
    ollama list
    
    # Restart Ollama
    pkill ollama
    ollama serve
  2. Model ไม่พบ:

    # ดู models ที่มี
    ollama list
    
    # Pull model ที่ต้องการ
    ollama pull gemma3n:e4b
  3. Port ถูกใช้งาน:

    # ตรวจสอบ port ที่ใช้งาน
    lsof -i :8000
    lsof -i :5173
    
    # Kill process ที่ใช้ port
    kill -9 <PID>
  4. Memory ไม่พอ:

    • ปิด applications อื่นๆ
    • ลด model size
    • เพิ่ม RAM

🔮 Roadmap

Phase 1: Core Features ✅

  • Basic chat interface
  • Ollama integration
  • Streaming responses
  • Thai language support

Phase 2: Voice & Vision 🚧

  • Speech-to-Text (STT)
  • Text-to-Speech (TTS)
  • Webcam integration
  • Image analysis

Phase 3: RAG System 📚

  • Document ingestion
  • Vector database setup
  • Semantic search
  • Context-aware responses

Phase 4: Advanced Features 🚀

  • Multi-modal conversations
  • File upload support
  • Conversation history
  • Custom model fine-tuning

🤝 Contributing

  1. Fork the repository
  2. Create feature branch (git checkout -b feature/amazing-feature)
  3. Commit changes (git commit -m 'feat: add amazing feature')
  4. Push to branch (git push origin feature/amazing-feature)
  5. Open Pull Request

📄 License

This project is licensed under the MIT License - see the LICENSE file for details.

🙏 Acknowledgments

  • Ollama - สำหรับ local LLM inference
  • Google - สำหรับ Gemma models
  • FastAPI - สำหรับ backend framework
  • React - สำหรับ frontend framework
  • Tailwind CSS - สำหรับ styling

📞 Support

หากมีปัญหาหรือคำถาม:

  • สร้าง Issue ใน GitHub repository
  • ตรวจสอบ Troubleshooting section
  • อ่าน documentation ของแต่ละ component

Made with ❤️ for local AI enthusiasts

About

HOPE_M4

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages