Testing/unit tests - #4
Open
JoshWrites wants to merge 4 commits into
Open
Conversation
…testing ### 🏗️ Architecture Changes - **Modular Design**: Refactored 1665-line monolithic codebase into clean modules - **Dependency Injection**: Implemented interface-based design for all components - **Separation of Concerns**: Clear boundaries between audio, speech, AI, commands, conversation, and resources ### ✨ New Features - **Comprehensive Testing**: 72% test coverage with pytest framework - **Enhanced Interruption**: Improved wake word interruption during TTS responses - **Command Routing**: Smart local vs AI query routing system - **Resource Management**: Dynamic GPU memory detection and profile switching - **Conversation Context**: Better context management with token-aware history ### 🚫 Removed Features - **Web Search Functionality**: Completely removed all online/web search capabilities - **Online Permissions**: Removed permission system for web access - **Browser Integration**: No more browser opening or web result reading ### 📦 New Modules - `src/audio/`: Audio I/O abstraction with PyAudio implementation - `src/speech/`: Speech recognition, TTS, and wake word detection - `src/ai/`: AI backend management (Ollama/Msty) with interfaces - `src/commands/`: Local command handlers (time, date, math, conversions) - `src/conversation/`: Conversation context and history management - `src/resources/`: Resource profile management and GPU memory detection ### 🧪 Testing Infrastructure - Comprehensive unit tests for all modules - Integration tests with real Ollama backend - Test configuration with pytest.ini - Make targets for test automation - 72% overall test coverage ### 📝 Implementation Files - `voice_assistant_clean.py`: New modular implementation (recommended) - `voice_assistant.py`: Original implementation (unchanged, still functional) - `voice_assistant_refactored.py`: Intermediate development version ### 🔄 Backward Compatibility - Zero breaking changes to user experience - Identical functionality to original (minus web search) - Same wake word, commands, conversation flow, and AI integration - Both implementations available for transition period 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
### 📝 Documentation Improvements - **Installation Clarity**: Emphasized no build tools required - pure Python project - **Makefile Prominence**: Featured Make commands for testing throughout - **Quick Start Section**: Added immediate user and developer workflows - **Testing Workflow**: Comprehensive testing guide for contributors - **PR Guidelines**: Clear pre-commit checklist with Make commands ### 🛠️ Key Clarifications - Make is NOT required for installation/building - only for testing convenience - Enhanced installation verification steps - Detailed contributor workflow with testing requirements - Emphasized testing before pull requests ### 🎯 Developer Experience - Make commands featured prominently for easy testing - Clear distinction between user installation and developer setup - Testing requirements and coverage expectations - CI/CD integration examples 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
### 🔧 Dependencies Fixed - **Added numpy requirement**: Required by refactored audio/speech modules - **Updated requirements.txt**: Moved numpy from optional to required - **Fixed subprocess calls**: Removed invalid stderr parameter in resource manager ### ✅ Installation Verification - **New verify_installation.py**: Comprehensive installation checker - **Tests all dependencies**: Core Python packages and modular components - **Voice assistant instantiation**: Verifies complete functionality - **Speech model detection**: Checks Vosk model availability - **User-friendly output**: Clear success/failure reporting ### 📦 Requirements Summary **Core Dependencies (requirements.txt)**: - pyaudio>=0.2.11 (audio I/O) - vosk>=0.3.45 (speech recognition) - pvporcupine>=3.0.0 (wake word detection) - requests>=2.25.1 (AI backend communication) - psutil>=5.9.0 (system resource monitoring) - numpy>=1.21.0 (array processing - now required) **Test Dependencies (requirements-test.txt)**: - pytest>=7.4.0 - pytest-cov>=4.1.0 - pytest-mock>=3.11.1 - pytest-asyncio>=0.21.1 ### 🎯 Verification Results - ✅ All core dependencies import successfully - ✅ All modular components load correctly - ✅ Voice assistant instantiates without errors - ✅ Speech model detection works 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
…bility - Lazy-init PyAudio to avoid capturing devices at import time - Add VRAM model unloading on backend stop (Ollama) - Fix AMD GPU VRAM detection to parse per-GPU byte values from rocm-smi - Buffer interruption audio (~1s) for reliable wake-word detection, add startup delay to avoid self-triggering - Route espeak output through PyAudio for PipeWire compatibility - Reset Vosk recognizer between calls to prevent state bleed - Improve silence detection: wait for speech onset, raise threshold - Tighten ConversionHandler/MathHandler keyword matching to reduce false positives - Add debug logging and better error handling in command loop Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The testing branch is complete and ready for merging into main. All the modular refactoring work with
comprehensive testing is now available on GitHub! 🚀