Allow summarize, analyze, suggest title and taxonomy terms based on the rendered HTML of the entity

Created on 25 November 2024, 5 months ago

Problem/Motivation

At the moment "AI Content Editing Tools" module adds the form elements in the right sidebar with all actions that it can help editors with, including Summary of the text, Analysis of the tone, Suggestion of title and taxonomy terms, etc. But the actions are limited to the values from entity fields, and unfortunately entity reference (revisions)/paragraphs are not supported.

Steps to reproduce

  1. Create a content type with entity reference revisions fields.
  2. Enable ai_content module
  3. Observe that entity reference revision field is not possible to select in any tool from the module

Proposed resolution

For some actions like summary, it would be nice to have a summary of the whole entity, not just one field, for example for "Preview text" of the node. It should be based on the whole entity content, not just one field. The same would be for title and taxonomy suggestions, as well as analysis of the tone of the text. It is hard to support paragraph fields on its own, but a rendered output of the entity in some view mode could be a solution. Like Search API module has a plugin that renders the entity in a selected view mode for using the content in the index, the same was AI module can use this output as a source for content analysis, suggestions, etc.

Another improvement might be, that the actions not necessary should appear in the right sidebar and the output should not be copied and then pasted to the correct field. For example, if the action is to suggest title, then the button "Suggest title" should be near the "Title" field. Maybe it should be open the dialog where the additional settings are, so the user can select based on what the title suggestion should be created, it could be the same form element as it is now, but also include the "Rendered HTML" of the node (entity) option.

The same approach can be added to Summary feature. If there is a field "Preview Text" or "Summary" on the entity, that is used for teaser view mode, for example, then the button for Summary creation should be near it (for example how AI Image Alt text module does, the "Generate" button is near the "Alt text" input field).

Remaining tasks

Decide on the concept how this should be best implemented.
Provide MR

User interface changes

The AI buttons should be rather added to the fields that support the output of the AI, then to the sidebar. There should be an option to populate the target field right away (where possible and reasonable) and do not rely on the user to copy the output to the field.

✨ Feature request
Status

Active

Version

1.0

Component

Other Submodules

Created by

πŸ‡©πŸ‡ͺGermany a.dmitriiev

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

Merge Requests

Comments & Activities

  • Issue created by @a.dmitriiev
  • πŸ‡¬πŸ‡§United Kingdom MrDaleSmith

    Just to note https://www.drupal.org/project/ai/issues/3484358 πŸ“Œ AI Content needs refactoring to use plugins Active introduced the ability to select values from fields held within paragraphs. I'm not sure about the proposed solution to this - generating an AIO version of a full page may lead to confusion when it comes to copying the right bit of the AI content into the right fields on the edit page, and getting suggestion for (non-Paragraph) referenced entities could get very confusing.

    Not a maintainer: just throwing in my 2p.

  • πŸ‡§πŸ‡ͺBelgium wouters_f Leuven

    I agree with this issue in the sence that apart from drupalisms, it should take into account
    - use the entire page
    - the proposed changes in the forms
    to generate a new title proposition.

    I think the idea is that with automator this submodule is replaced by widgets that to almost exactly what you propose.

  • πŸ‡¬πŸ‡ͺGeorgia davit.magaldadze

    davit.magaldadze β†’ made their first commit to this issue’s fork.

  • Pipeline finished with Success
    6 days ago
    #469117
  • Pipeline finished with Success
    6 days ago
    #469126
  • πŸ‡©πŸ‡ͺGermany a.dmitriiev

    I have created a MR with the following changes:

    1. The method getSetProvider from AiContentSuggestionsPluginBase class was copied to AiProviderPluginManager service as it can be used in many other places, not only in the content suggestion plugins. The method is still there in plugin base class but now uses the service internally. This was done for backwards compatibility, so there are no breaking changes as the method was also in the interface.
    2. I have added the new configuration setting to "AI Content Suggestions settings" page. This is a system prompt for content suggestion that are attached to the field widget

    3. For all string/text fields on "Manage form display" now there is a third party setting from ai_content_suggestions module. This setting allows to generate suggestions per field and paste the result back directly to the field it is attached to. It is possible to use tokens and also entity render tokens from this module https://www.drupal.org/project/token_entity_render β†’ for example:

    4. In the result on the form you will see the following:

    when the field is clicked/focused:

    and then when the button is clicked there will be a dialog with suggestions one or mulitple (it depends on the prompt):

    when one of the suggestions is clicked, then it is inserted directly into the field. It works for string fields, text fields and also with CKEditor fields.

  • Pipeline finished with Success
    6 days ago
    Total: 328s
    #469252
Production build 0.71.5 2024