This project is a local AI assistant designed to run offline on Windows 11. It utilizes lightweight machine learning models for natural language processing.
Now supports both text and voice input/output, advanced markdown/code rendering, dark mode, and full session/prompt management in the GUI.
- Loads a lightweight LLM (e.g., Phi-3 or Mistral) using HuggingFace Transformers
- Supports GPU acceleration via DirectML or ROCm (if available)
- Accepts text input/output in both terminal and GUI (Tkinter)
- Modular code: core logic in
assistant/core.py, configuration inconfig/settings.py, entry point inmain.py - Model and generation settings are configurable
- Conversation history with adjustable context window (
/history N) - Session management: save, load, and auto-save conversations
- Export conversation as plain text
- Multi-line input support (
/longand/end) - System prompt modes:
chill,formal,coder(switch with/mode) - Prompt preview (
/prompt) - Token/character count display after each response
- Error handling for model and file operations
- GUI: mode switching, history management, and command support
- Command handler:
/calcfor arithmetic,/readfor file snippets,/snippetfor code blocks - Voice input (speech-to-text) and output (text-to-speech) in the GUI
- Advanced markdown/code rendering in the GUI (syntax highlighting for code blocks, bold, italic, tables, etc.)
- Dark mode toggle in the GUI
- Full session management (save/load/export/clear) in the GUI
ai-assistant
├── data/ # For markdown files or session logs
├── snippets/ # For Kotlin or code snippets
├── src
│ ├── main.py # Main entry point of the application
│ ├── assistant
│ │ ├── __init__.py # Package marker for assistant module
│ │ └── core.py # Core logic for the AI assistant
│ ├── config
│ │ └── settings.py # Configuration settings for the application
│ └── utils
│ ├── helpers.py # Utility functions for various tasks
│ └── commands.py # Command handler for /calc, /read, /snippet, etc.
├── requirements.txt # List of dependencies
├── .gitignore # Files and directories to ignore in version control
└── README.md # Documentation for the project
-
Clone the repository:
git clone <repository-url> cd ai-assistant -
Create a virtual environment (optional but recommended):
python -m venv venv -
Activate the virtual environment:
venv\Scripts\activate -
Install the required dependencies:
pip install -r requirements.txt
To run the AI assistant in the terminal:
python src/main.py
To run the graphical interface:
python src/gui.py
- Modern Tkinter interface with ttk themes (light/dark mode toggle)
- Logo/icon support
- Scrollable, color-coded conversation window
- Mode selector (chill, formal, coder)
- Prompt preview/export buttons
- Session management buttons: Save, Load, Export, Clear
- Voice input (🎤) and output (🔊) buttons
- Markdown/code highlighting for assistant responses
- Token/character count display after each response
/help→ Show available commands/calc <expr>→ Evaluate basic math (e.g.,/calc 12 * (4 + 1))/read <file>→ Read a markdown or text file from current ordata//snippet <file>→ Insert a Kotlin or code snippet fromsnippets//mode [name]→ Switch assistant mode (chill, formal, coder)/clear→ Wipe conversation history/save [name]→ Archive current session/load [name]→ Restore a saved session/export [file]→ Export conversation as text/history [N]→ Set number of turns to keep in context/prompt→ Show the full prompt sent to the model/long→ Paste multiple lines, finish with/endexit,quit→ Exit the assistant
To use voice features:
- Make sure your microphone is enabled and working.
- For text-to-speech, your system must support
pyttsx3(works on most Windows setups).
To use advanced markdown/code rendering:
- The GUI will automatically highlight code blocks, bold, italic, and tables in assistant responses.
Follow the on-screen instructions to interact with the assistant. All features are available in the GUI; the terminal version supports text only.
Contributions are welcome! Please open an issue or submit a pull request for any improvements or features.
This project is licensed under the MIT License. See the LICENSE file for more details.