Skip to content

Repository files navigation

✨ Prompt Enhancer & RTL Fix

License: MIT Chrome Version Providers

A Chrome extension that turns rough ideas into well-structured, effective prompts for LLMs — with streaming results, a diff-and-approve preview, templates, history, and an automatic RTL/LTR text-direction fix for Persian and Arabic.

Overview

Prompt Enhancer puts a small floating toolbar next to whatever text field you are typing in. Press Enhance and the model rewrites your rough input into a strong, self-contained prompt — streaming word by word into a preview card where you can read it, diff it against your original, regenerate it, or apply it to the field.

What's new in 5.0

Area Before (4.0) Now (5.0)
Result flow Text was replaced instantly, sight unseen Streaming preview card with Result / Original / word-level diff tabs, then Apply — or keep the instant behaviour
In-page UI A button injected into each input's parent, styled by page-level CSS One Shadow DOM toolbar that follows the focused field — immune to host-page CSS, no parent mutation, no per-site hacks
Response Wait for the whole reply SSE streaming with a live word count and a Stop button
Where it runs 30 hard-coded AI sites Same list by default, or every site, plus per-site allow/block lists
Styles 6 modes 9 modes (adds Research, Image, Rewrite) plus your own custom styles
Surfaces Popup only Popup + side-panel workspace + full options page + context menu
Memory None History (searchable, restorable) and templates
API keys storage.sync — pushed to every signed-in device storage.local — this device only, with automatic migration
RTL fix Forced dir="rtl", skipped the fields you type in dir="auto" per block plus the input you are typing in, idle-scheduled so it doesn't jank the page
Look One dark theme Theme (system/dark/light), 6 accent colours, English and Persian UI

Features

Enhancement

  • ✨ Streaming preview — words arrive live; stop, regenerate, copy, or apply with Ctrl+Enter
  • 🔍 Word-level diff — see exactly what changed against your original before you accept it
  • 🎛️ 9 enhance styles — Concise (default), Standard, Detailed, Coding, Writing, Reasoning, Research, Image, Rewrite — each with its own system prompt, temperature and token budget
  • 🧩 Custom styles — write your own system instructions; they appear everywhere the built-ins do
  • 🌍 Output language — keep the input language or force one of 9 targets
  • 📝 Custom instructions — up to 1000 characters applied on top of every style
  • 🎯 Selection-aware — select part of a field and only that part is rewritten, restored in place
  • ↩️ 15-step undo per field

Providers

  • 🔀 5 free-tier providers — Groq, OpenRouter, Gemini, Cerebras, Mistral, each with its own key and model
  • 🔄 Live model list — pull the provider's current catalogue instead of relying on a hard-coded list (cached 12h)
  • 🛡️ Friendly errors — invalid key, exhausted credits, rate limit (with automatic retry), unknown model, oversized input, timeout, offline
  • 🔐 Keys stay local — chrome.storage.local only; v4 keys are migrated out of sync storage and scrubbed

Surfaces

  • 🪟 Floating toolbar — follows the focused or hovered field; style menu, templates, undo, copy, per-site toggle
  • 🧰 Side-panel workspace — compose, enhance, diff, browse templates and history without leaving the page
  • ⚙️ Options page — providers, styles, behaviour, appearance, sites, templates, usage stats, backup
  • 🖱️ Context menu — enhance any selection, in any style, from the right-click menu
  • ⌨️ Shortcuts — enhance, open workspace, cycle style, toggle the current site

Memory & data

  • 🕘 History — searchable, expandable, restore / copy / insert / delete, capped at your chosen size
  • 🗂️ Templates — 6 built-in starting points plus your own, insertable from the toolbar or workspace
  • 📊 Usage stats — enhancements, tokens, characters, top provider and style
  • 💾 Backup — export/import everything as JSON, with or without API keys

Text direction

  • 🌐 RTL/LTR auto-fix — Persian/Arabic blocks get dir="auto", which handles mixed text correctly
  • ⌨️ Input direction — the field you type into flips too (v4 skipped it)
  • 🔤 Bundled Vazirmatn — loaded from the extension, so it works under strict site CSPs
  • 🎚️ Each part can be turned off independently

Installation

  1. Download this repository as a ZIP and extract it (or git clone).
  2. Open chrome://extensions/.
  3. Turn on Developer mode (top right).
  4. Click Load unpacked and select the extracted folder.
  5. The options page opens on first install — add a free API key there. Pin the extension for quick access.

Requires Chrome 116 or newer.

Getting started

  1. Add a key. Open the options page → Providers. Groq and Cerebras have the most generous free tiers; no credit card for any of them.
  2. Pick a style. Options → Styles, or the chip row in the popup, or the style menu on the in-page toolbar.
  3. Enhance. Focus any text field on a supported site, press Ctrl+Shift+E or click the toolbar's Enhance.
  4. Review. Read the streaming result, flip to Diff to see what changed, then Apply (Ctrl+Enter).

Prefer the old instant behaviour? Options → Behaviour → turn off Preview before applying.

Enhance styles

Style Best for
⚡ Concise (default) 10–15 sentences in 2–3 paragraphs — sharpens without adding scaffolding
🎯 Standard Balanced, general-purpose, full framework
📐 Detailed Acceptance criteria, edge cases, definition of done
💻 Coding Language/version, constraints, I/O examples, error handling, tests
✍️ Writing Audience, tone, voice, length, structure, revision checklist
🧠 Reasoning Step-by-step analysis before the final answer
🔎 Research Scope, time range, credible sources, citations, stated uncertainty
🎨 Image Dense visual prompt for Midjourney / DALL·E / Flux / SD, with a negative line
🔁 Rewrite Polishes wording only — no new content, same language and length

Add your own under Options → Styles → New style.

Keyboard shortcuts

Action Windows / Linux macOS
Enhance the focused prompt Ctrl+Shift+E Cmd+Shift+E
Open the workspace Ctrl+Shift+U Cmd+Shift+U
Cycle to the next style (unassigned) (unassigned)
Enable / disable on this site (unassigned) (unassigned)
Apply the previewed result Ctrl+Enter Cmd+Enter
Close the preview Esc Esc

Assign the unassigned ones at chrome://extensions/shortcuts.

Supported models

Groq — fastest free tier, key at console.groq.com/keys

Model Model ID
Qwen 3.8 27B (default) qwen/qwen3.8-27b
Llama 3.3 70B (Versatile) llama-3.3-70b-versatile
Llama 3.1 8B (Fast) llama-3.1-8b-instant
Llama 4 Maverick 17B meta-llama/llama-4-maverick-17b-128e-instruct
Llama 4 Scout 17B meta-llama/llama-4-scout-17b-16e-instruct
Kimi K2 (Reasoning) moonshotai/kimi-k2-instruct
GPT OSS 120B openai/gpt-oss-120b
GPT OSS 20B (Fast) openai/gpt-oss-20b
Qwen 3 32B qwen/qwen3-32b
Qwen 3.6 27B qwen/qwen3.6-27b

OpenRouter — widest free catalogue, key at openrouter.ai/keys

Model Model ID
OpenRouter Free Router (default) openrouter/free
Dots3 Note Preview dots-studio/dots-3-note-preview:free
Liquid LFM 2.5 2.6B liquid/lfm-2.5-2.6b:free
NVIDIA Nemotron 3.5 Lightning nvidia/nemotron-3.5-lightning:free
Thinking Machines Inkling thinkingmachines/inkling:free
Poolside Laguna S 2.1 poolside/laguna-s-2.1:free
Cohere North Mini Code cohere/north-mini-code:free
GLM 5.2 z-ai/glm-5.2:free
MiniMax M3 minimax/minimax-m3:free

Gemini — key at aistudio.google.com

Model Model ID
Gemini 3.8 Flash (default) gemini-3.8-flash
Gemini 2.5 Flash gemini-2.5-flash
Gemini 2.5 Pro gemini-2.5-pro

Cerebras — 1M tokens/day free, key at cloud.cerebras.ai

Model Model ID
GPT OSS 120B (default) gpt-oss-120b
Llama 3.1 8B (Fast) llama3.1-8b

Mistral — key at console.mistral.ai

Model Model ID
Mistral Small (default) mistral-small-latest
Mistral Large mistral-large-latest
Codestral (Code) codestral-latest
Mistral Nemo open-mistral-nemo

💡 Use Refresh model list in the popup or options page to pull each provider's current catalogue. Saved models that a provider later removes fall back to the default automatically.

Where it runs

By default the toolbar appears on ~32 known AI chat sites: ChatGPT, Claude, Gemini, AI Studio, NotebookLM, DeepSeek, Qwen, Kimi, Groq Console, Perplexity, Copilot, Mistral, Hugging Face Chat, Grok, Cohere, Z.ai, Poe, Character.ai, Duck.ai, DuckDuckGo AI Chat, You.com, Phind, Pi, Meta AI, LMArena, T3 Chat, OpenRouter Chat and more.

Options → Sites lets you switch to every site (so it works in Gmail, GitHub, Notion, docs — anywhere with a text field), add individual sites, or block sites you never want it on. The badge reads off on blocked sites.

Privacy

  • Your text is sent only to the provider you selected, using your API key, over HTTPS.
  • API keys live in chrome.storage.local — this device only, never synced to your Google account, never transmitted anywhere but the provider.
  • History and templates are stored locally and can be cleared or exported at any time.
  • Nothing is sent to the extension author. There is no analytics, telemetry or remote server.
  • On sites where the extension is disabled, the content script does nothing beyond one settings lookup.

Architecture

manifest.json        MV3, module service worker, side panel, context menus
background.js        streaming requests over ports, context menus, badge, history, stats
content.js           Shadow DOM toolbar + preview card, RTL fix, editor adapters
popup.html/css/js    quick enhance, essential settings, history
sidepanel.html/js    full workspace
options.html/js      every setting, custom styles, templates, backup
src/providers.js     provider registry, modes, prompt building, output cleaning
src/settings.js      storage schema, defaults, site gating, v4→v5 migration
src/i18n.js          English + Persian dictionaries, RTL layout
ui/theme.css         design tokens and shared components
ui/common.js         stream client, dropdown, diff, formatting helpers

Rich-editor support (ProseMirror, Lexical, Draft, plain React textareas) is handled by setNativeValue in content.js, which drives the native value setter and dispatches the events frameworks listen for.

Upgrading from 4.x

Settings and API keys migrate automatically the first time 5.0 runs — keys move from sync to local storage and the old flat keys are removed. Nothing to do by hand. A backup of the 4.0 source sits in .backup/.

Contributing

Contributions are welcome — fork, change, and open a pull request. Adding an OpenAI-compatible provider is usually a single entry in src/providers.js plus its origin in host_permissions.

License

Released under the MIT License.

About

No description, website, or topics provided.

Resources

Stars

9 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages