Issue #3586478: "Add rich-text image description support to AI Automators"

Description

Adds rich-text image awareness to AI Automators so supported text-based automators can discover embedded images, generate AI image descriptions, include those descriptions in prompt context, and optionally store image metadata for auditability. For AI content pre-moderation, this allows the moderation automator to evaluate visual content from Article body fields in addition to text. If embedded images cannot be fully processed, such as when the configured image limit is exceeded or an image is detected but cannot be analyzed, the moderation state is forced to flagged so a human editor reviews the content. The implementation keeps the feature opt-in by moving image handling into RichTextImageDescriptionTrait, used by the relevant formatted-text automators and LlmModerationState, rather than adding this behavior globally to all RuleBase plugins.

Testing instructions

  1. Create a standalone Page-based automator test (outside moderation recipe scope):
  • Add two fields to page:
  • field_ai_image_summary (text_long) for generated output
  • field_ai_img_meta (string_long) for image metadata JSON
  • Create AI Automator config node.page.field_ai_image_summary.image_summary_test:
  • rule: llm_text_long
  • target field: field_ai_image_summary
  • base field: field_content
  • include image descriptions: enabled
  • include external images: enabled
  • max images: 3
  • metadata field: field_ai_img_meta
  • prompt includes {{ context }}
  1. Verify image processing and output:
  • Create/edit a Page node with field_content containing up to three image media or <img src="https://..."> tags and save.
  • Confirm field_ai_image_summary is generated using image-aware context.
  • Confirm field_ai_img_meta stores JSON metadata rows for processed images.
  • Reduce max images (e.g. to 1) and resave to confirm incomplete analysis metadata is recorded and warning behavior appears in context-dependent output.

Checklist

  • I have linked the related issue in the MR title or description
  • I have performed a self-review of my own code
  • I have added or updated tests, or explained in the description why this change is not covered by tests
  • I have updated documentation for any new or changed functionality
  • I have written testing instructions and verified them locally
  • I have noted any required post-merge steps (config imports, cache rebuilds, manual changes)
  • This MR contains no breaking API or hook changes, or they are explicitly documented in the description

AI Compliance

Note

Check the one that best describes your usage, or leave all unchecked if AI was not significantly used.

  • AI Assisted Code
    Mainly written by a human; AI used for autocomplete or partial generation under full human supervision.

  • AI Generated Code
    Mainly generated by AI, reviewed and approved by a human before this MR was created.

  • Vibe Coded
    Generated by AI and only functionally reviewed before this MR was created.

Closes #3586478

Edited by Levente Besenyei

Merge request reports

Loading