Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Clipboard Interactions and User Input Suggestions #5

Open
wants to merge 17 commits into
base: main
Choose a base branch
from

Commits on Feb 20, 2024

  1. Configuration menu
    Copy the full SHA
    a440ab8 View commit details
    Browse the repository at this point in the history
  2. refactor: Add ChatHistory class and use it to manage chat history data

    - Create a new ChatHistory class that encapsulates the chat history data and provides methods for loading and saving the data
    - Use an instance of the ChatHistory class to manage the chat history data in the ConChat class.
    - Add a new chat_history argument to the argparse options, which allows you to specify the file path to the chat history data. If this argument is specified, the ChatHistory instance will be initialized with the data from the file.
    - Remove the session attribute and replace it with the chat_history attribute in the ConChat class.
    
    This commit refactors the code to make it more modular and easier to use. The new ChatHistory class encapsulates the chat history data and provides methods for loading and saving the data, which makes the code more organized and maintainable.
    teleprint-me committed Feb 20, 2024
    Configuration menu
    Copy the full SHA
    00c3810 View commit details
    Browse the repository at this point in the history
  3. refactor: Improve chathistory class and error handling

    - Update constructor to accept Path and str instances for file_path and system_message.
    - Add error checking for the file_path parameter in the chathistory class constructor, setting a default file history path based on the chat session file path if no path is given by the user.
    - Rename method read() to load() for better clarity.
    - Add error handling for specific exceptions (FileNotFoundError, json.JSONDecodeError, and TypeError) in both load() and save() methods.
    - Replace a hard-coded path with a dynamic default path if no path is given by the user in the PromptSession constructor within the chathistory class.
    
    These changes improve your code's readability, maintainability, and robustness
    teleprint-me committed Feb 20, 2024
    Configuration menu
    Copy the full SHA
    f5c44d2 View commit details
    Browse the repository at this point in the history
  4. Configuration menu
    Copy the full SHA
    e3d21c5 View commit details
    Browse the repository at this point in the history
  5. Configuration menu
    Copy the full SHA
    1d6a184 View commit details
    Browse the repository at this point in the history
  6. refactor: Add formatted chat history on load

    - Update `chathistory` class to store messages as a list of dictionaries instead of a simple list.
    - Each dictionary represents a message with its associated role and content.
    - Add new method `replace(index: int, content: str)` in `chathistory` for updating the content of a message at a given index.
    - Add new method `_render_messages_once_on_start()` method in `conchat` to load and render chat history messages upon
    teleprint-me committed Feb 20, 2024
    Configuration menu
    Copy the full SHA
    8990949 View commit details
    Browse the repository at this point in the history
  7. refactor: Simplify Chat History Management

    - Replaced direct file path handling with session name-based management for chat history
    - Renamed `chathistory` class to `ChatHistory` for consistency with Python naming conventions
    - Updated argument parsing to use session names instead of file paths, including changing flags and defaults
    - Enhanced error handling in `ChatHistory.load()` to automatically create a new file if missing
    - Adjusted `conchat` class constructor to accept `ChatHistory` instance, reflecting class name change
    - Streamlined command-line interface and improved user feedback with clearer messages and defaults
    
    These changes make the chat history management more intuitive and robust, reducing user effort and potential errors.
    teleprint-me committed Feb 20, 2024
    Configuration menu
    Copy the full SHA
    b2a4608 View commit details
    Browse the repository at this point in the history
  8. Configuration menu
    Copy the full SHA
    735957f View commit details
    Browse the repository at this point in the history

Commits on Feb 21, 2024

  1. Configuration menu
    Copy the full SHA
    17331a9 View commit details
    Browse the repository at this point in the history
  2. feat: Add Clipboard Interactions and User Input Suggestions

    - Implemented custom key bindings for copying the last message or code snippets to the clipboard.
    - Integrated PyperclipClipboard for system-wide clipboard access.
    - Utilized regular expressions to extract and copy only code snippets from messages.
    - Added AutoSuggestFromHistory to provide input suggestions based on past entries.
    - Updated the prompt method to include new key bindings in the instructions for improved user guidance.
    - Maintained separation of concerns by isolating key bindings functionality, with notes on future extensibility.
    
    This update introduces intuitive clipboard interactions and auto-suggestions, significantly improving the user experience by streamlining message copying and offering suggestions based on chat history.
    teleprint-me committed Feb 21, 2024
    Configuration menu
    Copy the full SHA
    90c174c View commit details
    Browse the repository at this point in the history
  3. fix: Prevent shawdowing prompt references and strip whitespace from m…

    …essage content injected into clipboard
    teleprint-me committed Feb 21, 2024
    Configuration menu
    Copy the full SHA
    2900cab View commit details
    Browse the repository at this point in the history

Commits on Feb 22, 2024

  1. Configuration menu
    Copy the full SHA
    15bb341 View commit details
    Browse the repository at this point in the history

Commits on Feb 25, 2024

  1. Configuration menu
    Copy the full SHA
    a3abfd9 View commit details
    Browse the repository at this point in the history
  2. rename: Move package directory from 'source' to 'rich_chat'

    - Rename package directory from 'source' to 'rich_chat' for proper naming conventions
    - Improve organization and separation of concerns in the codebase
    - Create a separate 'chat_history.py' module for the `ChatHistory` class
    - Move helper function 'keybinding' from 'rich-chat.py' to 'chat_history.py'
    - Move `ChatHistory` class from 'rich-chat.py' to 'chat_history.py' and remove unused imports in 'rich-chat.py'
    - Add import statement for 'ChatHistory' in 'rich-chat.py'
    - Rename package directory for proper naming conventions
    - Improve organization and separation of concerns
    - Consolidate related functionality into separate modules
    teleprint-me committed Feb 25, 2024
    Configuration menu
    Copy the full SHA
    dd5f7a9 View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    07f5fcf View commit details
    Browse the repository at this point in the history
  4. Rename module for better organization and consistency

    - Rename 'rich_chat.py' to 'rich_chat_cli.py' following Python library naming conventions
    - Add shebang line to rich_chat_cli.py for easier execution as a script
    
    This commit refactors the codebase by renaming the main 'rich_chat.py' file to 'rich_chat_cli.py' following Python library naming conventions.
    teleprint-me committed Feb 25, 2024
    Configuration menu
    Copy the full SHA
    603ad9c View commit details
    Browse the repository at this point in the history

Commits on Feb 27, 2024

  1. refactor: Integrate key_bindings function into ChatHistory class as…

    … a `@property`
    
    - Replace `key_bindings()` function with a new `@property` named `key_bindings`.
    - Update the `key_bindings` property to include new arguments for the index of the message to be copied.
    - Update the custom `prompt` message to reflect these changes and include minor formatting improvements.
    teleprint-me committed Feb 27, 2024
    Configuration menu
    Copy the full SHA
    e590c09 View commit details
    Browse the repository at this point in the history