Search by

vectorbross / vb_ai_summary

vectorbross

Adds an AI button to generate the summary on content types that have a summary field.

Package info

bitbucket.org/vectorbross/vb_ai_summary

Type:drupal-recipe

pkg:composer/vectorbross/vb_ai_summary

Statistics

Installs: 0

Dependents: 0

Suggesters: 0

dev-master 2026-11-27 11:21 UTC

This package is not auto-updated.

Last update: 2026-12-03 21:57:21 UTC


README

Adds AI generated summaries on top of vb_ai_core. Webmasters and administrators get a Generate summary button under the summary field (see Permissions). The field is filled with a short teaser based on the page content, which they can edit before saving.

The button is only added to content types that have field_summary. Content types without it are left alone.

What it installs

ModulePurpose
field_widget_actionsShows the generate button under the field
ai_automatorsRuns the prompt (part of drupal/ai)
maxlengthCharacter counter under the field
vb_ai_widget_actionsConfig action that adds the button only where the field exists

It also applies vb_ai_core (ai, key, token) first.

What it configures

Button per content type

Field on the content typeButtonCounter
field_summaryGenerate summary250 chars

A content type gets the button when:

  • it has a field with exactly the machine name field_summary;
  • the field is a Text (plain), Text (plain, long), Text (formatted) or Text (formatted, long) field;
  • the field is visible on the default form display with a normal text field or text area widget.

In every other case the content type is skipped. Fields skipped because of an unsupported type or widget are logged in the vb_ai_widget_actions channel in Recent log messages.

The summary that is part of a Text (formatted, long, with summary) field, such as the summary of the core body field, is not supported. Use a separate field_summary field.

For each content type with field_summary, the recipe creates an AI Automator (node.<type>.field_summary.default) and adds the button and the counter to the form display. The automator only runs when the button is clicked, never on save.

What the AI reads

The AI gets the first of these fields that exists on the content type: body, field_body. If neither exists, it gets the node title. It reads the values in the form, so unsaved changes are included.

field_intro is not used as page content on purpose: an intro is usually a summary itself and gives the AI too little to work with.

Prompt

SettingValueEffect
Languagepage languageThe summary matches the page content
Length2–3 sentences, max 250 charsFits a teaser and a plain text field (255 chars by default)
Contentpage facts onlyWhat the page is about and why it is useful, nothing invented
Formatplain textNo title, list, markdown, HTML, quotes or emoji
Countersoft limitWarns when the text is too long, does not block saving
ai_providerdefaultThe default chat provider and model are used

Requirements

  • Drupal 11.4+
  • Drush 13+
  • The project setup from vb_ai_core (composer/installers 2.3+, the recipes/{$name} installer path and the VB repositories entry)
  • A chat capable provider recipe, already required and applied, for example vb_ai_provider_anthropic. The provider recipe sets the default for the chat operation, which the button uses.
  • field_summary on the content types. This recipe does not create it.

Install

Require the recipe. Composer pulls in drupal/ai, drupal/field_widget_actions, drupal/maxlength, vb_ai_widget_actions and vb_ai_core as dependencies.

ddev composer require vectorbross/vb_ai_summary

Apply the recipe

Make sure a provider recipe has been applied first (see Requirements). Run from the project root; Drush runs from the web docroot, so the path starts with ../recipes.

ddev drush recipe ../recipes/vb_ai_summary
ddev drush cr

Content types added later

Add field_summary to the new content type, then apply the recipe again. It only adds what is missing: existing buttons, prompts and counters are kept, also when they were changed for the project.

Permissions

The button is only shown to users with the Use AI generate buttons permission (from vb_ai_widget_actions). The recipe grants it to the webmaster role and creates that role if it does not exist yet. The administrator role already has every permission. Other roles, such as content editors, do not see the button; grant the permission manually if another role needs it.

The permission covers every AI Automator button, so it also applies to the buttons of the other VB AI recipes that use vb_ai_widget_actions.

Verify

ddev drush pm:list --status=enabled --filter=field_widget_actions
ddev drush config:get ai_automators.ai_automator.node.article.field_summary.default rule

Then edit a node of a content type with field_summary, fill in the body and click Generate summary under the field. The field is filled by the default chat provider.

Options

  • Change the prompt for one project at Structure → Content types → (type) → Manage fields: edit field_summary and change the prompt under AI Automator. Re-applying the recipe does not overwrite it.
  • Change the prompt, counter or context fields for all projects in recipe.yml (addAiGenerateButton). This only affects content types that did not get a button yet.
  • When field_summary is a long text field and a longer summary is wanted, raise max_length and the length rule in the prompt together.
  • To let editors refine the result in a dialog before inserting it, set enable_refinement: true in recipe.yml.

License

GPL-2.0-or-later. See LICENSE.txt.