Commit graph

57 commits

Author SHA1 Message Date
Kenearos
d659236e4f
Merge pull request #21 from Kenearos/claude/fix-todo-comment-365AX
Fix bare except clauses for better error handling
2026-01-10 13:34:14 +02:00
Claude
d3f2fa43c3
Fix bare except clauses for better error handling
Replace 5 bare except clauses with 'except Exception:' to improve
error handling and prevent catching system exits and keyboard interrupts:

- gui.py:155 - Queue event processing
- setup_wizard.py:184 - API response parsing
- test_credentials.py:213 - Response JSON parsing
- test_credentials.py:240 - Error response parsing
- test_credentials.py:257 - Response text formatting

This change improves code quality and follows Python best practices
for exception handling.
2026-01-10 11:08:28 +00:00
Kenearos
2795178a75
Merge pull request #20 from Kenearos/claude/setup-eugen-bot-VNWYq
Set up Eugen bot configuration wizard
2026-01-06 17:03:31 +01:00
Claude
ddedd4867c
Add comprehensive credential validation and troubleshooting tools
This commit adds robust diagnostic tools to help users identify and fix
authentication issues with Twitch OAuth and Perplexity API.

New Features:
- test_credentials.py: Comprehensive credential validator with detailed diagnostics
  - Tests Twitch OAuth token with IRC authentication
  - Validates Perplexity API key and model access
  - Provides specific error messages and actionable fixes
  - Automatically tests fallback models (sonar-pro → sonar)

- TROUBLESHOOTING.md: Complete troubleshooting guide
  - Common error messages and solutions
  - Step-by-step diagnostic procedures
  - Quick reference for file locations and commands

Improvements to setup_wizard.py:
- Enhanced Twitch token validation with detailed error messages
- Added Perplexity model fallback (sonar-pro → sonar)
- Better error handling with specific solutions
- Recommends working model if primary model unavailable

Documentation Updates:
- README.md: Added credential testing section with examples
- CLAUDE.md: Updated with new tools and testing procedures
- Comprehensive troubleshooting section in README

This addresses the common authentication failures users encounter during
initial setup and provides clear paths to resolution.
2026-01-06 15:58:46 +00:00
Kenearos
f45f73e335
Merge pull request #19 from Kenearos/claude/fix-voice-recognition-70aYN
Debug voice recognition not working
2026-01-06 13:38:38 +01:00
Claude
e87963148c
Add comprehensive IRC event debugging to diagnose message reception issues
- Add global event handler to log all IRC events
- Add on_join handler to properly track channel joins
- Add on_disconnect handler to detect connection drops
- Add on_privmsg handler to catch messages that might not trigger pubmsg
- Add detailed debug logging throughout message flow
- Improve test_irc.py with same debugging capabilities
2026-01-06 12:34:11 +00:00
Kenearos
8994b0edbf
Merge pull request #17 from Kenearos/claude/improve-test-coverage-9RFG1
Achieve 100% test coverage with comprehensive improvements
2026-01-03 20:56:46 +01:00
Kenearos
0d72afd80f
Merge pull request #18 from Kenearos/copilot/sub-pr-17
Address PR review comments: fix test counts, remove unused code, improve CI workflow
2026-01-03 20:56:22 +01:00
copilot-swe-agent[bot]
422db09142 Keep fail_ci_if_error as false to avoid blocking on transient codecov issues
Co-authored-by: Kenearos <86194771+Kenearos@users.noreply.github.com>
2026-01-03 11:01:17 +00:00
copilot-swe-agent[bot]
6bb006fbe1 Address all review comments: fix test counts, remove unused imports, improve workflow
Co-authored-by: Kenearos <86194771+Kenearos@users.noreply.github.com>
2026-01-03 10:59:56 +00:00
copilot-swe-agent[bot]
0411d0856a Initial plan 2026-01-03 10:54:29 +00:00
Claude
90a70a85eb
Achieve 100% test coverage with comprehensive improvements
Enhanced test suite from 97% to 100% coverage with 173 passing tests.

## New Features

### 1. Error Handling Tests (3 tests)
- test_add_message_handles_read_error_gracefully
- test_add_message_handles_write_error_gracefully
- test_clear_user_history_handles_permission_error
- test_logger_reuses_existing_handlers

Coverage: memory.py 91% → 100%, utils.py 98% → 100%

### 2. Integration Tests (9 tests) - test_integration.py
- test_mention_to_response_workflow: Full message flow
- test_conversation_context_preserved: Multi-turn conversations
- test_config_to_components_integration: Component initialization
- test_error_recovery_workflow: Graceful error handling
- test_mention_detection_integration_with_nicknames
- test_memory_limit_enforcement_in_workflow
- test_ambiguous_greeting_workflow
- test_logger_integration_with_memory
- test_logger_integration_with_ai_provider
- test_config_validation_workflow

### 3. Parameterized Tests (45 tests)
- 18 mention detection test cases
- 17 greeting detection test cases
- 8 content extraction test cases
- Covers edge cases, unicode, nicknames, false positives

### 4. GitHub Actions CI Workflow
- Multi-Python version testing (3.9, 3.10, 3.11, 3.12)
- Automated coverage reporting
- Code quality checks (Black, isort, flake8)
- Codecov integration
- Coverage badge generation

## Test Statistics

- Tests: 116 → 173 (+49% increase)
- Coverage: 97% → 100% (+3pp)
- Execution time: ~1.1 seconds
- All components: 100% coverage

## Files Modified

- tests/test_utils.py: Added parameterized tests and error handling
- tests/test_memory.py: Added error handling tests
- tests/test_integration.py: NEW - Full integration test suite
- tests/README.md: Updated documentation
- .github/workflows/test.yml: NEW - CI/CD automation
2026-01-03 10:04:38 +00:00
Kenearos
b877346f76
Merge pull request #16 from Kenearos/claude/init-irc-bot-dashboard-kYxih
Claude/init irc bot dashboard k yxih
2026-01-02 23:33:59 +01:00
Kenearos
12f92c5357
Merge pull request #15 from Kenearos/claude/improve-test-coverage-9RFG1
Add comprehensive test suite with 97% code coverage
2026-01-02 23:20:47 +01:00
Claude
82a1687bde
Expand nickname generation for better name variations
Enhanced _generate_nicknames() to support more name variations:

Before (for 8-char name "Kenearos"):
- Generated: Kene (4 chars only)

After:
- Generates at 4, 6, 8, 10, 12 character positions
- For "kenearosmd": Kene, Kenear, Kenearos, kenearosmd
- Special handling: removes 'md' suffix if present
  (kenearosmd → also adds kenearos)

This allows users with longer usernames to be recognized:
- Bot name "kenearosmd" generates: kene, kenear, kenearos
- Bot responds to all variations and the full name

Fixes issue where users couldn't use their full username
if it was longer than the configured bot name.
2026-01-02 22:18:41 +00:00
Claude
11b928c242
Add debug test scripts for troubleshooting
Added two diagnostic tools:

test_mention.py:
- Tests MentionDetector with various message formats
- Shows nickname generation (Kene from Kenearos)
- Displays extracted content from mentions
- Helps verify mention detection is working correctly

test_irc.py:
- Minimal IRC bot for testing message reception
- Prints all received messages to console
- Helps diagnose if IRC connection is receiving messages
- Useful for debugging connection issues

These tools help troubleshoot when bot doesn't respond:
1. Run test_mention.py to verify detection logic
2. Run test_irc.py to verify IRC message reception
2026-01-02 22:14:59 +00:00
Claude
f6813b5fa5
Add comprehensive test suite with 97% code coverage
Implemented full test coverage for core bot components:

Test Coverage:
- MentionDetector: 98% (28 tests) - mention detection, nickname handling, content extraction
- Logger: 98% (15 tests) - file logging, log levels, unicode support
- ConversationMemory: 91% (25 tests) - history management, time filtering, JSON persistence
- PerplexityProvider: 100% (22 tests) - API calls, error handling, statistics
- Config: 100% (26 tests) - env loading, validation, JSON config

Infrastructure:
- Added pytest, pytest-asyncio, pytest-mock, pytest-cov to requirements.txt
- Created pytest.ini with coverage configuration
- Created .coveragerc to exclude non-production files
- Added conftest.py with shared fixtures and test isolation

Test Features:
- 116 total tests, all passing
- Isolated test environment (clean env vars, logging handlers)
- Async testing support for PerplexityProvider
- Mocked HTTP requests to avoid real API calls
- Comprehensive edge case coverage
- Unicode/German character support testing

Total: 97% code coverage across 273 statements
2026-01-02 22:10:14 +00:00
Kenearos
db467d774c
Merge pull request #14 from Kenearos/claude/init-irc-bot-dashboard-kYxih
Update to correct Perplexity API models (2026)
2026-01-02 22:56:18 +01:00
Claude
5daf62ba22
Update to correct Perplexity API models (2026)
Corrected model list based on official Perplexity API documentation:

REMOVED (not available via API):
- llama-3.1-sonar-small-128k-online
- llama-3.1-sonar-large-128k-online
- llama-3.1-sonar-huge-128k-online

ADDED (actual API models):
- sonar-reasoning-pro (powered by DeepSeek-R1)
- sonar-deep-research (long-form research)

AVAILABLE MODELS:
1. sonar-pro (recommended for chat bots)
2. sonar (lightweight, fast)
3. sonar-reasoning (real-time reasoning)
4. sonar-reasoning-pro (advanced reasoning)
5. sonar-deep-research (research reports)

Updated info popup with:
- Accurate model descriptions from official docs
- Built on Llama 3.3 70B (sonar/sonar-pro)
- DeepSeek-R1 for sonar-reasoning-pro
- Clear use case recommendations

Updated MODEL_CHANGE.md with correct information.

Source: Perplexity API official documentation (2026)
2026-01-02 21:52:12 +00:00
Kenearos
6f75529b91
Merge pull request #13 from Kenearos/claude/init-irc-bot-dashboard-kYxih
Add comprehensive Perplexity model selection in setup wizard
2026-01-02 22:51:43 +01:00
Claude
03df6035c5
Add comprehensive Perplexity model selection in setup wizard
Setup wizard improvements:
- Expanded model dropdown with 6 Perplexity models:
  * sonar-pro (recommended default)
  * sonar
  * sonar-reasoning
  * llama-3.1-sonar-small-128k-online
  * llama-3.1-sonar-large-128k-online
  * llama-3.1-sonar-huge-128k-online

- Added info button (?) next to model selector
- Info popup explains each model's characteristics:
  * Performance
  * Use cases
  * Speed/quality tradeoffs
  * Cost considerations

Created MODEL_CHANGE.md documentation:
- How to change model in .env file
- How to re-run setup wizard
- Detailed model descriptions
- Example configuration

Users can now easily choose the right model for their needs
and change it anytime without reconfiguring everything.
2026-01-02 21:47:10 +00:00
Kenearos
952e543970
Merge pull request #12 from Kenearos/claude/init-irc-bot-dashboard-kYxih
Claude/init irc bot dashboard k yxih
2026-01-02 22:42:31 +01:00
Claude
5e0ebbb1c4
Add nickname detection and AI-based ambiguous message handling
Enhanced bot to respond to partial names and ambiguous greetings:

MentionDetector improvements (utils.py):
- Auto-generate nicknames from bot name (kenearosmd → Kene, Kenearos)
- Add patterns for all nicknames (full name + partial names)
- New is_ambiguous_greeting() method for greetings without clear mention
- Updated extract_content() to remove all name variants

Bot logic improvements (chatbot.py):
- New check_if_addressed() method uses AI to determine if ambiguous
  messages are directed at the bot
- AI analyzes greetings like "Hi wie gehts" and decides if bot should respond
- If AI confirms, message is processed like a normal mention

Recognition examples:
- kenearosmd: wie gehts → responds 
- Kene was meinst du → responds 
- Kenearos! → responds 
- Hi wie gehts → AI checks context → responds if appropriate 

This prevents the bot from spamming on every greeting while still
being responsive when addressed indirectly.
2026-01-02 21:30:20 +00:00
Claude
0b2d166a58
Improve mention detection to catch all variations
Enhanced MentionDetector to recognize bot name in more contexts:

Detection patterns now include:
- @botname anywhere (with word boundary)
- botname with punctuation (: ! ? , .)
- botname at start of message
- botname anywhere as whole word (new catchall pattern)

Content extraction improved to remove bot name from:
- Start of message (with @mention or plain)
- End of message (with optional punctuation)
- Middle of message (with punctuation)

Now responds to all these variations:
- @kenearosmd Hi
- kenearosmd: wie gehts?
- kenearosmd was meinst du?
- Hallo kenearosmd
- kenearosmd!
- Frage an kenearosmd hier
2026-01-02 21:26:29 +00:00
Kenearos
4e65bbeb9b
Merge pull request #10 from Kenearos/claude/init-irc-bot-dashboard-kYxih
Fix bot not responding to mentions - event loop wasn't running
2026-01-02 22:20:59 +01:00
Kenearos
6effe2a44d
Merge pull request #11 from Kenearos/copilot/sub-pr-10
[WIP] Fix bot not responding to mentions due to event loop issue
2026-01-02 22:20:39 +01:00
copilot-swe-agent[bot]
3614c7e76b Add synchronization and cleanup for event loop thread
Co-authored-by: Kenearos <86194771+Kenearos@users.noreply.github.com>
2026-01-02 21:20:01 +00:00
copilot-swe-agent[bot]
52f77c8365 Initial plan 2026-01-02 21:17:10 +00:00
Claude
e9fc21e423
Fix bot not responding to mentions - event loop wasn't running
The bot was detecting mentions correctly but not responding because
the async event loop was never started.

Changes:
- Created separate _run_event_loop() method to run loop.run_forever()
- Start event loop in its own daemon thread before IRC bot
- IRC bot thread no longer sets event loop (handled by loop thread)
- Now asyncio.run_coroutine_threadsafe() can properly execute async tasks

This fixes the issue where mentions were detected but handle_mention()
was never executed because there was no running event loop to process
the coroutine.
2026-01-02 21:09:39 +00:00
Kenearos
4504dd2e32
Merge pull request #9 from Kenearos/claude/init-irc-bot-dashboard-kYxih
Initialize IRC bot and dashboard startup
2026-01-02 22:07:58 +01:00
Claude
a52be47121
Fix shutdown error: file descriptor cannot be a negative integer
Improved error handling in bot shutdown process:
- Check connection state before attempting to quit IRC
- Use thread-safe event loop shutdown
- Filter expected shutdown errors from error logs
- Changed shutdown errors to debug level logging

This prevents the "file descriptor cannot be a negative integer (-1)"
error from appearing as an ERROR when cleanly shutting down the bot.
2026-01-02 21:06:47 +00:00
Kenearos
1678702ef3
Merge pull request #8 from Kenearos/claude/fix-todo-comment-SJcqr
Find and fix TODO comment
2026-01-02 22:01:29 +01:00
Claude
2b15ceeaa1
Replace print statements with proper logging
Fixed inconsistent error handling in ai_provider.py and memory.py by:
- Adding optional logger parameter to PerplexityProvider and ConversationMemory classes
- Replacing all print() statements with proper logger.error() calls
- Updating chatbot.py to pass logger instance to both components
- Ensuring consistent logging architecture across the codebase

This improves error visibility and integrates with the existing logging infrastructure.
2026-01-02 20:58:49 +00:00
Kenearos
a1f30c31c6
Merge pull request #7 from Kenearos/claude/fix-job-59338051935-Lo2Jr
Add detailed logging for content extraction debugging
2026-01-02 21:54:59 +01:00
Claude
193e269274
Add detailed logging for content extraction debugging
- Log extracted content to help debug empty content issue
- Add warning when content is empty after mention extraction
- Display extraction info in dashboard for better visibility

Helps diagnose why bot detects mentions but doesn't respond
2026-01-02 20:53:11 +00:00
Kenearos
e81b2f91e6
Merge pull request #6 from Kenearos/claude/fix-job-59338051935-Lo2Jr
Debug and fix failing job 59338051935
2026-01-02 21:37:40 +01:00
Kenearos
ab437d2905
Delete Dependency Review workflow
Removed the Dependency Review workflow configuration.
2026-01-02 21:37:32 +01:00
Claude
156bcbb52f
Update CLAUDE.md to reflect FreeSimpleGUI usage 2026-01-02 20:33:30 +00:00
Claude
b76db81575
Switch from PySimpleGUI to FreeSimpleGUI
- Replace PySimpleGUI 5.0.8.3 with FreeSimpleGUI 5.1.1
- FreeSimpleGUI is a community fork without license requirements
- PySimpleGUI 5.x requires paid license after trial period
- Remove compatibility fallback code (no longer needed)
- Update documentation to reflect FreeSimpleGUI usage

Fixes: AttributeError 'module PySimpleGUI has no attribute theme'
2026-01-02 20:33:05 +00:00
Claude
0aad0f80d2
Fix PySimpleGUI 5.x compatibility issue with theme() method
- Add try/except fallback for sg.theme() -> sg.set_options()
- Resolves AttributeError when using PySimpleGUI 5.0.8.3
- Maintains backward compatibility with PySimpleGUI 4.x
2026-01-02 20:29:52 +00:00
Kenearos
83b8d3ee4a
Merge pull request #5 from Kenearos/claude/search-todo-start-Alr4l
Add comprehensive GitHub Actions CI/CD workflows
2026-01-02 21:18:17 +01:00
Kenearos
92fb10860a
Merge branch 'main' into claude/search-todo-start-Alr4l 2026-01-02 21:16:47 +01:00
Kenearos
49d90df3cb
Merge pull request #3 from Kenearos/claude/setup-ai-chat-wizard-wNFh2
Setup wizard for AI chat integration
2026-01-02 21:15:34 +01:00
Kenearos
5f9dbe6b15
Merge pull request #4 from Kenearos/copilot/sub-pr-3
Fix resource management, validation logic, and import organization in setup wizard
2026-01-02 21:15:02 +01:00
copilot-swe-agent[bot]
b984d9886d Address PR review comments: fix imports, validation logic, and bot identity
Co-authored-by: Kenearos <86194771+Kenearos@users.noreply.github.com>
2026-01-02 11:57:09 +00:00
copilot-swe-agent[bot]
63936b33b1 Initial plan 2026-01-02 11:52:00 +00:00
Claude
4b0d67fed0
Update PySimpleGUI to version 5.0.8.3
- Fix CI/CD failure due to PySimpleGUI 4.60.0 being removed from PyPI
- Upgrade to PySimpleGUI 5.0.8.3 (latest stable version)
- GUI code uses basic features that should remain compatible
2026-01-02 11:47:26 +00:00
Claude
6c3dbac131
Add interactive setup wizard and personalize bot for Kene
Changes:
- Create setup_wizard.py with interactive configuration flow
  - Validates Twitch OAuth token via IRC test
  - Validates Perplexity API key with test request
  - Guides user through all required settings
  - Creates .env file and necessary directories

- Update config.py system prompt to reflect Kene's personality
  - Bot now responds AS Kene (first person)
  - Includes tech expertise (Bambu X1C, H2C, coding/bots)
  - Reflects political stance (left-leaning, anti-right)
  - Maintains authentic conversational style

- Update README.md with setup wizard instructions
  - Clear step-by-step for Option 1 (wizard)
  - Lists wizard features and benefits
2026-01-02 11:41:21 +00:00
Claude
c8d09969df
Add comprehensive GitHub Actions CI/CD workflows
Implemented automated testing and quality assurance pipelines:

Workflows added:
- python-package.yml: Main CI pipeline
  * Multi-OS testing (Ubuntu, Windows, macOS)
  * Python 3.9-3.12 compatibility testing
  * Linting with flake8
  * Code formatting checks with black
  * Type checking with mypy
  * Import and compilation tests
  * Unit tests for core components

- codeql.yml: Security scanning
  * Weekly automated security analysis
  * CodeQL vulnerability detection
  * Extended security and quality queries

- dependency-review.yml: Dependency safety
  * Automatic dependency vulnerability checks
  * License compliance verification
  * Blocks moderate+ severity issues

- pr-labeler.yml: PR automation
  * Auto-labels based on changed files
  * PR size labeling (xs/s/m/l/xl)
  * Metadata extraction for better organization

- welcome.yml: Community engagement
  * Welcomes first-time contributors
  * Provides helpful guidelines
  * Improves contributor experience

Configuration:
- labeler.yml: Label mapping for automatic categorization

All workflows include proper permissions and error handling.
2026-01-02 11:29:19 +00:00
Kenearos
2ae9e09923
Add GitHub Actions workflow for Python package
This workflow installs Python dependencies, runs linting with flake8, and executes tests with pytest across multiple Python versions.
2026-01-02 12:26:56 +01:00