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
number
Override temperature for this action. If not specified, uses the default creativity setting.Range: 0.0 to 1.0
0.0- Deterministic, focused1.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 transformationboolean
default:"false"
If
true, adds a visual separator in action menusCommunityActionRef
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 insrc/main.ts:349: