Skip to content

ansh2222949/NeonVoice-Core

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

3 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

NeonVoice-Core

Core repository for NeonAI
Local-first AI assistant with mode-based routing, tool calling, voice control, and a Flask web UI.

Python Flask Ollama Offline First

Important

NeonVoice-Core powers NeonAI with scored routing across tools, web lookup, local LLM flows, and voice assistant features.

Quick Snapshot

Area Highlights
Core AI scored routing, confidence gate, local-first pipeline
Modes casual, coding, movie, exam, voice assistant
Tools weather, notes, calculator, browser, music, web reader
Stack Flask, Ollama, Whisper, ChromaDB, GPT-SoVITS

Showcase

NeonAI primary interface

Tip

Add your next two screenshots later by replacing the placeholder URLs below.

Two-screenshot showcase block
<table>
  <tr>
    <td width="50%" align="center">
      <strong>Main Chat UI</strong>
      <br><br>
      <img src="PASTE_SCREENSHOT_1_URL_HERE" width="100%" alt="NeonVoice-Core screenshot 1" />
    </td>
    <td width="50%" align="center">
      <strong>Voice Assistant / Mode View</strong>
      <br><br>
      <img src="PASTE_SCREENSHOT_2_URL_HERE" width="100%" alt="NeonVoice-Core screenshot 2" />
    </td>
  </tr>
</table>

Overview

NeonVoice-Core powers NeonAI and routes requests through a small local AI system instead of sending everything straight to a single model.

  • direct tools for weather, notes, calculator, browser actions, system info, and music
  • scored routing between system commands, tools, web lookup, and local LLM generation
  • separate modes for chat, coding, movies, exam/RAG, and voice assistant behavior
  • local-first operation with Ollama, Whisper, and optional GPT-SoVITS

Features

Modes

  • casual: general chat with tool-first routing and optional web lookup
  • coding: coding-focused responses using a dedicated code model
  • movie: TMDB-powered movie cards, recommendations, and summaries
  • exam: PDF-only retrieval mode backed by ChromaDB
  • voice_assistant: speech input, command routing, and TTS output

Built-in tools

  • weather
  • calculator and conversions
  • system information
  • notes
  • browser and search control
  • webpage reader
  • music lookup and YouTube handoff

Quick Start

python -m venv .venv
.venv\Scripts\activate
pip install -r requirements.txt
Copy-Item .env.example .env
python server.py

Required local services:

  • Install Ollama
  • Pull llama3.2:3b
  • Pull qwen2.5-coder

Optional voice setup:

  • install GPT-SoVITS
  • set GPT_SOVITS_DIR or explicit GPT-SoVITS model paths in .env

Open http://localhost:5000

Repo Hygiene

This repo intentionally keeps local-only files out of GitHub:

  • .env and private tokens
  • user_data/ databases, uploads, notes, and runtime files
  • local embedding cache files under models/embeddings/
  • temp audio, test artifacts, and editor caches

If the local embedding cache is missing, NeonAI now falls back to the official sentence-transformers/all-MiniLM-L6-v2 model name so clones do not need your local cache committed to GitHub.

Testing

python -m pytest -q

Legacy Notes

Open the original project write-up
NeonAI V5



โšก Local-First AI System with Voice Assistant & Tool Calling

Python Flask Ollama Whisper TTS Offline

Mode-Driven Intelligence โ€ข Voice Assistant โ€ข Tool Calling โ€ข Privacy Focused


NeonAI Screenshot


๐Ÿง  What Is NeonAI?

NeonAI V5 is a fully local AI system with mode-driven intelligence, tool calling, voice assistant, and a premium UI โ€” running entirely on your machine.

โš ๏ธ This is not a chatbot wrapper.
NeonAI is an AI system โ€” with modes, rules, confidence gates, tool calling, memory, voice control, and decision pipelines. The LLM is a component, not the decision-maker.


โœจ What Makes NeonAI Different

Principle Description
๐Ÿง  System > Model AI logic governs the LLM, not the other way around
๐Ÿ”’ Privacy First Everything runs locally โ€” your data never leaves your machine
๐ŸŽฏ Mode-Driven Each mode has its own rules, memory, tools, and constraints
๐Ÿงญ Scored Router Deterministic routing (system/tool/web/LLM) with confidence + guards
๐Ÿงฉ Clarification Layer N-best routing asks when top-2 intents are close
๐Ÿง  Context Memory Router Follow-ups like โ€œpauseโ€ resolve correctly using recent context
๐Ÿ› ๏ธ Tool Calling Real tools (weather, calculator, browser, notes, music) โ€” instant, no LLM needed
๐ŸŽค Voice Control Full voice assistant with system commands, TTS, and tool access
๐Ÿ” Secure Session-isolated users, hashed passwords, safe math eval, auth-guarded endpoints
๐Ÿงช Experimental Built to explore controlled AI design, not to be a product

๐ŸŽฎ Modes

๐Ÿค– NEON AIGeneral chat with smart web search + local LLM hybrid. Calculator & weather tools built-in.
๐Ÿ’ป NEON CODECopy-paste ready code generation. Auto-switches from casual on coding intent.
๐ŸŽฌ NEON MOVIESTrending carousel, movie details with genres/director/trailer/recommendations via TMDB.
๐Ÿ“š NEON STUDYPDF-based RAG pipeline. Internet blocked. If the answer isn't in the PDF โ†’ AI refuses.
๐ŸŽค VOICE ASSISTANTFull voice control โ€” talk to Neon, use tools, control your PC. 20+ command types.

๐Ÿ’ก Each mode has isolated chat history โ€” switching modes keeps each mode's conversation separate.


๐Ÿ› ๏ธ Tool Calling

NeonAI has built-in tools that respond instantly without waiting for the LLM. Tool routing uses a Semantic Router (SentenceTransformers) for natural-language intent matching + actionability gates to reduce false triggers.

Tool calls also return structured data for the UI:

{
  "type": "tool",
  "tool": "weather",
  "action": "get_weather",
  "args": { "city": "Delhi" }
}
Tool Trigger Examples Available In
๐ŸŒค๏ธ Weather "Weather in Delhi", "Temperature in New York" Chat + Voice
๐Ÿงฎ Calculator "Calculate 25 ร— 4 + 10", "Convert 100 km to miles" Chat + Voice
๐Ÿ’ป System Info "Battery level", "RAM usage", "CPU status" Chat + Voice
๐Ÿ“ Notes "Save note: buy groceries", "Show my notes" Chat + Voice
๐ŸŒ Web Reader "Read this https://example.com" Chat + Voice
๐ŸŽต Music "Top 10 songs", "Play Drake", "Recommend some hip-hop" Chat + Voice
๐Ÿ” Browser "Search on YouTube", "Google machine learning" Chat + Voice
User: "Weather in Delhi"
  โ†’ Semantic Router detects intent โ†’ weather tool
  โ†’ Instant response: ๐ŸŒค๏ธ 28ยฐC, Partly Cloudy
  โ†’ No LLM call needed (< 1 second)

๐ŸŽค Voice Assistant

Talk to Neon using Whisper (STT) + Llama 3.2 (brain) + GPT-SoVITS (TTS).

CategoryExamples
๐Ÿ–ฅ๏ธ Apps"Open Chrome", "Launch Spotify", "Open VS Code"
๐ŸŒ Web"Open YouTube", "Go to GitHub"
๐Ÿ” Search"Search Python tutorials", "Google the news"
โ–ถ๏ธ YouTube"Play lofi music on YouTube"
๐ŸŽต Media"Pause", "Next song", "Stop music"
๐Ÿ”Š Volume"Volume up", "Set volume to 50", "Mute"
๐Ÿ’ก Brightness"Increase brightness", "Set brightness to 70"
๐Ÿ“ถ Connectivity"Turn on Bluetooth", "WiFi off", "Airplane mode"
โšก System"Shutdown", "Restart", "Lock screen", "Sleep"
๐ŸŒค๏ธ Tools"What's the weather?", "System info", "Save a note"

๐Ÿ—๏ธ Architecture

graph TD;
    Text_Query-->intent_score_router;
    Voice_Audio-->whisper_engine_STT;
    
    intent_score_router-->Is_it_a_System_or_Tool_or_Web;
    whisper_engine_STT-->Is_it_a_Command;
    
    Is_it_a_System_or_Tool_or_Web-- SYSTEM -->system_command_executor;
    Is_it_a_System_or_Tool_or_Web-- TOOL -->Execute_Local_Tool;
    Is_it_a_System_or_Tool_or_Web-- WEB -->search_adapter;
    Is_it_a_Command-- YES -->command_router_OS_Actions;
    
    Is_it_a_System_or_Tool_or_Web-- LLM -->waterfall;
    Is_it_a_Command-- NO -->waterfall;
    
    waterfall-->Need_Web_Search;
    Need_Web_Search-- YES -->search_adapter;
    Need_Web_Search-- NO -->Local_LLM_Llama3_Qwen;
    search_adapter-->Local_LLM_Llama3_Qwen;
    
    Local_LLM_Llama3_Qwen-->confidence_gate;
    confidence_gate-->Pass_Threshold;
    Pass_Threshold-- NO -->Block_Regenerate;
    Pass_Threshold-- YES -->Return_Text_TTS_GPT_SoVITS;
Loading

๐ŸŽจ Premium UI Features

  • ๐Ÿš€ Animated Splash Screen โ€” Spinning ring, progress bar, "NEON AI" reveal on startup
  • ๐ŸŽจ 15+ Neon Themes + Light/Dark mode with physics-based liquid toggle
  • ๐Ÿ’ฌ Rich Message Rendering โ€” Bold, headers, numbered lists as glass cards, rating badges
  • ๐Ÿ“Š Confidence Scoring Badges โ€” AI self-evaluates (0-100%) and displays a confidence metric badge under every answer
  • ๐ŸŽฅ Voice Customization โ€” Upload your own looping background video for the Voice UI panel
  • ๐Ÿ–ผ๏ธ Wallpaper Upload (Image/Video) โ€” Drag & drop + progress bar + remove button
  • ๐Ÿ“ฆ Upload Limits โ€” Background video up to 50MB, image up to 10MB
  • ๐ŸŽต Music Cards โ€” Rich, clickable YouTube-linked gradient cards natively rendered in chat
  • ๐Ÿ“‹ Code Blocks โ€” Syntax highlighted with copy-to-clipboard button
  • ๐ŸŒ Web Source Icons โ€” Favicon pills show which websites sourced the answer
  • ๐ŸŽฌ Movie Detail Cards โ€” Genre tags, director, runtime, trailer button, recommendation carousel
  • ๐ŸŽ™๏ธ Draggable Voice Button โ€” GSAP Draggable, saves position
  • ๐Ÿ“ฑ Fully Responsive โ€” Desktop + Mobile

๐Ÿ“‚ Project Structure

NeonAI/
โ”‚
โ”œโ”€โ”€ server.py                  # Flask backend + API routing + /health endpoint
โ”œโ”€โ”€ START_NEON.bat             # One-click launcher (Windows)
โ”œโ”€โ”€ .env                       # Environment config (NEON_SECRET, NGROK_TOKEN)
โ”‚
โ”œโ”€โ”€ brain/                     # Core AI logic
โ”‚   โ”œโ”€โ”€ waterfall.py           # Decision flow & smart routing
โ”‚   โ”œโ”€โ”€ intent_score_router.py # Deterministic scored routing + N-best clarification
โ”‚   โ”œโ”€โ”€ router_state.py        # Per-user clarification + context memory state
โ”‚   โ”œโ”€โ”€ confidence_gate.py     # Hallucination control (0-100%)
โ”‚   โ”œโ”€โ”€ gk_engine.py           # General knowledge evaluation
โ”‚   โ””โ”€โ”€ memory.py              # Session & preference memory
โ”‚
โ”œโ”€โ”€ models/                    # LLM layer
โ”‚   โ”œโ”€โ”€ local_llm.py           # Llama 3.2 (chat) + Qwen 2.5 (coding) via Ollama
โ”‚   โ”œโ”€โ”€ hybrid_llm.py          # Web + LLM fusion
โ”‚   โ””โ”€โ”€ assistant_llm.py       # Llama 3.2 (voice) via Ollama
โ”‚
โ”œโ”€โ”€ tools/                     # Tool Calling System (Semantic Router)
โ”‚   โ”œโ”€โ”€ tool_router.py         # SentenceTransformer intent detection
โ”‚   โ”œโ”€โ”€ weather.py             # Weather via Open-Meteo (free, no key)
โ”‚   โ”œโ”€โ”€ calculator.py          # Safe AST math + unit conversions
โ”‚   โ”œโ”€โ”€ system_info.py         # CPU/RAM/disk/battery/GPU
โ”‚   โ”œโ”€โ”€ notes.py               # Thread-safe CRUD notes (JSON)
โ”‚   โ”œโ”€โ”€ music.py               # YouTube Music search + curated lists
โ”‚   โ”œโ”€โ”€ web_reader.py          # Fetch & summarize URLs
โ”‚   โ””โ”€โ”€ browser_control.py     # Google/YouTube/URL opener
โ”‚   โ””โ”€โ”€ vision_offline.py      # Offline resume/image analysis via Ollama vision + PDF extraction
โ”‚
โ”œโ”€โ”€ voice/                     # Voice Assistant
โ”‚   โ”œโ”€โ”€ whisper_engine.py      # Speech-to-text (Whisper)
โ”‚   โ”œโ”€โ”€ tts_engine.py          # Text-to-speech (GPT-SoVITS) โ€” env-configurable
โ”‚   โ”œโ”€โ”€ command_router.py      # Semantic NLP โ†’ action routing (per-user state)
โ”‚   โ”œโ”€โ”€ llm_command_executor.py # System command execution (volume, apps, etc.)
โ”‚   โ”œโ”€โ”€ model_loader.py        # Voice model management โ€” env-configurable
โ”‚   โ””โ”€โ”€ reference_loader.py    # TTS reference audio โ€” env-configurable
โ”‚
โ”œโ”€โ”€ exam/                      # NEON STUDY (PDF RAG)
โ”‚   โ”œโ”€โ”€ indexer.py             # PDF โ†’ ChromaDB vector indexing
โ”‚   โ””โ”€โ”€ retriever.py           # Strict PDF-only retrieval
โ”‚
โ”œโ”€โ”€ web/                       # Web adapters
โ”‚   โ”œโ”€โ”€ search_adapter.py      # Tavily / DuckDuckGo
โ”‚   โ””โ”€โ”€ movie_adapter.py       # TMDB (genres, trailer, recs)
โ”‚
โ”œโ”€โ”€ utils/                     # Utilities
โ”‚   โ”œโ”€โ”€ auth_db.py             # SQLite auth (hashed passwords, try/finally)
โ”‚   โ”œโ”€โ”€ movie_db.py            # Movie cache (SQLite, try/finally)
โ”‚   โ”œโ”€โ”€ network.py             # Internet policy & connectivity check
โ”‚   โ””โ”€โ”€ storage_paths.py       # Centralized path management
โ”‚
โ”œโ”€โ”€ scripts/                   # Dev tools
โ”‚   โ”œโ”€โ”€ command_tester.py      # Test command routing
โ”‚   โ”œโ”€โ”€ edge_case_tester.py    # Test edge cases
โ”‚   โ”œโ”€โ”€ generate_flow.py       # Generate architecture diagram
โ”‚   โ””โ”€โ”€ movie_updater.py       # Batch movie cache updates
โ”‚   โ””โ”€โ”€ add_one_line_headers.py # Bulk-add one-line file purpose headers
โ”‚
โ”œโ”€โ”€ tests/
โ”‚   โ””โ”€โ”€ test_routing.py        # Pytest test suite
โ”‚   โ””โ”€โ”€ test_false_triggers.py # Regression tests for routing false triggers
โ”‚
โ”œโ”€โ”€ templates/
โ”‚   โ”œโ”€โ”€ index.html             # Main chat UI
โ”‚   โ””โ”€โ”€ login.html             # Authentication page
โ”‚
โ””โ”€โ”€ static/
    โ”œโ”€โ”€ app.js                 # Frontend logic (1500+ lines)
    โ”œโ”€โ”€ styles.css             # Premium styling (2500+ lines)
    โ””โ”€โ”€ wallpapers/            # Custom backgrounds

โ–ถ๏ธ Quick Start

Requirements

Software:

  • Python 3.10+
  • Ollama installed and running
  • Models: ollama pull llama3.2:3b + ollama pull qwen2.5-coder
  • (Optional) GPT-SoVITS for voice TTS

Hardware:

  • CPU: Multi-core processor (Intel i5/Ryzen 5 or better)
  • RAM: Minimum 8GB (16GB recommended)
  • GPU (Optional): NVIDIA GPU with 6GB+ VRAM for Whisper & GPT-SoVITS acceleration
  • Storage: Minimum 10GB free (SSD preferred)

Install & Run

pip install -r requirements.txt
python server.py

Or double-click START_NEON.bat

Open: http://localhost:5000

Health Check

Visit http://localhost:5000/health to verify system status (Ollama, TTS, Internet).

Optional API Keys (in Settings โš™๏ธ)

  • TMDB โ€” Movie posters, details, recommendations
  • Tavily โ€” Higher quality web search (free tier available)

Environment Variables (.env)

Variable Purpose Required
NEON_SECRET Flask session signing key โœ… (auto-generated default)
NGROK_TOKEN ngrok tunnel for remote access Optional
TTS_REF_AUDIO Custom TTS reference audio path Optional
GPT_SOVITS_GPT_MODEL GPT-SoVITS GPT model path Optional
GPT_SOVITS_SOVITS_MODEL GPT-SoVITS SoVITS model path Optional

๐Ÿ” Security

  • โœ… No eval() โ€” Math uses safe AST-based evaluation
  • โœ… Hashed passwords โ€” PBKDF2 via Werkzeug
  • โœ… Auth-guarded endpoints โ€” All write/reset routes require login
  • โœ… Session rotation โ€” Regenerated on login to prevent fixation
  • โœ… HTTPOnly cookies โ€” Session cookies not accessible via JavaScript
  • โœ… CORS locked โ€” Only localhost origins accepted
  • โœ… Per-user isolation โ€” Separate history, notes, media, and pending commands

โœ… Check Code (Sanity Checks)

Run these from the project root:

python -m compileall -q .
python -m pytest -q

๐Ÿงช Status

  • โœ… Multi-mode AI system with isolated history
  • โœ… Semantic Router tool calling (weather, calculator, notes, system, browser, music, web reader)
  • โœ… Deterministic scored routing (system/tool/web/LLM) + N-best clarification + context memory
  • โœ… Structured tool outputs (tool_data) for UI/voice
  • โœ… Voice assistant with 20+ command types and Smart Browser Control
  • โœ… Premium UI with splash screen, 15+ themes, animations, microinteractions
  • โœ… Confidence Gate scoring (0-100% evaluation metric)
  • โœ… Smart web search + local LLM hybrid
  • โœ… Movie mode with trailer, genres, recommendations
  • โœ… Code blocks syntax highlighted with copy-to-clipboard button
  • โœ… Rich markdown rendering (lists, headers, ratings)
  • โœ… Ollama lazy reconnect (auto-recovers if started late)
  • โœ… Thread-safe notes and SQLite connection management
  • โš ๏ธ Experimental โ€” Architecture locked for iteration

๐Ÿš€ Future Enhancements

  1. Vision (Realtime camera): Webcam/screenshot analysis
  2. Long-Term Vector Memory: Cross-session preference/knowledge memory
  3. Autonomous Agents: Chained multi-tool workflows (search โ†’ summarize โ†’ save to notes)

โš ๏ธ Disclaimer

This is an experimental project built for learning, research, and AI system design exploration. Not a commercial product.


๐Ÿง  Built by Ansh

B.Tech CSE



AI Systems โ€ข Voice Assistants โ€ข Tool Calling โ€ข Offline-First Architecture



"NeonAI is not about how smart the model is. It's about how controlled, safe, and purposeful AI should be."