Skip to content

krishnagkmit/ollama-code-reviewer

 
 

Repository files navigation

🧠 Ollama Code Reviewer (Local ChatGPT for Code Analysis)

This project allows you to run a ChatGPT-style code reviewer locally using Ollama and React. It lets you paste custom CSS and JavaScript code and receive a structured, Excel-style analysis output.


📦 Tech Stack


⚙️ Prerequisites

  1. Install Node.js (v16 or higher)
  2. Install Ollama
    • Mac (Homebrew):
      brew install ollama
    • Windows:
      1. Go to https://ollama.com/download
      2. Download the .exe installer and run it
      3. After installation, open Command Prompt and run:
        ollama --version
        to confirm it's working
    • Ubuntu/Linux:
      1. Download the Linux .deb package from https://ollama.com/download
      2. Then install it via terminal:
        sudo apt install ./ollama_<version>_amd64.deb
      3. Confirm install:
        ollama --version

🚀 Getting Started

1. Clone the Repo

git clone https://github.com/dhruvildave22/ollama-code-reviewer.git
cd ollama-code-reviewer

2. Install Dependencies

npm install

3. Start a Local Model with Ollama

First you have to start ollama

ollama serve

Now you can use codellama, mistral, or any other local model. This project assumes codellama.

ollama run codellama

This starts the Ollama server at http://localhost:11434.

💡 You can switch models by changing the model value in App.jsx.

To list available models:

ollama list

To pull others (optional):

ollama pull mistral  # Optional: only if you want to test other models

4. Start the App

npm run dev

Visit http://localhost:5173 in your browser.


✨ Features

  • Paste CSS and JS code to analyze customization logic
  • Uses local LLM to output structured, Excel-like insights
  • Table-formatted output that's easily readable
  • Visual summary panel for copied code
  • Styled with Tailwind (light, calm theme)
  • Loading animation with disabled state

📤 Prompt Optimization

The app sends this prompt to Ollama:

You are a code reviewer. Analyze the following HTML, CSS, or JavaScript code and respond using this Markdown table format only:

| Column | Entry |
|--------|-------|
| Color/Font Changes? | ✅ Yes — ... |
| UI Text/Message Changes? | ❌ No |
...and so on.

Functionality Description: A short summary of what the code does.

This ensures clean and parseable markdown tables.


🧪 API Example

await fetch("http://localhost:11434/api/generate", {
  method: "POST",
  headers: { "Content-Type": "application/json" },
  body: JSON.stringify({
    model: "codellama",
    prompt: "<your full prompt here>",
    stream: false,
  })
})

💡 Suggestions

  • Use stream: false to ensure full table rendering
  • Run ollama run codellama in a separate terminal
  • Tailor prompt output to match your table logic

📷 Project Screenshots

screencapture-localhost-5173-2025-04-24-17_34_16


📄 License

MIT License — feel free to modify and build upon it.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 95.3%
  • HTML 2.6%
  • CSS 2.1%