Section Blueprints
These blueprint examples will add a Kirby Copilot section to your Panel that interacts with the specified field.
Blocks, Writer, and Textarea Fields
sections:
content:
type: fields
fields:
myBlocks:
label: Blocks
type: blocks
myWriter:
label: Writer
type: writer
myTextarea:
label: Textarea
type: textarea
buttons: false
copilot:
type: copilot
field: myBlocks # Or `myWriter` or `myTextarea`
Predefined User Prompt
sections:
content:
type: fields
fields:
metaDescription:
label: Meta Description
type: textarea
buttons: false
copilot:
type: copilot
field: metaDescription
userPrompt: 'Generate a SEO meta description in 140 characters max for my article "{title}":\n{text}'
files: false
Immutable User Prompt
sections:
content:
type: fields
fields:
metaDescription:
label: Meta Description
type: textarea
buttons: false
copilot:
type: copilot
field: metaDescription
userPrompt: 'Generate a SEO meta description in 140 characters max for my article "{title}":\n{text}'
editable: false
files: false
Kirby Query Language (KQL)
sections:
content:
type: fields
fields:
blocks:
label: Blocks
type: blocks
copilot:
type: copilot
field: blocks
userPrompt: "{{ page.myPrompt.value }}"
editable: false
files: false
Panel File as Context Source
On a Kirby file page, you can pre-select the current file as context for the user prompt. This is useful if you want to generate text for a specific file, such as an image or PDF, that has already been uploaded to the Panel.
Consider the following scenario: Your client is concerned about accessibility and wants to use alternative texts for all the images on their website. It would be too cumbersome to manually select each image as the context for the prompt. Instead, you can set the files
option to auto
and let the plugin automatically read the uploaded file:
The following example shows how to use the current file of a Kirby file model as context for the user prompt:
sections:
content:
type: fields
fields:
alt:
label: Alternative Text
type: text
copilot:
type: copilot
# Write the generated text to the `alt` field
field: alt
# Provide a pre-defined user prompt
userPrompt: Write an alternative text for the provided image. Use a maximum of 10 words.
# Prevent the user from editing the prompt
editable: false
# Use the file of the current Kirby file model as context
files: auto