> ## Documentation Index
> Fetch the complete documentation index at: https://mintlify.com/pfrankov/obsidian-local-gpt/llms.txt
> Use this file to discover all available pages before exploring further.

# Action Palette

> Run one-time AI actions with custom prompts using the Action Palette

The Action Palette is a powerful feature that lets you run one-time AI actions without creating permanent actions. Think of it as a quick input for ad-hoc AI requests.

<img width="600" alt="Action Palette" src="https://github.com/user-attachments/assets/8d32dc1d-9431-4a16-9336-c45e853a3242" />

## Opening the Action Palette

### Configure Hotkey

1. Open Obsidian Settings
2. Go to **Hotkeys**
3. Search for "Local GPT: Action Palette"
4. Click `+` and set your hotkey (recommended: `⌘ + J` or `Ctrl + J`)

### Using the Command Palette

Alternatively, open the command palette and search for "Local GPT: Action Palette".

## Features

### Custom Prompts

Type any prompt directly into the Action Palette to get an AI response:

<Steps>
  <Step title="Open the Action Palette">
    Press your configured hotkey (e.g., `⌘ + J`)
  </Step>

  <Step title="Type your prompt">
    Enter a natural language prompt like "Explain this code" or "Create a summary"
  </Step>

  <Step title="Submit">
    Press `Enter` to execute the action
  </Step>
</Steps>

<Tip>
  The Action Palette will use any selected text as context for your prompt.
</Tip>

### Provider & Model Selection

The Action Palette shows your currently configured provider and model at the top. You can switch providers on-the-fly:

<CodeGroup>
  ```typescript src/main.ts theme={null}
  showActionPalette(editorView, insertPos, {
    modelLabel: [
      provider.name,
      modelToShow,
      creativityLabel,
    ]
      .filter(Boolean)
      .join(" · "),
    
    getProviders: async () => {
      const aiProviders = await aiRequestWaiter.promise;
      return aiProviders.providers
        .filter((p) => Boolean(p.model))
        .map((p) => ({
          id: p.id,
          name: p.model,
          providerName: p.name,
        }));
    },
    
    onProviderChange: async (providerId: string) => {
      this.actionPaletteProviderId = providerId;
      this.actionPaletteModel = null;
    },
  });
  ```
</CodeGroup>

#### How to Change Provider

<Accordion title="Switching AI Provider">
  The Action Palette includes provider/model selection controls. Click on the provider badge to:

  * Switch between configured AI providers
  * Select a different model for the current provider
  * Change creativity settings (temperature)

  These changes only affect the Action Palette and don't modify your global settings.
</Accordion>

### Creativity Control

Adjust the creativity (temperature) for your prompt:

* **None**: Most deterministic responses
* **Low**: Balanced and focused (default)
* **Medium**: More creative variations
* **High**: Most creative and diverse outputs

<CodeGroup>
  ```typescript src/main.ts theme={null}
  const creativityKey = this.actionPaletteCreativityKey ?? 
    this.settings.defaults.creativity ?? "";

  const temperatureOverride = CREATIVITY[creativityKey]?.temperature;
  ```
</CodeGroup>

### File Selection for Context

The Action Palette allows you to select additional files to include as context:

<Steps>
  <Step title="Click the file selector">
    Look for the file picker icon in the Action Palette
  </Step>

  <Step title="Choose files">
    Select markdown (.md) or PDF (.pdf) files from your vault
  </Step>

  <Step title="Use as context">
    The content of selected files will be included in the AI request
  </Step>
</Steps>

<CodeGroup>
  ```typescript src/main.ts theme={null}
  getFiles: () => {
    return this.app.vault
      .getMarkdownFiles()
      .concat(
        this.app.vault
          .getFiles()
          .filter((f) => f.extension === "pdf"),
      )
      .map((file) => ({
        path: file.path,
        basename: file.basename,
        extension: file.extension,
      }));
  }
  ```
</CodeGroup>

<Note>
  Selected files are processed and included as additional context for your prompt, making responses more informed.
</Note>

### System Prompts

You can reuse system prompts from your existing actions:

<CodeGroup>
  ```typescript src/main.ts theme={null}
  getSystemPrompts: () => {
    return getRunnableActions(this.settings.actions)
      .filter((action) => action.system)
      .map((action) => ({
        name: action.name,
        system: action.system!,
      }));
  }
  ```
</CodeGroup>

This allows you to apply the behavior of saved actions to new prompts without recreating them.

## Example Use Cases

<AccordionGroup>
  <Accordion title="Quick Code Explanation">
    1. Select a code snippet
    2. Open Action Palette (`⌘ + J`)
    3. Type: "Explain this code in simple terms"
    4. Press Enter
  </Accordion>

  <Accordion title="Research with Context">
    1. Open Action Palette
    2. Select relevant research files using the file picker
    3. Type: "Based on these notes, what are the key themes?"
    4. Get a contextual summary
  </Accordion>

  <Accordion title="Creative Writing">
    1. Select your draft text
    2. Open Action Palette
    3. Set creativity to "High"
    4. Type: "Continue this story with an unexpected twist"
  </Accordion>
</AccordionGroup>

## Keyboard Shortcuts

<ResponseField name="Enter" type="keyboard">
  Submit the prompt and execute the action
</ResponseField>

<ResponseField name="Escape" type="keyboard">
  Cancel and close the Action Palette
</ResponseField>

## Implementation Details

<CodeGroup>
  ```typescript src/ui/actionPalettePlugin.ts theme={null}
  export function showActionPalette(
    view: EditorView,
    pos: number,
    options: ActionPaletteOptions,
  ) {
    const { fakeSelections, previousSelectionRanges, previousCursor } =
      captureSelectionSnapshot(view);

    view.dispatch({
      effects: ShowActionPaletteEffect.of({
        pos,
        options,
        fakeSelections,
        previousSelectionRanges,
        previousCursor,
      }),
    });
  }
  ```
</CodeGroup>

<Tip>
  The Action Palette preserves your cursor position and selection, even while the palette is open.
</Tip>

## Next Steps

<CardGroup cols={2}>
  <Card title="Enhanced Actions" icon="sparkles" href="/features/enhanced-actions">
    Learn about RAG-powered context enhancement
  </Card>

  <Card title="Vision Support" icon="image" href="/features/vision-support">
    Use AI to analyze images in your notes
  </Card>
</CardGroup>
