AI Chat Autocomplete is a Chrome extension that provides intelligent autocomplete functionality for ChatGPT and Claude AI interfaces. It learns from the user's input and suggests relevant completions as they type, enhancing the chat experience and improving efficiency.
- Intelligent autocomplete suggestions based on previous prompts
- N-gram based prediction model (up to trigrams) for more accurate suggestions
- Supports both ChatGPT and Claude AI chat interfaces
- Adaptive positioning of autocomplete suggestions for different chat layouts
- Keyboard navigation for prompt history (up/down arrow keys)
- Tab key completion for quick input of suggestions
- Automatically saves and loads prompts for a seamless experience
- Debug mode for easier troubleshooting and development
- Download or clone the repository to your local machine.
- Open Google Chrome and navigate to
chrome://extensions
. - Enable "Developer mode" in the top right corner.
- Click on "Load unpacked" and select the directory containing the extension files.
- The AI Chat Autocomplete extension should now be installed and active.
- Navigate to either https://chat.openai.com (ChatGPT) or https://claude.ai (Claude) in your Chrome browser.
- Start typing in the chat input field.
- As you type, the extension will display autocomplete suggestions above the input field.
- Press the Tab key to accept the top suggestion, or continue typing to ignore the suggestions.
- Use the up and down arrow keys to navigate through your prompt history.
- Press Enter to submit your prompt, which will be saved for future suggestions.
The extension requires the following permissions:
storage
: To save and load previous prompts.activeTab
: To interact with the current tab and detect the chat interface.https://chat.openai.com/*
andhttps://claude.ai/*
: To run the content script on these specific websites.
The extension consists of the following main components:
content.js
: The core script that runs on the ChatGPT and Claude websites, implementing the autocomplete functionality and interacting with the chat interface.manifest.json
: The extension manifest file that defines the extension's configuration, permissions, and scripts.
buildNgramModel
: Constructs an n-gram model from previous prompts for prediction.predictNextWord
: Uses the n-gram model to predict the next word based on input.setupAutocomplete
: Sets up the autocomplete functionality for the input element.updateIndicator
: Updates the autocomplete suggestion display.handleInput
andhandleKeyDown
: Manage user input and keyboard interactions.findAndSetupInputElement
: Locates and initializes the chat input element.
To work on this extension:
- Clone the repository.
- Make changes to the
content.js
file as needed. - To enable debug logging, set
const DEBUG = true;
at the top ofcontent.js
. - Load the extension in Chrome as an unpacked extension for testing.
- Refresh the extension and the target pages after making changes.
Contributions to the AI Chat Autocomplete extension are welcome! If you find any issues or have suggestions for improvements, please open an issue or submit a pull request on the GitHub repository.
This project is licensed under the MIT License.