AI Content Submodule Unable to Select Paragraph Fields for Text Generation

Created on 17 October 2024, 6 months ago

Problem/Motivation

The AI Content submodule allows users to select specific fields from which to generate summaries, titles, or other content using AI. However, fields within Paragraphs are not available for selection in the AI generation process.

When a content type includes Paragraphs, the AI Content submodule does not list the fields inside Paragraphs for selection, limiting its functionality. This issue prevents users from utilizing AI-generated content based on text stored in Paragraphs.

In my case, i can only use the ai_content feature based on the title field, wich is not very usefull.

Steps to reproduce

- Create a content type with a Paragraph field containing text.
- In the AI Content submodule configuration, attempt to select the Paragraph field as the source for AI-based text generation (e.g., summary or title).
- Observe that Paragraph fields are not available for selection, despite being part of the node's content.

Expected behavior:
The AI Content submodule should list fields within Paragraphs for selection, allowing AI to generate text based on the content of those fields, similar to how it works with regular node text fields.

Proposed resolution

Allow the user to select a paragraph field that will be able to get all the text within that field.

Feature request
Status

Active

Version

1.0

Component

Other Submodules

Created by

🇧🇪Belgium arwillame Belgium 🇧🇪

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

  • Issue created by @arwillame
  • 🇩🇪Germany marcus_johansson

    Is this outdated? I'm checking the code and it seems like paragraphs is indeed possible, however I can not find the issue where it was included.

  • 🇧🇪Belgium arwillame Belgium 🇧🇪

    Hi, I just checked the code a bit and test it again.

    I think my issue comes because of my data structure.
    I have a node with a field that reference a paragraph. Then this paragraph references a bunch of paragraph wich hav they strings fields.

    I think the code only check for the string on the first layer of paragraph.

    I think we should dive into all possible subparagraphs with a recursive method in https://git.drupalcode.org/project/ai/-/blob/1.0.x/modules/ai_content_su...

  • 🇬🇧United Kingdom MrDaleSmith

    I put the paragraph support in, and I deliberately didn't recurse because I felt it would be a lot of additional processing tbat created a very confusing UI: think of a node that references a paragraph that itself references a paragraph with the same fields - in the UI we would need to present a clean, simple process to the user where they could select the field within the correct paragraph and generate AI content for it. That would - to my mind - vet unwieldy very quickly.

    Given there are currently multiple ways of getting AI generated content into fields using just the core AI module, I'd be minded to say this particular module isn't suited to managing nested entities beyond the first level (and possibly not even that): if we needed a method of doing this that wasn't for WYSIWYG fields (for which it would be better and cleaner to use the AI CKEditor sub-module) I think we'd need a strong use case to make it worth the effort.

  • 🇩🇪Germany marcus_johansson

    Could Allow summarize, analyze, suggest title and taxonomy terms based on the rendered HTML of the entity Active be a general solution for this or just run it against the rendered field on default view (or selectable)?

  • 🇬🇧United Kingdom MrDaleSmith

    It could, although I've put reservations about how manageable that would be on that ticket too. TBH nested paragraphs and complex content type structures are put in place to assist human content creators and make sure they stick to proper semantic markup: I don't see why you would be using them if you were also getting an AI to generate your text.

    Both tickets feel to me like a lot of complicated difficult work without a robust general use case.

Production build 0.71.5 2024