Copilot Section

Add a dedicated AI generation section to your blueprints for field-specific content generation.

The Copilot section provides a dedicated interface for generating content for a specific field. Unlike the Panel view button which targets multiple fields at once, the section focuses on a single field with additional features: persistent prompts saved between sessions, immutable prompts for locked workflows, and automatic file context on file pages.

Perfect for File Pages: Use files: auto to automatically include the current image or PDF as context – ideal for generating alt text, captions, or descriptions.

Basic Setup

Add a Copilot section to any blueprint by specifying the target field:

pages/default.yml
sections:
  content:
    type: fields
    fields:
      blocks:
        label: Content
        type: blocks

  copilot:
    type: copilot
    field: blocks

The Panel will display a collapsible Copilot interface below your fields:

Copilot section in closed state

Click on the arrow to expand the accordion, start entering your prompt, and generate content for the specified field by clicking the Generate button:

Copilot section in expanded state

Section Features

Prompt Storage

By default, prompts are saved to local storage and remembered between sessions. Each section has its own storage based on its position in the blueprint.

To disable storage:

sections:
  copilot:
    type: copilot
    field: blocks
    storage: false

Reset Prompt

If you've modified a predefined prompt, click the Reset button (circular arrow icon) to restore the original.

Undo Generation

After generating content, an Undo button appears to revert to the previous content.

Dynamic Prompts with KQL

Use Kirby Query Language to pull prompts dynamically from page fields:

sections:
  copilot:
    type: copilot
    field: blocks
    userPrompt: "{{ page.customPrompt.value }}"

This lets content editors define their own prompts in a dedicated field.

Configuration Reference

Sections support shared options (label, userPrompt, systemPrompt, icon, theme, logLevel) documented in the View Button & Field Configuration page, plus the following section-specific options:

See the Quick Reference for all keyboard shortcuts.

field String

Required. Specifies which field to generate content for. This should be the name of a field defined in the same blueprint.

sections:
  copilot:
    type: copilot
    field: blocks

editable Boolean

Control whether users can edit the prompt. Setting it to false is useful if a specific userPrompt should always be used without modifications.

Default: true

sections:
  copilot:
    type: copilot
    field: content
    userPrompt: Write a technical article about the topic "{title}"
    editable: false
Copilot section with immutable user prompt

files Boolean | String

Context is key to relevant AI-generated content. This option enables file attachments for providing context to the AI.

Default: true

Options: true, false, "auto"

To disable file attachments and prevent users from adding files, set the files property to false:

sections:
  copilot:
    type: copilot
    field: blocks
    files: false
Copilot section with files configuration

On a Kirby file page, setting files: auto pre-selects the current file as context for the user prompt. This is useful for generating metadata like alternative text or descriptions based on the image or PDF file that has already been uploaded to the Panel:

files/image.yml
sections:
  copilot:
    type: copilot
    field: alt
    # Use the uploaded file as context
    files: auto
    # Optional: Provide a predefined user prompt
    userPrompt: Write an alternative text for the provided image. Use a maximum of 10 words.
    # Optional: Disable the editing of the user prompt
    editable: false

The section above will use the current file of a Kirby file model as context for the user prompt:

Learn more about working with files on the dedicated Files as Context page.

open Boolean

Set the initial state of the prompt input accordion in sections.

Default: false (closed)

sections:
  copilot:
    type: copilot
    field: content
    open: true

storage Boolean

Enable or disable local storage for saving user prompts in the browser. When enabled, prompts are remembered between sessions.

Default: true

sections:
  copilot:
    type: copilot
    field: content
    storage: false

size String

Controls the size of buttons (Generate, Undo, Redo) in the Copilot section interface.

Default: md

Options: xs, sm, md, lg

sections:
  copilot:
    type: copilot
    field: content
    size: lg

help String

Provide additional help text or instructions for the Copilot section.

sections:
  copilot:
    type: copilot
    field: blocks
    help: |
      Example: Write a summary of this page and include the contents of {blocks}.