Skip to content

Latest commit

 

History

History
77 lines (53 loc) · 1.7 KB

File metadata and controls

77 lines (53 loc) · 1.7 KB

Next-Ollama-Chat

![Next-Ollama-Chat]

A streamlined bridge between your Next.js frontend and local Ollama LLM server, enabling real-time AI chat capabilities with minimal latency.

✨ Features

  • Real-time streaming - See AI responses as they're generated
  • Local processing - All data stays on your machine
  • Model switching - Easily swap between any Ollama model
  • Lightweight - Minimal overhead with efficient proxying

🚀 Getting Started

Prerequisites

Installation

  1. Clone the repository

    git clone https://github.com/sattarrasouli/ollama-chat-stream.git
    cd ollama-chat-stream
  2. Install dependencies

    npm install
    # or
    yarn install
    # or
    pnpm install
  3. Start the development server

    npm run dev
    # or
    yarn dev
    # or
    pnpm dev
  4. Open http://localhost:3000 in your browser

🔧 Configuration

By default, the application connects to Ollama at http://localhost:11434. If your Ollama instance is running elsewhere, update the URL in app/api/chat/route.ts.

📋 API Usage

Send a POST request to /api/chat with the following JSON structure:

{
  "messages": [
    { "role": "system", "content": "You are a helpful assistant." },
    { "role": "user", "content": "Hello, how are you?" }
  ],
  "model": "tinyllama" // Optional, defaults to "tinyllama"
}

📄 License

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

🙏 Acknowledgments