Commit graph

319 commits

Author SHA1 Message Date
e28dc11f04 Improve user experience with battleship feedback and auto-play TTS
- Fix battleship feedback perspective confusion with better Hermes prompting
- Add auto-play TTS button with localStorage persistence and queueing system
- Move activity controls below model/voice selectors in sidebar
- Add activity controls to mobile hamburger menu
- Fix model/activity dropdowns to stay within container bounds
- Filter activities API to only show .yaml/.yml files
- Clean up system message labels by moving to usernames (System (Feedback), System (Question))
- Apply black formatting to app.py
2025-08-11 09:34:29 -04:00
74bb98b517
Merge pull request #13 from russellballestrini/testing-framework
Testing framework
2025-08-10 21:16:20 -04:00
96afd3272e Fix string termination in unit test
Add back the missing quote to properly close the triple-quoted string.
The expected string now has the correct number of closing quotes:
- One quote to close the inner string
- Three quotes to close the triple-quoted string
2025-08-10 21:16:12 -04:00
96ee7e8d0c Fix escaped quote in unit test expected string
Remove stray backslash from expected multiline string in test_find_most_recent_code_block.
The expected string now correctly matches the extracted code block content:
- def test_function():
-     return "Hello, World\!"

This fixes the test assertion to match the actual extracted content exactly.
2025-08-10 21:15:03 -04:00
6b876d488c Fix hardcoded paths in test files and improve YAML error handling
- Replace hardcoded absolute paths with relative paths using Path(__file__).parent
- Update test_activity_flows.py, test_guarded_ai.py, and test_battleship_pre_script.py to use dynamic path construction
- Import yaml module and catch yaml.YAMLError instead of broad Exception in test_activity_processing.py
- Ensures tests work across different environments and CI systems
- Makes YAML error handling more specific and prevents masking other exceptions
2025-08-10 21:06:26 -04:00
092ebd0ee0
Update Makefile
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
2025-08-10 20:54:43 -04:00
45a8f60cd2 Significantly improve test coverage with comprehensive integration tests
Major improvements:
- app.py coverage: 15% → 25% (+10 percentage points)
- research/guarded_ai.py coverage: 68% → 81% (+13 percentage points)
- Overall project coverage: 68% → 72% (+4 percentage points)

Key changes:
- Add comprehensive Flask integration tests for app.py activity functions
- Test real database operations with in-memory SQLite
- Add extensive guarded_ai.py error handling and client management tests
- Enhanced Makefile with comprehensive test targets
- Updated requirements-test.txt with flake8
- All 135 tests now passing with proper test coverage

The integration tests use real Flask environment, actual YAML processing,
and genuine database operations instead of mocks for accurate coverage.
2025-08-10 20:52:56 -04:00
1b44c2d66b Integrate comprehensive testing framework with Makefile
- Added unit tests for YAML loading and parsing functionality
- Created integration tests for multiple activity files validation
- Implemented functional tests for complete activity workflows
- Added battleship pre_script functionality tests
- Integrated all test types into comprehensive Makefile
- Fixed CLI validator test with proper failing fixture
- Applied black formatting to all Python files
- Removed problematic hardcoded targets from Makefile
- Added proper venv dependency management

Test coverage includes:
- Unit: YAML loading, validator functionality
- Integration: Cross-file validation, metadata operations
- Functional: End-to-end activity flows, pre_script execution
- All 30 activity files validated and tested
2025-08-10 19:38:50 -04:00
51b74be7d9 Fix YAML validator and activity file validation errors
- Updated validator terminal step detection to only flag truly terminal steps
- Fixed validator to accept integers and booleans in buckets (as supported by app.py)
- Fixed metadata_remove format in activity17 from dictionary to list of strings
- Added proper terminal section to activity3.yaml without questions/buckets
- Fixed missing restart transition and bucket in activity28
- Removed unused game_end transitions from battleship files
- Updated exit transitions to go directly to step_4 (goodbye step)
- Applied black formatting to validator code

All 30 activity YAML files now validate successfully with 0 errors and 0 warnings.
2025-08-10 19:38:50 -04:00
d4a075ac9a Complete testing framework with comprehensive test coverage
- Add comprehensive testing framework with 67 test cases covering unit, integration, and functional testing
- Create universal YAML validator supporting all activity types with validation for metadata operations, terminal steps, and Python syntax
- Implement proper Makefile with venv management and test runners following unDRY principles for copy-paste engineering
- Add requirements-test.txt for test dependencies separation
- Configure pytest with conftest.py for proper environment variable management
- Update CLAUDE.md with Makefile best practices
- All 67 tests passing with proper mocking of external dependencies

Testing coverage includes:
• Unit tests (37): Core app functions, utilities, navigation, response handling
• Integration tests (20): Complete activity workflows and error handling
• Functional tests (9): Full battleship game scenarios and edge cases
• YAML validator (17): Universal validation for all activity configurations
2025-08-10 19:38:47 -04:00
292265b5bb Add comprehensive testing framework and YAML validator
- Create universal activity_yaml_validator.py for validating activity configurations
- Add validation for metadata operations (metadata_add, metadata_remove, metadata_feedback_filter, etc.)
- Validate terminal steps cannot have questions or buckets
- Check Python syntax in processing_script and pre_script blocks
- Validate YAML structure, transitions, and logic flow
- Add 17 comprehensive unit tests with 100% pass rate
- Include test fixtures for validation testing
- Support both CLI and programmatic usage
2025-08-10 19:35:52 -04:00
25c694584a
Merge pull request #12 from russellballestrini/battleship-hermes
Battleship hermes mode operational!
2025-08-10 16:06:06 -04:00
1ca6f67c3d Fix code quality issues from PR review
- Add matplotlib.use("Agg") backend configuration to prevent runtime errors in headless environments
- Add error handling guards for script results that might return None
- Fix AI targeting logic to exclude already-fired cells in super hunter and hunter modes
- Update CLAUDE.md with matplotlib best practices
2025-08-10 16:01:58 -04:00
4d909aaecb Fix indentation error from commented print statements
- Add pass statements to empty else blocks that only contained commented prints
- Ensures Python syntax remains valid after commenting out debug statements
2025-08-10 15:19:59 -04:00
29573eaa75 Enhance battleship activity with improved user input handling and feedback
- Add user_response to pre-script metadata for better game state management
- Implement metadata_feedback_filter to control feedback data exposure
- Improve ship destruction announcements and game over messaging
- Add debug logging for ship sinking events
- Include test ship configuration file
2025-08-10 14:49:03 -04:00
80b18cf0bb Add Claude instructions to prevent attribution in commit messages 2025-08-10 11:57:52 -04:00
368c7d290e Add Hermes Reasoner mode to battleship with game ending fixes
- Add new Hermes Reasoner AI mode that combines probability analysis with LLM reasoning
- Implement pre-script and post-script architecture in app.py for flexible YAML processing
- Fix game ending detection by adding transition override mechanism
- Add probability matrix visualization and strategic move analysis
- Support both legacy processing_script and new pre_script/post_script naming
- Restore full ship complement for complete battleship gameplay
2025-08-10 11:57:22 -04:00
38f414c5a9 Fix critical security vulnerabilities in Flask application
- Prevent SQL injection in search functionality with input sanitization
- Add path traversal protection for local file operations
- Replace hardcoded secret key with environment variable
- Escape HTML output to prevent XSS attacks in image generation
- Restrict file access to research/ directory with .yaml extension only
- Add comprehensive input validation and error handling

Security improvements maintain full application functionality while
protecting against common web application vulnerabilities.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-06-24 00:00:54 -04:00
fc53cd3cc5 ● Enhance math plotting activity with secure multi-function support
- Replace unsafe eval() with sympy for secure expression parsing
  - Add YAML anchors to eliminate code duplication in processing scripts
  - Implement multiple function plotting with comma-separated syntax
  - Add dynamic plot ranges based on function characteristics
  - Include automatic function type detection and analysis
  - Streamline activity flow: intro → demo plot → open sandbox
  - Add comprehensive error handling with visual error messages
  - Support enhanced mathematical notation (arcsin, ln, implied multiplication)

	modified:   research/activity24-math-plot.yaml
2025-06-23 23:21:25 -04:00
2a1efd1f90 claude security upgrade
modified:   requirements.txt
	modified:   research/activity24-math-plot.yaml
2025-06-23 22:36:23 -04:00
648df5a0b2 embed videos like a damn pro! 2025-06-20 17:13:32 -04:00
8011649abc fix all the o1-o4 models
modified:   app.py
2025-06-01 23:28:05 -04:00
b65fd58285 nothing lasts but nothing is lost.
Goodbye Naptha.

	modified:   README.rst
	modified:   vars.sh.sample
2025-05-23 10:29:42 -04:00
85bbac74f2
Merge pull request #11 from russellballestrini/battleship
prompt engineering research/activity29-battleship.yaml
2025-04-24 12:59:34 -04:00
Russell Ballestrini
8cee47fcc9 modified: research/activity29-battleship.yaml 2025-04-23 16:17:05 -04:00
Russell Ballestrini
0e59d29dd7 modified: models.py 2025-04-23 16:06:40 -04:00
Russell Ballestrini
c7278e07a7 modified: vars.sh.sample 2025-03-11 22:14:17 -04:00
54223fc4bb
Merge pull request #10 from russellballestrini/dynamic-models
dynamic models for all the platforms!
2025-03-11 22:02:53 -04:00
Russell Ballestrini
3b463f41ea modified: requirements.txt 2025-03-11 21:18:52 -04:00
Russell Ballestrini
9bfd1c9b5a dynamic models for all the platforms!
modified:   .gitignore
	modified:   README.rst
	modified:   app.py
	modified:   templates/base.html
	modified:   templates/chat.html
	new file:   vars.sh.sample
2025-03-11 21:15:13 -04:00
00eba1b150 gemini is actually tested and working
modified:   app.py
	new file:   models.py
2025-02-23 17:11:00 -05:00
2cd434c291
Update app.py 2025-02-16 15:56:32 -05:00
b6b4067134
Update README.rst 2025-02-16 15:54:51 -05:00
7d1b22d564
Merge pull request #9 from russellballestrini/all-the-models
dynamically register models to endpoints
2025-02-10 17:08:11 -05:00
44170459fe dynamically register models to endpoints
modified:   app.py
2025-02-10 16:46:02 -05:00
8fd77088e6
Update README.rst
export VLLM_ENDPOINT2=https://naptha2.ai.unturf.com/v1
    export VLLM_ENDPOINT3=https://naptha3.ai.unturf.com/v1
2025-02-10 13:11:47 -05:00
a1e523e183
Merge pull request #8 from russellballestrini/mistral-ai-upgrades
Mistral ai upgrades
2025-02-08 16:32:22 -05:00
381588d6bc mistral upgrades
modified:   README.rst
	modified:   app.py
	modified:   templates/base.html
	modified:   templates/chat.html
2025-02-08 16:03:22 -05:00
0250bf77b1
mistral ai upgrades 2025-02-08 15:48:23 -05:00
748649d98a o3-mini and hermes 8b 8fp!
modified:   README.rst
	modified:   app.py
	modified:   templates/base.html
	modified:   templates/chat.html
2025-02-01 15:58:01 -05:00
adc202125e free endpoints for open public domain ai
modified:   README.rst
2025-01-25 14:40:14 -05:00
0492d5b329 r1 llm support:
modified:   README.rst
	modified:   app.py
	modified:   templates/base.html
	modified:   templates/chat.html
2025-01-25 14:37:26 -05:00
06d5167628 make port configurable for demo2.opencompletion.com 2025-01-25 07:46:11 -05:00
2e7fd18ba1 more openai models
modified:   README.rst
	modified:   app.py
	modified:   templates/base.html
	modified:   templates/chat.html
2024-12-31 12:18:03 -05:00
91d6192192 bunch more models.
modified:   app.py
	modified:   templates/base.html
	modified:   templates/chat.html
2024-12-09 18:25:37 -05:00
9c44b23758 f 2024-12-07 10:51:08 -05:00
8743464747 modified: README.rst 2024-12-07 10:47:48 -05:00
Russell Ballestrini
2449703489 modified: templates/chat.html 2024-12-06 16:09:05 -05:00
8b90bc6485 sync up mobile and desktop drop downs and user lists!
modified:   templates/base.html
	modified:   templates/chat.html
2024-11-24 17:35:54 -05:00
b01311a825 inactive uesrs now collected.
modified:   app.py
	new file:   migrations/versions/5d93cdf18549_room_inactive_users_column.py
	modified:   templates/base.html
	modified:   templates/chat.html
2024-11-24 14:16:25 -05:00