๐๏ธ Input Module
September 1, 2024 ยท View on GitHub
The Input Module handles user input and command processing for the AI assistant.
๐ Key Features
- ๐ฌ Interactive command-line interface using
prompt_toolkit - ๐ Command history management
- ๐ท๏ธ Tab completion for commands
- ๐จ Customizable prompt style
- ๐ซ Graceful handling of exit commands and interrupts
๐ง Main Functions
- ๐ค
get_user_input(): Captures and processes user input - โก
handle_slash_command(command): Processes slash commands
๐ Usage
This module is primarily used in the main application loop to capture user input and route it to the appropriate handler.
๐งช Testing
The input module is thoroughly tested in test_input.py, covering:
- Normal input processing
- Handling of exit commands
- Processing of help commands
- Keyboard interrupt handling
- EOF handling
To run tests specific to this module:
python -m unittest src/tests/test_input.py
๐ Key Considerations
- Ensure that all new commands are added to the completion list
- Keep the command processing logic in sync with the slash_commands module
- Consider adding more sophisticated input validation if needed