๐ŸŽ›๏ธ 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