Skip to content

abhinendra9792/Nexus-App

Β 
Β 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

15 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation



Coder GIF
AI Animation

Harness the power of Local LLMs + Intelligent Web Scraping β€” All on Your Machine


Features Quick Start Architecture Product Scraper API Docs


🌟 Project Overview

Coding

Nexus AI is a cutting-edge, privacy-first AI assistant that combines the power of locally-hosted Large Language Models (via Ollama) with intelligent web navigation using Playwright automation.

Unlike cloud-based AI assistants, Nexus AI keeps your data on your machine while still providing real-time web intelligence when needed.


🎯 Key Highlights

  • 🧠 Local AI Power β€” Mistral LLM via Ollama
  • 🌐 Smart Web Search β€” DuckDuckGo + Playwright
  • πŸ›’ Product Scraper β€” Table & Gallery Views
  • πŸ”’ Privacy First β€” 100% Local Processing
  • ⚑ Lightning Fast β€” 3-5 second responses
  • 🎨 Modern UI β€” ChatGPT-style interface


✨ Features

🧠 Local LLM Integration

βœ… Ollama Mistral for instant offline answers
βœ… 3-5 second response times
βœ… Zero data leaves your machine
βœ… Full conversation context support

🌐 Intelligent Web Search

βœ… CAPTCHA-free DuckDuckGo integration
βœ… Playwright-powered browser automation
βœ… Smart result prioritization & scoring
βœ… Real-time web data aggregation

πŸ›’ Product Scraper Module

βœ… Table View with sortable columns
βœ… Gallery View with product images
βœ… CSV export functionality
βœ… Batch processing (configurable)

πŸ’‘ Smart Prioritization Engine

πŸ“… Exact Date:     +3000 score boost
πŸ“° Today/Recent:   +1000 score boost
πŸ“š Wikipedia Range: +5000 supreme priority
🧊 Old Content:    Penalty system applied

🎨 Tech Stack

Tech Stack



Technology Purpose Version
Python Python Backend & AI Logic 3.10+
Flask Flask REST API Server 3.x
Playwright Playwright Browser Automation 1.48
BS4 BeautifulSoup HTML Parsing 4.12
Ollama Ollama Local LLM Runtime Latest
HTML5 HTML5 Frontend UI 5
CSS3 CSS3 Styling 3
JS JavaScript Frontend Logic ES6+

πŸ—οΈ Architecture

flowchart TB
    subgraph USER["πŸ‘€ User Interface"]
        A[Web Browser]
    end

    subgraph FRONT["🎨 Frontend Layer"]
        B[index.html β€” ChatGPT-Style UI]
        C[script.js β€” Frontend Logic]
        D[styles.css β€” Modern Styling]
    end

    subgraph BACK["βš™οΈ Backend Layer"]
        E[Flask API Server β€” app.py]
        F[Agent Core β€” agent_step3.py]
        G[Web Scraper β€” web_scraper.py]
    end

    subgraph AI["🧠 AI Layer"]
        H[Ollama Runtime]
        I[Mistral LLM]
    end

    subgraph WEB["🌐 Web Layer"]
        J[Playwright Browser]
        K[DuckDuckGo Search]
        L[Website Scraping]
    end

    subgraph STORE["πŸ’Ύ Storage"]
        M[agent_state/]
        N[JSON Batch Files]
    end

    A --> B
    B --> C
    C --> E
    E --> F
    F --> H
    H --> I
    F --> G
    G --> J
    J --> K
    J --> L
    F --> M
    M --> N

    style USER fill:#001a1a,stroke:#00f5ff,color:#00f5ff
    style FRONT fill:#001a0d,stroke:#00ff88,color:#00ff88
    style BACK fill:#1a1500,stroke:#ffd700,color:#ffd700
    style AI fill:#0f0020,stroke:#a855f7,color:#a855f7
    style WEB fill:#001a1a,stroke:#00f5ff,color:#00f5ff
    style STORE fill:#1a0010,stroke:#ff006e,color:#ff006e
Loading

πŸ”„ Request Flow

sequenceDiagram
    autonumber
    participant U as πŸ‘€ User
    participant F as 🎨 Frontend
    participant B as βš™οΈ Backend
    participant L as 🧠 Local LLM
    participant W as 🌐 Web Search

    U->>F: Ask Question
    F->>B: POST /ask
    B->>L: Query Mistral

    alt Confident Answer
        L-->>B: Return Local Answer
    else Needs Web Data
        B->>W: Playwright Search
        W-->>B: Search Results
        B->>B: Apply Scoring Algorithm
    end

    B-->>F: JSON Response
    F-->>U: Render Answer + Sources
Loading

πŸš€ Quick Start

⚑ One-Click Start (Windows)

Script Description
🟒 START_NEXUS_FIXED.bat Full Setup β€” Starts Ollama + Backend + Opens Browser
πŸ”΅ START_BACKEND_FIXED.bat Backend Only β€” Manual frontend opening
🟣 START_NEXUS_AI.ps1 PowerShell β€” Alternative starter
# Simply double-click any .bat file to start!

πŸ› οΈ Manual Installation

πŸ“‹ Click to expand Step-by-Step Setup Guide

Prerequisites

# 1. Install Ollama β€” https://ollama.ai

# 2. Pull the Mistral model
ollama pull mistral

# 3. Clone the repository
git clone https://github.com/AshmitThakur23/Local-AI-Web-Navigator.git
cd Local-AI-Web-Navigator

# 4. Install Python dependencies
pip install -r requirements.txt

# 5. Install Playwright browsers
playwright install chrome

Running the Application

# Terminal 1: Start Ollama
ollama serve

# Terminal 2: Start Backend
python backend/app.py

# Terminal 3: Serve Frontend (Optional)
cd frontend
python -m http.server 8000
# Visit: http://localhost:8000

Health Check

curl http://localhost:5000/health
# Response: {"status":"ok","message":"Nexus AI Backend is running"}

πŸ“ Project Structure

πŸ“¦ Local-AI-Web-Navigator/
β”‚
β”œβ”€β”€ 🎨 frontend/
β”‚   β”œβ”€β”€ index.html              # Main ChatGPT-style interface
β”‚   β”œβ”€β”€ script.js               # Frontend logic & API calls
β”‚   β”œβ”€β”€ styles.css              # Modern dark theme styling
β”‚   β”œβ”€β”€ setup.html              # Setup wizard page
β”‚   └── _redirects              # Netlify routing config
β”‚
β”œβ”€β”€ βš™οΈ backend/
β”‚   β”œβ”€β”€ app.py                  # Flask REST API server
β”‚   β”œβ”€β”€ agent_step3.py          # Core AI agent & scoring logic
β”‚   β”œβ”€β”€ web_scraper.py          # BeautifulSoup web scraper
β”‚   β”œβ”€β”€ test_mistral_speed.py   # Performance testing
β”‚   └── agent_state/            # Saved scrape batches
β”‚
β”œβ”€β”€ πŸš€ Starters/
β”‚   β”œβ”€β”€ START_NEXUS_FIXED.bat       # One-click full start
β”‚   β”œβ”€β”€ START_BACKEND_FIXED.bat     # Backend only
β”‚   β”œβ”€β”€ START_NEXUS_AI.ps1          # PowerShell starter
β”‚   └── start_all_services.py       # Python launcher
β”‚
β”œβ”€β”€ πŸ“– Documentation/
β”‚   β”œβ”€β”€ DEPLOYMENT_GUIDE.md
β”‚   β”œβ”€β”€ USAGE_GUIDE.md
β”‚   β”œβ”€β”€ PRODUCT_SCRAPER_GUIDE.md
β”‚   β”œβ”€β”€ NVIDIA_GPU_CONFIG.md
β”‚   └── ... (more guides)
β”‚
β”œβ”€β”€ requirements.txt            # Python dependencies
β”œβ”€β”€ netlify.toml                # Deployment config
└── README.md                   # You are here! πŸ“

πŸ›’ Product Scraper

🎯 Scrape Products Like a Pro!

The Product Scraper module allows you to extract structured product data from the web with support for multiple view modes.

πŸ“Š View Modes

πŸ“‹ Table View

http://localhost:5000/table_view.html

βœ… Sortable columns
βœ… CSV export
βœ… Clean data layout

πŸ–ΌοΈ Gallery View

http://localhost:5000/table_view.html

βœ… 4-5 images per product
βœ… Visual browsing
βœ… Quick overview

πŸ“¦ JSON Cards

http://localhost:5000/scraper.html

βœ… Raw JSON data
βœ… Developer friendly
βœ… API integration

πŸ”„ Scraper Flow

flowchart LR
    A[πŸ” Search Query] --> B[Flask API]
    B --> C[DuckDuckGo]
    C --> D[Web Scraper]
    D --> E[Batch Processing]
    E --> F[JSON Files]
    F --> G{View Mode}
    G --> H[πŸ“‹ Table]
    G --> I[πŸ–ΌοΈ Gallery]
    G --> J[πŸ“¦ Cards]

    style A fill:#001a0d,stroke:#00ff88,color:#00ff88
    style F fill:#1a1500,stroke:#ffd700,color:#ffd700
    style G fill:#0f0020,stroke:#a855f7,color:#a855f7
    style H fill:#001a1a,stroke:#00f5ff,color:#00f5ff
    style I fill:#001a1a,stroke:#00f5ff,color:#00f5ff
    style J fill:#001a1a,stroke:#00f5ff,color:#00f5ff
Loading

πŸ’‘ Example Usage

// API Call
POST /scrape_products
{
    "query": "top 20 laptops under 60000",
    "limit": 20,
    "batch_size": 5
}

// Response
{
    "success": true,
    "total_items": 20,
    "total_batches": 4,
    "batches": [...]
}

πŸ”Œ API Reference

πŸ“‘ Available Endpoints

Method Endpoint Description Request Body
GET /health Health check β€”
POST /ask Ask AI question { "question": "..." }
POST /scrape_products Scrape products { "query": "...", "limit": 20 }
POST /shutdown Graceful shutdown β€”

πŸ“ Response Format

{
    "answer": "Your detailed answer here...",
    "method": "local | web",
    "sources": [
        {
            "title": "Source Title",
            "url": "https://...",
            "score": 5000
        }
    ]
}

βš™οΈ Configuration

πŸ”§ Click to expand Customization Options

Frontend Configuration

// frontend/script.js
const API_URL = 'http://localhost:5000';  // Change if using different port

Backend Configuration

# backend/agent_step3.py
OLLAMA_API = "http://127.0.0.1:11434/api/generate"
MODEL_NAME = "mistral"
channel = "chrome"      # or "msedge"
headless = False        # True for headless mode

Port Configuration

# backend/app.py
app.run(host="0.0.0.0", port=5001)  # Change port here

πŸ“ˆ Performance

Metric Value
⚑ Local LLM Response 3-5 seconds
🌐 Web Search Response 10-20 seconds
πŸ’Ύ Memory Usage ~500MB (with browser)
πŸ”„ Concurrent Requests Supported
πŸ–₯️ GPU Acceleration NVIDIA CUDA (optional)
xychart-beta
    title "Response Time by Query Type (seconds)"
    x-axis ["Local LLM", "Web Search", "Product Scraper", "Health Check"]
    y-axis "Seconds" 0 --> 25
    bar [4, 15, 20, 1]
Loading

🧠 Scoring Algorithm

The intelligent scoring system prioritizes relevant and recent information:

Priority Score Boost Trigger
⭐⭐⭐⭐⭐ +5000 Wikipedia + Historical range (e.g., "2003–2006")
⭐⭐⭐⭐ +3000 Exact date match (e.g., "Oct 10, 2025")
⭐⭐⭐ +1000 Today / Recent information
⭐⭐ +500 Wikipedia general articles
⭐ 0 Standard results
🚫 -200 to -800 Old / outdated content penalty
graph LR
    Q([Query Input]) --> D{Date Signal?}
    D -->|Exact date found| E1[+3000 Boost]
    D -->|Today or recent| E2[+1000 Boost]
    D -->|Historical range| E3[+5000 Boost]
    D -->|Wikipedia match| E4[+500 Boost]
    D -->|Old content| E5[-200 to -800]
    E1 & E2 & E3 & E4 & E5 --> F[Final Score]
    F --> G([Top Ranked Results])

    style Q fill:#001a0d,stroke:#00ff88,color:#00ff88
    style D fill:#1a1500,stroke:#ffd700,color:#ffd700
    style E3 fill:#001a1a,stroke:#00f5ff,color:#00f5ff
    style E1 fill:#001a1a,stroke:#00f5ff,color:#00f5ff
    style E5 fill:#1a0000,stroke:#ff006e,color:#ff006e
    style G fill:#001a0d,stroke:#00ff88,color:#00ff88
Loading

πŸ§ͺ Usage Examples

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚  🌀️ Today's Information                                         β”‚
β”‚  ❓ "What's the weather today in Hyderabad?"                    β”‚
β”‚  βœ… Boosted by +1000 (recent/today priority)                    β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚  πŸ“… Exact Date Query                                            β”‚
β”‚  ❓ "What's happening on October 10, 2025?"                     β”‚
β”‚  βœ… +3000 exact date match priority                             β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚  πŸ“š Historical Range                                            β”‚
β”‚  ❓ "What happened between 2003 and 2006?"                      β”‚
β”‚  βœ… Wikipedia prioritized with +5000                            β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚  🧠 General Knowledge                                           β”‚
β”‚  ❓ "How does photosynthesis work?"                             β”‚
β”‚  βœ… Mistral answers locally β€” fast & private                    β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

πŸ”§ Troubleshooting

πŸ› Click to expand Common Issues and Solutions

Backend Won't Start

# Check if port 5000 is free
netstat -ano | findstr :5000

# Reinstall dependencies
pip install -r requirements.txt

# Start Ollama first
ollama serve

Frontend Can't Connect

// Verify API_URL in frontend/script.js
const API_URL = 'http://localhost:5000';
// Make sure backend window shows:
// "Running on http://localhost:5000"

Chrome Won't Open

# Install Playwright browsers
playwright install chrome
# Or use Edge β€” set channel="msedge" in agent_step3.py

System Check

python test_setup.py

🀝 Contributing

flowchart LR
    A[🍴 Fork Repo] --> B[🌿 Create Branch]
    B --> C[πŸ’» Make Changes]
    C --> D[βœ… Test]
    D --> E[πŸ“€ Pull Request]
    E --> F[πŸŽ‰ Merged!]

    style A fill:#001a0d,stroke:#00ff88,color:#00ff88
    style C fill:#1a1500,stroke:#ffd700,color:#ffd700
    style E fill:#001a1a,stroke:#00f5ff,color:#00f5ff
    style F fill:#001a0d,stroke:#00ff88,color:#00ff88
Loading
  1. Fork the repository
  2. Create a feature branch β€” git checkout -b feature/amazing-feature
  3. Commit your changes β€” git commit -m 'Add amazing feature'
  4. Push to the branch β€” git push origin feature/amazing-feature
  5. Open a Pull Request

πŸ“œ License & Notice

Copyright Β© 2024 Ashmit Thakur. All rights reserved.

This project β€” Nexus AI: Local AI Web Navigator β€” was created by:
  Ashmit Thakur
  GitHub : https://github.com/AshmitThakur23
  Repo   : https://github.com/AshmitThakur23/Local-AI-Web-Navigator

Original Creation Date: October 2024

Licensed under the MIT License β€” see LICENSE file for details.

If you fork, clone, or use any part of this code, you MUST:
  1. Give credit to the original author
  2. Include this NOTICE
  3. Include the LICENSE file
  4. Not claim this as your own original work

Violation of these terms may result in DMCA takedown requests.

πŸ‘¨β€πŸ’» Authors

Ashmit Thakur
Ashmit Thakur
Abhinendra
Abhinendra
Sriram
Sriram
Prajitha
Prajitha Parani
Ansh Gupta
Ansh Gupta
---

⭐ Show Your Support

If you found this project helpful, please give it a ⭐!


Stars Forks Issues


πŸš€ Built with ❀️ for Intelligent, Privacy-Focused AI Assistance


About

A local AI assistant built with Ollama and Playwright that provides fast answers, web search, and product scraping while keeping all data private.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages

  • Python 46.9%
  • JavaScript 18.5%
  • HTML 18.3%
  • CSS 11.5%
  • PowerShell 3.3%
  • Batchfile 1.5%