Skip to content

cmoney113/acaplus

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

20 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸš€ ChatPrime Pro

Python NiceGUI License AI Models

A powerful, multi-model AI chat client with advanced features

Seamlessly switch between Gemini, GPT, and Groq models with integrated tools

Features β€’ Installation β€’ Usage β€’ Models β€’ Tools β€’ Configuration


πŸ“‘ Table of Contents


🌟 Features

πŸ€– Multi-Model Support

  • 14 AI Models across 3 providers
  • Real-time model switching
  • Provider-specific optimizations
  • Smart caching system
  • Local model hot-swapping via Ollama with model wizard
  • GPU/CPU memory monitoring and signed model verification
  • Safety sandbox for untrusted models
  • Privacy-preserving inference option
  • Certified model registry with verification

πŸ› οΈ Integrated Tools

  • DuckDuckGo search integration
  • URL content fetching
  • Image search capabilities
  • Google Calendar integration

🧠 Smart Memory

  • Vector-based chat memory
  • Semantic conversation retrieval
  • FAISS-powered search
  • Context-aware responses

🎨 Modern Interface

  • NiceGUI-based Web UI
  • Session management
  • Custom instructions
  • Responsive design
  • Theme switcher with light/dark/indigo/teal options
  • Live transcription pane
  • Conversation mode with STT/TTS
  • Voice command processor
  • Model-assisted command correction with local models
  • Context-aware translation memory
  • Multi-engine STT framework
  • Multiple TTS engine options
  • Cross-lingual TTS with voice cloning, pronunciation tuning and emotion preservation
  • Local model support via Ollama with dynamic loading and wizard
  • Conference mode UI with bandwidth slider, dynamic interpreter panel, and load monitor
  • Conference orchestration with per-participant models, resource balancer, and dynamic scaling
  • Flexible translation routing with per-language model assignments, priority options, and quantization presets
  • Hybrid translation pipeline with Ollama β†’ Groq β†’ Cloud fallback and fusion arbitration
  • Language-aware STT with Ollama-based detection, code-switch recognition and dialect adaptation
  • Secure WebRTC core with model-assisted encryption, local noise cancellation and GPU resource sharing
  • Model behavior sandbox and certified registry
  • Live transcription pane
  • Conversation mode with STT/TTS
  • Voice command processor
  • Multi-engine STT framework
  • Multiple TTS engine options

πŸ› οΈ Installation

Prerequisites

Python 3.8+
nicegui

Install Dependencies

pip install -r requirements.txt
πŸ“¦ Full Requirements List
nicegui
faiss-cpu
numpy
sentence-transformers
googletrans==4.0.0rc1
pyperclip
aiohttp
openai
groq
duckduckgo-search
requests
beautifulsoup4
google-auth
google-api-python-client
google-generativeai
ollama
psutil
aiortc

API Keys Setup

⚠️ Important: Update the API keys in the source code before running

GOOGLE_API_KEY = "your_google_api_key_here"
OPENAI_API_KEY = "your_openai_api_key_here"
GROQ_API_KEY = "your_groq_api_key_here"

πŸš€ Quick Start

  1. Clone the repository

    git clone <repository-url>
    cd chatprime-pro
  2. Install dependencies

    pip install -r requirements.txt
  3. Configure API keys (see Configuration)

  4. Run the application

    python -m chatprime_nicegui

πŸ’¬ Usage

Basic Chat

Simply type your message and press Enter or click Send.

Tool Commands

Command Function Example
d: DuckDuckGo search d: latest AI news
fetch: Fetch URL content fetch: https://example.com
img: Image search img: cute cats

Tool Checkboxes

Enable tools via toolbar checkboxes for automatic activation:

  • βœ… DDG Text: Web search
  • βœ… Fetch URL: Content retrieval
  • βœ… DDG Image: Image search
  • βœ… Calendar: Event management
  • βœ… Translate: Auto-translation

πŸ€– Supported Models

πŸ”₯ Gemini Models

Model Speed Capability
⚑ Gemini 1.5 Flash Ultra Fast General
✨ Gemini Pro Fast Advanced
✨ Gemini 2.5 Pro Medium Premium
⚑ Gemini 2.5 Flash Ultra Fast Latest
✨ Gemini 2.0 Pro Medium Cutting Edge

🧠 OpenAI Models

Model Speed Capability
🧠 GPT-4o Fast Latest
🧠 GPT-4o Mini Ultra Fast Efficient
🧠 GPT-4 Turbo Medium Advanced
🧠 GPT-3.5 Turbo Fast Reliable

πŸ”₯ Groq Models

Model Speed Capability
πŸ”₯ Llama-3.1 70B Fast Large Context
πŸ”₯ Llama-3.1 8B Ultra Fast Efficient
πŸ”₯ Mixtral 8x7B Fast Mixture of Experts
πŸ”₯ Gemma 7B Ultra Fast Compact

πŸ”§ Integrated Tools

πŸ” Web Search (DuckDuckGo)

# Automatic web search
d: latest Python updates

# Returns formatted results with titles and URLs

🌐 URL Fetcher

# Fetch and parse web content
fetch: https://example.com/article

# Extracts clean text content (max 8000 chars)

πŸ–ΌοΈ Image Search

# Find images via DuckDuckGo
img: mountain landscapes

# Returns image URLs for display

πŸ“… Google Calendar

# Natural language event creation
"Schedule meeting with John tomorrow at 2 PM"

# AI parses and creates calendar event

🌍 Translation

# Auto-detect and translate to Spanish
# Optimized for MedellΓ­n Spanish dialect

πŸ“ Explain Term (Local Model)

# Ask the local model to explain a term
"Explain recursion using local model"

πŸŽ™οΈ Speech Features

  • Conversation Mode with start/stop controls
  • Live Transcription Pane showing STT results
  • Split Transcription View with side-by-side translation
  • Cultural Notes Overlay for translated text
  • Speaker Thumbnails highlighting the active speaker
  • Voice Command Processor for natural commands
  • Model-Assisted Command Correction using local models
  • Explain Term command handled locally
  • Multi-Engine STT with Whisper, Vosk, Wav2Vec2 and SpeechBrain
  • Advanced Audio Processing with VAD and noise reduction
  • Intelligent STT Fusion combining engine results
  • Language-Aware STT detects language and dialect via Ollama and handles code-switching
  • Modular TTS Engines with Kokoro, Coqui and HTTP options
  • Cross-Lingual TTS supporting voice cloning and emotion preservation
  • Conference Mode with bandwidth control, dynamic interpreter panel and load monitor
  • Conference Orchestration enabling per-participant models, resource balancing and dynamic scaling
  • WebRTC Core with model-assisted encryption and noise cancellation
  • Local Model Acceleration via Ollama-Groq hybrid processing with chunk streaming and a quantization-aware pipeline
  • Model Safety Layer with privacy-preserving inference
  • Validation Framework providing a model compatibility matrix, hot-reload stress tests and cross-language accuracy metrics
  • Voice Command Processor for natural commands
  • Multi-Engine STT with Whisper, Vosk, Wav2Vec2 and SpeechBrain
  • Advanced Audio Processing with VAD and noise reduction
  • Intelligent STT Fusion combining engine results
  • Modular TTS Engines with Kokoro, Coqui and HTTP options

βš™οΈ Configuration

πŸ”‘ API Keys

Edit the source code to add your API keys:

# Required API Keys
GOOGLE_API_KEY = "AIza..."     # For Gemini models
OPENAI_API_KEY = "sk-proj..."  # For GPT models  
GROQ_API_KEY = "gsk_..."       # For Groq models

πŸ“… Google Calendar Setup

  1. Create a service account in Google Cloud Console
  2. Download the JSON credentials file
  3. Set environment variable:
    export GOOGLE_APPLICATION_CREDENTIALS="/path/to/credentials.json"

πŸŽ›οΈ Custom Instructions

Access via Toolbar β†’ Manage Instr to:

  • Create custom system prompts
  • Activate/deactivate instructions
  • Manage multiple instruction sets

πŸ“± Interface

🎨 Main Components

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚ [Model Selector] [Tools] [Settings]     β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚ Sessions    β”‚ Chat Display              β”‚
β”‚ β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚ β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚
β”‚ β”‚ sess_1  β”‚ β”‚ β”‚ User: Hello           β”‚ β”‚
β”‚ β”‚ sess_2  β”‚ β”‚ β”‚ Assistant: Hi there!  β”‚ β”‚
β”‚ β”‚ sess_3  β”‚ β”‚ β”‚                       β”‚ β”‚
β”‚ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β”‚ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β”‚
β”‚             β”‚ [Input Field] [Send]      β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

🎯 Context Menu

Right-click any message for:

  • Copy Message: Copy to clipboard
  • Regenerate: Retry last user message

πŸ” Search & Memory

🧠 Vector Memory System

  • Embedding Model: all-MiniLM-L6-v2
  • Storage: FAISS vector database
  • Retrieval: Top-K semantic search
  • Persistence: Automatic conversation logging

πŸ“Š Memory Features

# Automatic conversation embedding
memory.add('user', 'Your message')
memory.add('assistant', 'AI response')

# Semantic retrieval
relevant_context = memory.retrieve('query', k=3)

πŸ“… Calendar Integration

πŸ—“οΈ Event Creation Flow

  1. Natural Input: "Meeting with Sarah tomorrow 3 PM"
  2. AI Parsing: Extracts structured data
  3. Confirmation Dialog: Review and edit details
  4. Calendar Creation: Adds to Google Calendar

πŸ“‹ Event Fields

  • Summary: Event title
  • Start/End: ISO datetime format
  • Location: Venue information
  • Description: Additional details

🌐 Translation

πŸ”„ Auto-Translation Features

  • Language Detection: Automatic source detection
  • Target Language: Spanish (MedellΓ­n dialect)
  • Fallback: Returns original on errors
  • Integration: Google Translate API
  • Local Models: Optional transformers-based translation
  • Per-Language Models: Assign custom models by target language
  • Routing Priority: Choose local vs cloud per language
  • Quantization Presets: int8/int4 for efficient local models
  • Quantization-Aware Pipeline optimizes runtime based on model settings
  • Translation Memory: Remembers prior translations for context
  • Language-Aware STT for automatic dialect adaptation
  • Hybrid Pipeline: Ollama β†’ Groq β†’ Cloud with model fusion
  • Dynamic Model Selector for choosing translation providers

πŸ’Ύ Session Management

πŸ“ Session Features

  • Auto-Save: Continuous session persistence
  • Format: JSON with metadata
  • Storage: chat_sessions/ directory
  • Loading: Click session name to restore

πŸ—‚οΈ Session Structure

{
  "messages": [
    {
      "role": "user",
      "content": "Hello world"
    },
    {
      "role": "assistant", 
      "content": "Hi there!"
    }
  ]
}

πŸ”§ Troubleshooting

❗ Common Issues

API Key Errors

Problem: Authentication failed Solution: Verify API keys are correctly set in source code

# Check your keys are valid and have proper format
GOOGLE_API_KEY = "AIza..."  # Must start with AIza
OPENAI_API_KEY = "sk-..."  # Must start with sk-
GROQ_API_KEY = "gsk_..."   # Must start with gsk_
Import Errors

Problem: ModuleNotFoundError Solution: Install missing dependencies

pip install faiss-cpu sentence-transformers nicegui
Calendar Issues

Problem: Calendar integration fails Solution: Set up Google service account properly

  1. Enable Calendar API in Google Cloud Console
  2. Create service account with Calendar access
  3. Download JSON credentials
  4. Set GOOGLE_APPLICATION_CREDENTIALS environment variable

πŸ“ Logging

Check chatprime.log for detailed error information:

tail -f chatprime.log

βœ… Validation Framework

Use the validation tools to ensure all models work correctly:

  • Compatibility Matrix: run quick prompts against every model to verify response and measure latency.
  • Hot-Reload Stress Test: repeatedly refresh installed models to confirm stability when switching.
  • Cross-Language Accuracy: evaluate translation quality across languages using similarity metrics.

πŸ“„ License

MIT License

Copyright (c) 2024 ChatPrime Pro

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND...

πŸŽ‰ Ready to chat with AI? Fire up ChatPrime Pro and explore the future!

Made with ❀️ for the AI community

About

initial commit of chatprime code

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages