Skip to content
GreatubPublic

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation

lemon cha Browser Extension

Primary documentation: English · 简体中文

English is the source of truth for project documentation and release notes. The Chinese README is a supplementary translation; update it when user-facing behavior changes.

lemon cha is a lightweight Chrome and Firefox extension that opens a dedicated AI chat workspace for two kinds of model providers:

  • Custom LLM APIs that use an OpenAI Chat Completions-compatible format.
  • Local Ollama models, with http://127.0.0.1:11434/api/chat as the default endpoint.
  • Requests are sent from the browser extension background context.
  • Local Ollama requests include a direct-connect fallback that normalizes the local origin path.
  • The interface supports streaming output, stop generation, Markdown rendering, copyable code blocks, multi-session history, folders, rename/delete actions, Markdown export, and JSON import/export.

Screenshots

Current 0.2.8 interface with fictional demo content. Side Panel is shown at 400px beside a fictional reading page; this is a composed illustration, not automatic page extraction.

Chat workspace

Inline prompt preset and instructions

Translation chat

Model settings — API key empty

Side Panel beside a demo reading page

Install locally in Chrome

  1. Open Chrome and visit chrome://extensions/.
  2. Enable Developer mode.
  3. Click "Load unpacked".
  4. Select dist/lemon-cha after running npm run build:chrome.
  5. Click the extension action to open or focus the lemon cha workspace tab. Use the side panel button in the workspace header to chat alongside a page.

Install locally in Firefox

  1. Run npm run build:firefox.
  2. Open Firefox and visit about:debugging#/runtime/this-firefox.
  3. Click "Load Temporary Add-on...".
  4. Select dist/lemon-cha-firefox/manifest.json.
  5. Click the extension action to open lemon cha in a dedicated browser tab.

Development checks

lemon cha is a lightweight Manifest V3 extension without a frontend bundler. The repository uses npm scripts for validation and packaging:

npm run lint
npm run typecheck
npm run build
  • npm run lint: validates required extension files, Chrome and Firefox Manifest V3 setup, HTML asset references, and JavaScript syntax.
  • npm run typecheck: runs a lightweight syntax-oriented validation pass for this vanilla JavaScript project.
  • npm run build: copies runtime files into dist/lemon-cha for Chrome and dist/lemon-cha-firefox for Firefox.
  • npm run build:chrome: builds only the Chrome package.
  • npm run build:firefox: builds only the Firefox package.

Firefox uses the same runtime code with a generated Firefox manifest. The generated manifest swaps Chrome's background.service_worker for Firefox's background.scripts and adds Gecko extension settings required for Firefox distribution.

Custom API settings

Choose the custom API workflow and configure:

  • Endpoint, for example https://api.openai.com/v1/chat/completions
  • Model name, for example gpt-4o-mini
  • API key, if the provider requires one
  • API format: OpenAI Chat Completions or Ollama /api/chat
  • Thinking mode behavior
  • Interface language, answer language, and default translation target language

If the API format is OpenAI-compatible and the endpoint only contains the domain or /v1, lemon cha completes it to /v1/chat/completions. Provider-specific paths can still be entered manually.

Built-in provider presets include DeepSeek, OpenAI, Qwen DashScope, Kimi, SiliconFlow, OpenRouter, Groq, and local Ollama. The composer shows each service with its configured model name. Adding an API key or changing that model updates the existing service entry. Independently configured custom endpoints appear as their own entries; settings always retain the Custom entry for adding one.

When you save an endpoint outside the built-in hosts in Chrome, grant access to its site in the Chrome prompt. If you later remove the grant, save the endpoint again to restore access.

Model parameter compatibility

New configurations default to DeepSeek deepseek-flash, OpenAI gpt-6.1-terra, and Kimi kimi-k3.1-pro. Previously saved models, endpoints, and API keys are preserved; outdated model IDs receive a settings notice rather than being silently replaced.

Known official endpoints use model-specific output fields, sampling limits, and native reasoning controls. Kimi models with mandatory reasoning show the thinking control as enabled and unavailable for toggling. Fixed or provider-managed temperature is disabled with an explanation. Unknown custom gateways retain the generic OpenAI-compatible request format.

Context limits count user turns, retaining their assistant replies. Known context windows use a conservative UTF-8 byte estimate to remove whole older turns while reserving output space; this is not an exact tokenizer. Reply metadata indicates when output reaches its token limit. Local Ollama receives explicit thinking on/off where supported, with a single compatibility retry for unsupported think options.

Conversation management

  • Create new conversations.
  • Switch between saved chats from the sidebar.
  • Organize chats inside folders.
  • Rename or delete conversations.
  • Export the current chat as Markdown.
  • Import or export JSON records containing conversations, settings, and custom prompt presets.
  • Clear history or restore factory defaults from the data settings area.

Message actions

Each assistant or user message can expose compact actions such as:

  • Copy
  • Regenerate
  • Continue from here
  • Delete

Connection checks

The connection checker supports:

  • Ollama /api/tags for model discovery and reachability checks
  • OpenAI-compatible lightweight test requests for endpoint, model, and API key verification

Generation experience

  • Streaming model responses
  • Stop generation while preserving partial output
  • Dynamic waiting state for slower local models
  • Generation timing and approximate token metrics
  • Automatic first-turn conversation title generation
  • Markdown rendering for paragraphs, lists, emphasis, code blocks, and tables
  • Copy button inside code blocks
  • Persistent bottom composer for long conversations
  • Collapsible sidebar for a cleaner reading surface

Prompt presets

The sidebar and composer provide reusable presets for summarization, code review, troubleshooting, rewriting, and planning. Translation remains available through the dedicated translation mode.

Built-in templates are localized for Simplified Chinese, Traditional Chinese, English, Japanese, Korean, French, Spanish, and German.

  • Selecting or switching a preset preserves the text you have entered.
  • A compact preset tag inside the composer shows the selected action. Expand it to view its instructions, or use the adjacent × button to return to ordinary chat without clearing your text.
  • The input shows a short task hint instead of the full instructions. Selecting, switching, and removing presets preserves the composer height.
  • Instructions and user text are combined when sending. Each user message stores the preset name and resolved instructions used for that message, so context and regeneration retain the original preset even if it is later changed or removed.
  • Translation uses the target language selected in Settings or the composer.

Ollama setup

Start Ollama and install a local model:

ollama serve
ollama pull llama3.1

Default lemon cha settings:

  • Endpoint: http://127.0.0.1:11434/api/chat
  • Model: llama3.1

Connection strategy:

  • localhost is normalized to 127.0.0.1.
  • /api/tags is used for model listing and connectivity tests.
  • /api/chat is used for multi-turn chat and streaming.
  • Local Ollama requests are handled from the extension background context.

Ollama 403 / Origin rejection

If Ollama rejects the browser extension origin, restart Ollama with extension-origin allowance.

macOS Ollama app:

launchctl setenv OLLAMA_ORIGINS "chrome-extension://*,moz-extension://*"

Quit the Ollama menu bar app completely, then open it again.

macOS/Linux command line:

OLLAMA_ORIGINS="chrome-extension://*,moz-extension://*" ollama serve

Temporary broad debug option:

OLLAMA_ORIGINS="*" ollama serve

Windows PowerShell:

$env:OLLAMA_ORIGINS="chrome-extension://*,moz-extension://*,http://localhost:*,http://127.0.0.1:*"
ollama serve

Repository layout

  • manifest.json: source Chrome Manifest V3 configuration
  • scripts/build-extension.js: Chrome and Firefox extension package builder
  • background.js: background networking and provider calls
  • chat.html: dedicated chat page
  • styles.css: visual system and responsive layout
  • popup.js: state, settings, conversations, and UI flows
  • chrome-store/: Chrome Web Store listing, privacy, review, and release materials

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages