Skip to main content

LocalGPTAction

Defines a custom AI action that can be triggered from the editor.
src/interfaces.ts

Properties

string
required
Display name of the action shown in menus and command paletteExample: "🪄 General help" or "✍️ Continue writing"
string
required
The user prompt sent to the AI model. Can be empty for freeform actions.Special keywords:
  • {{=SELECTION=}} - Replaced with selected text
  • {{=CONTEXT=}} - Replaced with context from linked files
  • {{=CONTEXT_START=}} / {{=CONTEXT_END=}} - Conditional context blocks
Example:
number
Override temperature for this action. If not specified, uses the default creativity setting.Range: 0.0 to 1.0
  • 0.0 - Deterministic, focused
  • 1.0 - Creative, varied
string
System prompt that defines the AI’s behavior and roleExample:
boolean
default:"false"
If true, replaces the selected text with the AI output instead of appending belowUse case: Grammar correction, text transformation
boolean
default:"false"
If true, adds a visual separator in action menus
CommunityActionRef
Metadata for community-shared actions. See CommunityActionRef.

CommunityActionRef

Metadata for actions imported from the community repository.
src/interfaces.ts

Properties

string
required
Unique identifier for the community action
string
required
Language code (e.g., "en", "es", "fr")
string
required
Display name of the community action
string
required
Content hash for version tracking and updates
string
ISO timestamp of last update
string
Description of what the action does

Action Examples

Basic Action

Simple summarization action:

Replace Action

Grammar correction that replaces selected text:

Freeform Action

General help action with empty prompt (user provides prompt at runtime):

High Creativity Action

Creative writing with custom temperature:

Community Action

Action imported from community repository:

Usage in Code

Actions are executed in src/main.ts:349:
Actions can use context from linked files automatically. The RAG system processes [[wikilinks]] in the selection and includes relevant content based on the context limit setting.