Skip to content

A Chrome/Edge extension that adds AI-powered text enhancement capabilities to any input field or textarea on web pages, featuring advanced agent management and OpenAI Assistant API integration.

Notifications You must be signed in to change notification settings

arbhuiyan/ai-text-enhancer-extension

Repository files navigation

⚠️ Disclaimer

This extension is provided "as-is" without any warranty or guarantee of security or functionality. Use at your own risk. The developers are not responsible for any data loss, security breaches, or other issues that may arise from using this extension. Always review and test the functionality thoroughly before relying on it for important tasks.

Text Enhancer Chrome Extension

A Chrome/Edge extension that adds AI-powered text enhancement capabilities to any input field or textarea on web pages, featuring advanced agent management and OpenAI Assistant API integration.

Demo

Text Enhancer Demo

The extension in action: hover over any input field to reveal the ✨ enhancement button, select an action, and watch your text get enhanced in real-time.

Features

Core Functionality

  • Hover over any input field or text area to reveal the enhancement button (✨)
  • Rich Text Editor Support: Works with contenteditable elements including Azure DevOps work items, rich text editors, and modern web applications
  • Pre-configured enhancement actions (Enhance, Shorten, etc.)
  • Custom prompts for specific enhancements
  • Global actions that work across all websites
  • Domain blacklisting to disable the extension on specific sites

Agent System

  • Professional Default Agent: Built-in professional text enhancement assistant with comprehensive capabilities
  • Multiple AI Agents: Define custom agents with specific personalities and capabilities
  • OpenAI Integration: Built-in support for OpenAI Assistant API with customizable parameters
  • Flexible Configuration: Customize model, temperature, top_p, max_tokens, and system messages per agent

Installation

  1. Clone or download this repository
  2. Open Chrome and navigate to chrome://extensions/
  3. Enable "Developer mode" in the top right
  4. Click "Load unpacked" and select the extension folder
  5. The extension icon should appear in your toolbar

Configuration

API Setup

The extension supports multiple API providers and authentication methods. Configure your API settings through the options page.

Option 1: OpenAI API

  1. Get your OpenAI API Key:

    • Go to OpenAI API Keys
    • Sign in to your OpenAI account (create one if needed)
    • Click "Create new secret key"
    • Copy the generated key (starts with sk-)
    • Important: Make sure you have credits in your OpenAI account
  2. Configure the Extension:

    • Right-click the extension icon and select "Options" (or click the gear icon in the popup)
    • In the "API Configuration" section:
      • API Endpoint: Leave empty (uses default OpenAI endpoint)
      • API Key: Paste your OpenAI API key
      • Authentication Type: Select "Bearer Token (OpenAI)"
    • Click "Save API Settings"

Option 2: Custom API Provider

For custom OpenAI-compatible APIs or other providers:

  1. Configure Custom Endpoint:

    • API Endpoint: Enter your custom API URL (e.g., https://your-api.com/v1/chat/completions)
    • API Key: Enter your API key
    • Authentication Type: Choose the appropriate method:
      • Bearer Token (OpenAI): Uses Authorization: Bearer {your-key} header
      • Custom Header: Allows you to specify a custom header name
  2. Custom Header Examples:

    • For x-api-key header: Select "Custom Header" and enter x-api-key
    • For Api-Key header: Select "Custom Header" and enter Api-Key
    • For custom Authorization: Select "Custom Header" and enter Authorization

Common API Providers Configuration

OpenAI (Default):

  • Endpoint: https://api.openai.com/v1/chat/completions (or leave empty)
  • Auth Type: Bearer Token (OpenAI)
  • Header: Authorization: Bearer sk-...

Azure OpenAI:

  • Endpoint: https://your-resource.openai.azure.com/openai/deployments/your-deployment/chat/completions?api-version=2023-05-15
  • Auth Type: Custom Header
  • Header Name: api-key

Custom Proxy/Gateway:

  • Endpoint: Your custom endpoint URL
  • Auth Type: Custom Header (if using non-standard auth)
  • Header Name: As required by your provider

Agent Management

  1. Create Custom Agents:

    • Enter agent name and system message
    • Optionally customize model parameters (temperature, top_p, max_tokens, n)
    • Click "Add Agent"
  2. Agent Selection:

    • The default agent provides professional text enhancement
    • Custom agents can be assigned to specific actions
    • If no custom agent is specified, the default agent is used

Default Model Configuration

  1. Set Default Model:
    • Configure the default AI model used by the extension
    • This model is used for the default agent and as fallback for custom agents
    • Enter any supported model name (e.g., "gpt-4o", "gpt-3.5-turbo", "claude-3-haiku")
    • Click "Save Default Model" to apply changes

Actions Configuration

  • Add global actions that work on all websites
  • Blacklist domains where you don't want the extension active

Usage

  1. Navigate to any webpage with input fields, textareas, or rich text editors
  2. Hover over a text input area to see the ✨ button appear
  3. Click the button to open the enhancement dropdown
  4. The dropdown shows which agent is currently active
  5. Choose from predefined actions or enter a custom prompt
  6. The enhanced text will replace the original content

Supported Element Types

  • Standard Form Elements: <input type="text">, <textarea>
  • Rich Text Editors: contenteditable elements
  • Azure DevOps: Work item descriptions, acceptance criteria, and other rich text fields
  • Modern Web Apps: Most contemporary rich text editing components

Agent Examples

Content Writer Agent

Name: Content Writer
System Message: You are a professional content writer who specializes in creating engaging, clear, and compelling copy. Focus on readability, audience engagement, and brand voice consistency.
Temperature: 0.3

Technical Writer Agent

Name: Technical Writer  
System Message: You are a technical documentation expert. Write clear, precise, and well-structured technical content. Use proper terminology and ensure accuracy.
Temperature: 0.1

Creative Writer Agent

Name: Creative Writer
System Message: You are a creative writer with a flair for storytelling. Add creativity, emotion, and vivid descriptions while maintaining the core message.
Temperature: 0.7

Default Agent Parameters

When no custom agent is selected, the system uses these defaults:

{
  "model": "[configured default model or 'gpt-4o']",
  "temperature": 0.1,
  "top_p": 0.1, 
  "max_tokens": 4096,
  "n": 1,
  "system_message": "You are a professional text enhancement assistant..."
}

Note: The model parameter uses the configured default model from the options page. If not configured, it falls back to "gpt-4o".

Files Structure

  • manifest.json - Extension configuration
  • background.js - Handles OpenAI API calls with agent support
  • content.js - Injects enhancement UI and handles agent selection
  • content.css - Styles for the enhancement UI
  • popup.html/js/css - Extension settings interface with agent management
  • icons/ - Extension icons

Development

To modify the extension:

  1. Make changes to the relevant files
  2. Go to chrome://extensions/
  3. Click the refresh icon on the extension card
  4. Test your changes on web pages

Troubleshooting

Common Issues

  1. Enhancement button not appearing:

    • Check if the current domain is blacklisted in settings
    • Refresh the page after installing/updating the extension
    • Ensure the input field is visible and not too small
  2. API Authentication Errors:

    • 401 Unauthorized: Invalid API key or wrong authentication type
    • 403 Forbidden: API key doesn't have required permissions
    • 429 Rate Limited: Too many requests, wait and try again
    • 500 Server Error: API provider issue, try again later
  3. API Key Issues:

    • Verify your API key is correct and hasn't expired
    • For OpenAI: Ensure you have credits in your account at OpenAI Billing
    • For custom APIs: Check with your provider about key validity
  4. Authentication Type Problems:

    • OpenAI users: Use "Bearer Token (OpenAI)" authentication
    • Custom APIs: Check your API documentation for required headers
    • Azure OpenAI: Use "Custom Header" with header name api-key
  5. Custom Endpoint Issues:

    • Ensure the endpoint URL is correct and accessible
    • Check if the API expects specific URL parameters
    • Verify the endpoint accepts the same request format as OpenAI
  6. Agent not working:

    • Ensure agent configuration is saved properly
    • Check if the model name is supported by your API provider
    • Verify temperature and other parameters are within valid ranges
  7. Settings not saving:

    • Try disabling and re-enabling the extension
    • Clear browser cache and try again

API Provider Specific Help

OpenAI API:

Azure OpenAI:

  • Use your Azure OpenAI resource endpoint
  • Authentication header: api-key
  • Include API version in the URL

Custom Providers:

  • Check provider documentation for authentication requirements
  • Ensure endpoint compatibility with OpenAI chat completions format
  • Contact your provider for specific configuration help

Storage

The extension stores configuration in Chrome's sync storage:

  • agents - Array of custom agent definitions
  • actions - Text enhancement actions with agent assignments
  • apiKey - API key for the configured provider
  • apiUrl - Custom API endpoint URL (optional)
  • authType - Authentication type (bearer or custom)
  • customHeaderName - Custom header name for authentication
  • defaultModel - Default AI model used when no specific model is configured
  • blacklistedDomains - Domains where extension is disabled

Resources

Additional resources and documentation:

License

MIT License

About

A Chrome/Edge extension that adds AI-powered text enhancement capabilities to any input field or textarea on web pages, featuring advanced agent management and OpenAI Assistant API integration.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published