Skip to content

coderpr0grammer/autocomplete-ai

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

AI Autocomplete Extension

Notes

I built this in like 30 minutes, so please be aware that there may be many bugs and issues.

Overview

The AI Autocomplete Extension is a Chrome extension designed to enhance your browsing experience by providing intelligent sentence completions for form fields on web pages. By pressing the Tab key, users can autofill inputs based on context-aware suggestions generated by Azure OpenAI.

Features

  • Autofills input fields by pressing the Tab key.
  • Context-aware suggestions based on nearby text and user-defined knowledge base.
  • Customizable settings for user-specific information.
  • Dynamic addition of custom fields to the knowledge base.

Getting Started

Prerequisites

  • Chrome Browser
  • Azure OpenAI account for accessing the completion API.

Installation

  1. Clone the repository:

    git clone https://github.com/yourusername/sentence-completion-suggester.git
    
  2. Navigate to the directory:

    cd sentence-completion-suggester
    
  3. Update the environment variables in your code:

    • AI_COMPLETIONS_ENDPOINT: Set your Azure OpenAI API endpoint.
    • AI_COMPLETIONS_API_KEY: Your API key for accessing Azure OpenAI.
  4. Load the extension in Chrome:

    • Go to chrome://extensions/.
    • Enable "Developer mode" (toggle in the top right).
    • Click "Load unpacked" and select the extension directory.

Configuration

You can configure the extension options via the options page. Enter general information and add specific fields relevant to your needs.

Files

  • manifest.json: Configuration file that defines the extension, including permissions and scripts.
  • options.html: HTML file for the options page where users can input their knowledge base.
  • options.js: JavaScript file handling the logic for saving user preferences and dynamically adding knowledge base fields.
  • content.js: Main script that interacts with web pages to provide autofill functionality based on user input and AI suggestions.

Usage

  1. Navigate to any web page with input fields.
  2. Click on an input field to focus on it. The extension will suggest completions based on your knowledge base and context.
  3. Press the Tab key to autofill the input with the suggested text.

How It Works

The extension utilizes the Azure OpenAI API to generate contextual suggestions based on:

  • The title of the page.
  • Headings present on the page.
  • Metadata description.
  • User-defined fields from the knowledge base.

Key Functions

  • getVisibleText(element): Retrieves visible text from a given HTML element.
  • removeStopWords(str): Cleans a string by removing common stop words.
  • getSuggestions(text): Calls the OpenAI API to get suggestions based on the input context.

Contributing

Contributions are welcome! Please submit a pull request or open an issue for any enhancements or bug fixes.

License

This project is licensed under the MIT License. See the LICENSE file for details.

Feel free to customize the content, especially the installation steps and repository links!

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published