Generate/update title and metadata for pages created from components

Created on 3 July 2025, about 2 months ago

Overview

Introduce AI Agents and tools to Build Pages from Single Directory Components Active is being worked on for placing existing components to the canvas through prompts, 📌 Generate content for title using AI Active and 📌 Generate content metadata using AI Active are being worked on for creating/updating title and metadata for page.

Proposed resolution

Merge all ongoing work from different issues to ensure that the functionality enables generating and updating the title and metadata for pages created from components.

User interface changes

📌 Task
Status

Active

Version

0.0

Component

AI

Created by

🇮🇳India kunal.sachdev

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

Merge Requests

Comments & Activities

  • Issue created by @kunal.sachdev
  • 🇮🇳India kunal.sachdev

    kunal.sachdev changed the visibility of the branch 3533881-generateupdate-title-and to hidden.

  • Pipeline finished with Failed
    about 2 months ago
    Total: 1060s
    #537959
  • Pipeline finished with Failed
    about 2 months ago
    Total: 218s
    #538914
  • Pipeline finished with Failed
    about 2 months ago
    Total: 938s
    #540917
  • Pipeline finished with Failed
    about 2 months ago
    Total: 1322s
    #542744
  • Pipeline finished with Failed
    about 2 months ago
    Total: 1459s
    #543786
  • Pipeline finished with Failed
    about 2 months ago
    Total: 879s
    #543919
  • Pipeline finished with Failed
    about 2 months ago
    Total: 1248s
    #543938
  • 🇮🇳India kunal.sachdev

    This is how it's working for now

  • Pipeline finished with Failed
    about 2 months ago
    Total: 1082s
    #543968
  • 🇺🇸United States tim.plunkett Philadelphia

    This needs a rebase, kind of a big one. Though it looks like it has a bunch of merge commits in it already, so I tried merging in 0.x, and there were still conflicts.

  • Pipeline finished with Failed
    about 2 months ago
    Total: 283s
    #544832
  • Pipeline finished with Failed
    about 2 months ago
    Total: 856s
    #544834
  • Pipeline finished with Failed
    about 2 months ago
    Total: 1100s
    #544848
  • 🇮🇳India kunal.sachdev

    Some scenarios are not working as expected so I am trying to fix it.

  • Pipeline finished with Failed
    about 1 month ago
    Total: 1144s
    #546810
  • Pipeline finished with Failed
    about 1 month ago
    Total: 1159s
    #546873
  • 🇮🇳India kunal.sachdev

    Although sometimes the title is not getting updated on the page. I checked this same issue is also there in 0.x branch so created a issue for that 🐛 Title is not update on the page when created through AI Active

  • 🇮🇳India kunal.sachdev

    Work in progress!!

  • Pipeline finished with Failed
    about 1 month ago
    Total: 1351s
    #548809
  • Pipeline finished with Failed
    about 1 month ago
    #549061
  • Pipeline finished with Failed
    about 1 month ago
    Total: 1164s
    #549979
  • Pipeline finished with Failed
    about 1 month ago
    Total: 1425s
    #550007
  • Pipeline finished with Running
    about 1 month ago
    #550193
  • 🇮🇳India kunal.sachdev

    Tested it manually and it's working as expected.

  • Pipeline finished with Failed
    about 1 month ago
    Total: 779s
    #550403
  • 🇮🇳India narendraR Jaipur, India

    Tested manually and found some issues:

    • Does not answer general questions like "What is Drupal", instead it creates page or component. Exists on 0.x as well. Issue Created 🐛 XB AI: Agent does not answer general questions correctly Active
    • Once we create a title on a page (Create title on cats) and then creating a page (Add heading components with names and release years of all marvel movies starting from the infinity saga), changes title as well as metadata
    • Asking to generate page when already on a page also works incorrectly

    There may be other scenarios as well, but I am moving it to needs work again to test all existing features and fix mentioned issues

  • Pipeline finished with Success
    about 1 month ago
    Total: 854s
    #552729
  • Pipeline finished with Canceled
    about 1 month ago
    Total: 190s
    #552879
  • Pipeline finished with Failed
    about 1 month ago
    Total: 998s
    #552882
  • 🇮🇳India kunal.sachdev

    The second case mentioned in #17 📌 Generate/update title and metadata for pages created from components Active wasn't working because the getEntityField tool was fetching only published data. Since the page hadn’t been published, it retrieved the title as "Untitled page," which led to a new title being created unnecessarily. To resolve this, we removed the getEntityField tool and now pass the XB page data as context directly to all relevant tools

    I’ve manually tested all scenarios locally, and everything is now working as expected.

  • Pipeline finished with Failed
    about 1 month ago
    Total: 809s
    #552994
  • 🇺🇸United States tim.plunkett Philadelphia

    tim.plunkett changed the visibility of the branch 1.x to hidden.

  • 🇺🇸United States tim.plunkett Philadelphia
  • Pipeline finished with Failed
    about 1 month ago
    Total: 961s
    #553005
  • 🇮🇳India narendraR Jaipur, India

    I think we should avoid displaying all intermediate tool messages to the user. For example, in the attached screenshot, I tried to add a title and metadata to an article. While the behaviour is correct (title and metadata changes should not apply to nodes), the message shown to the user is confusing, as they did not request this information.

  • Pipeline finished with Running
    about 1 month ago
    #553854
  • 🇮🇳India narendraR Jaipur, India

    This still seems an issue.
    When I manually changed title (without saving) after creating a page, I ask AI Add heading components with names and release years of 2 marvel movies starting from the infinity saga
    AI Response:

    I've successfully:
    Added two heading components for the Marvel movies with appropriate styling
    Generated metadata for the page since it was empty
    Left the existing page title as is since it was already set
    The components have been placed properly and the layout has been updated successfully.

    But when I again asked AI Add heading components with names and release years of 2 marvel movies starting from the infinity saga without refreshing the page, I got response

    Summary of actions taken:
    Successfully created two heading components with the specified Marvel movie titles
    Used primary style and h1 elements for proper emphasis
    Generated a new page title since the existing one was basic
    Created metadata description since it was missing
    All components were properly structured and saved in the layout
    The page now has a professional structure with clear headings for both Infinity War and Endgame, along with appropriate metadata to improve its discoverability and context.

    This is wrong, as it changed title as well it is considering metadata as empty.

  • Pipeline finished with Canceled
    about 1 month ago
    #553972
  • 🇮🇳India kunal.sachdev

    The case mentioned in #23 📌 Generate/update title and metadata for pages created from components Active was failing because the pageData was not getting updated with fresh values every time. I have fixed it now.

  • Pipeline finished with Failed
    about 1 month ago
    #553973
  • 🇮🇳India narendraR Jaipur, India

    Given promptAdd heading components with names and release years of 3 marvel movies starting from the infinity saga and then next prompt
    Add heading components with names of 3 indian football palyers, page builder generates content again for first prompt, which is wrong.

  • 🇮🇳India kunal.sachdev

    I tested the case mentioned in #26 📌 Generate/update title and metadata for pages created from components Active and it works as expected but after running 6-7 prompts, the AI started to behave unexpectedly.
    I also tried similar prompts on version 1.x and observed the same issue there: the AI unnecessarily considers history/comments even when they’re not relevant. I have created a new issue 🐛 AI should use only necessary history/comments for each task Active to address this and I think we should prioritise fixing this issue first.

  • Pipeline finished with Canceled
    27 days ago
    Total: 434s
    #559347
  • Pipeline finished with Canceled
    27 days ago
    Total: 200s
    #559364
  • Pipeline finished with Canceled
    27 days ago
    Total: 317s
    #559366
  • Pipeline finished with Success
    27 days ago
    Total: 1137s
    #559374
  • 🇮🇳India kunal.sachdev

    Tested it locally and it's working as expected!!

  • Pipeline finished with Failed
    27 days ago
    Total: 980s
    #559560
  • Pipeline finished with Success
    26 days ago
    #560256
  • 🇮🇳India Akhil Babu Chengannur

    I have added a comment. Could you please check @kunal.sachdev

  • Pipeline finished with Failed
    26 days ago
    #560379
  • 🇮🇳India Akhil Babu Chengannur

    2. Generate the page title/description accordingly:
    - Check the page title and if it's untitled THEN ONLY create a title for the page using experience_builder_title_generation_agent. IMPORTANT - If the title is already present, NEVER create or change it.
    - Check the page description and if it's null or empty THEN ONLY call experience_builder_metadata_generation_agent with the topic/content to create metadata for page. IMPORTANT - If the page’s description field has ANY text - no matter if it’s generic, a placeholder, low quality, or unhelpful - you must NOT create, suggest, improve, or offer to rewrite the page's metadata or description.
    - Don't try to help more by creating appropriate content when metadata or title is present and it's not based on the page, if it's present that means user want it and don't need it to be changed.

    Is there a particular reason we're not allowing the agent to generate the title or description if they are already present?

  • Pipeline finished with Failed
    26 days ago
    #560408
  • 🇮🇳India Akhil Babu Chengannur
  • 🇮🇳India Akhil Babu Chengannur

    I have manually tested this and added a few comments to the MR. Please check.

  • Pipeline finished with Success
    26 days ago
    Total: 1087s
    #560537
  • 🇮🇳India kunal.sachdev

    Addressed all feedback.

  • Pipeline finished with Failed
    24 days ago
    Total: 850s
    #562250
  • Pipeline finished with Failed
    22 days ago
    Total: 810s
    #563564
  • 🇮🇳India Akhil Babu Chengannur

    Since we are already updating the prompt of the page builder agent, I think it should be fairly easy to add capability to opt out of title/description generation instead of creating a followup issue.

    I haved pushed the following changes in the latest commit: https://git.drupalcode.org/project/experience_builder/-/merge_requests/1...

    1. Restructured the prompt of the page builder agent:

    • Updated the primiary mission to include title and metadata generation
    • Created a token for selected_component_uuid
    • Asked the agent to return a normal text output when user asks to add a non existing component.
    • Previously, the chat response displayed to the user in the chat widget was generated in the message key of the component structure YAML produced by the page builder. This has been changed. Now the agent directly outputs the message as plain text after using the tools

    2. Updated the orchestrator prompt

    • Removed the references to 'selected_component_uuid'
    • Instructed the agent to pass complete unaltered user input to page builde tool when using it to support opting out of title and metadata generation

    Also, while testing, I observed that the AI generated the response correctly, but no components were being added to the canvas. For some reason const { data: availableComponents } = useGetComponentsQuery(); was coming back as undefined. It was working earlier. With the help of AI, I was able to fix it using the useRef hook. It's working now, but I'm not sure if it's the proper way to fix this issue. I've pushed this change as well, since without it, it was impossible to verify whether page building was working as expected.

    These are some videos showing how it's working now.
    Tested in https://github.com/phenaproxima/xb-demo/ (With experience builder 1.x)
    Model used: GPT-4.1

  • Pipeline finished with Failed
    22 days ago
    Total: 967s
    #563567
  • Pipeline finished with Failed
    22 days ago
    Total: 981s
    #563583
  • Pipeline finished with Failed
    21 days ago
    Total: 901s
    #563952
  • Pipeline finished with Failed
    20 days ago
    #564999
  • 🇮🇳India Akhil Babu Chengannur

    I was also able to reproduce the issue highlighted by Kunal in https://git.drupalcode.org/project/experience_builder/-/merge_requests/1...

    The issue appears to be with how the orchestrator agent handles the chat history. Currently the page builder agent has the following prompt to

    3. **Title Generation (XB Pages Only):**
    - Use `experience_builder_title_generation_agent` with contextual prompt
    - Skip if the user has explicitly asked not to generate the title.
    - Example: "Generate a suitable title for a page of a cookie shop"

    4. **Description Generation (XB Pages Only):**
    - Use `experience_builder_metadata_generation_agent` with contextual prompt
    - Skip if the user has explicitly asked not to generate the description/metadata.
    - Example: "Generate a suitable SEO-friendly description for an ice cream shop website"

    So, if it is explicitly asked not to generate title or description or both, the page builder won't generate that.

    But for this to work, the orchestrator must pass the complete user request without any modification, when invoking the page builder agent. The following instruction was added to the orchestrator for this.

    - Important: When using the experience_builder_page_builder_agent tool, always pass the complete, unaltered user request to the tool.
    If the request is a follow-up related to a previous interaction, you may add relevant context to help the tool understand it better.
    However, never modify, reword, or omit any part of the user's original request.

    But looks like its not working as expected. For example for the user request

    Add heading components with names of 3 Indian singers. Don't generate title and metadata
    Orchestrator called the page builder tool with the exact prompt
    Add heading components with names of 3 Indian singers. Don't generate title and metadata

    But then when the next prompt was given
    Add heading components with names of 3 Indian dancers. Don't generate title.

    Orchestration agent called the page builder with the following prompt
    Add heading components with names of 3 Indian dancers. Don't generate title and metadata

  • Pipeline finished with Failed
    20 days ago
    Total: 782s
    #565269
  • Pipeline finished with Failed
    19 days ago
    Total: 203s
    #565805
  • 🇮🇳India kunal.sachdev

    I have tested all scenarios and it's working as expected!!

  • Pipeline finished with Failed
    19 days ago
    Total: 209s
    #565883
  • Pipeline finished with Failed
    19 days ago
    Total: 232s
    #565897
  • Pipeline finished with Failed
    19 days ago
    Total: 1069s
    #565906
  • 🇮🇳India narendraR Jaipur, India

    Tried testing it manually and when an image is uploaded to create component with a prompt like "Create similar component", component is getting created, but message returned to user is empty.

  • 🇮🇳India kunal.sachdev

    The issue mentioned in #39 📌 Generate/update title and metadata for pages created from components Active was occurring intermittently because $agent->solve() sometimes returned an empty string, and we were using this value as the response message. To address this, I reverted the change that used $agent->solve() for the response message.

  • Pipeline finished with Canceled
    19 days ago
    Total: 372s
    #566042
  • Pipeline finished with Success
    19 days ago
    Total: 966s
    #566046
  • 🇮🇳India narendraR Jaipur, India

    Tested manually and functionality seems to be working as expected. Moving it to RTBC.

  • Pipeline finished with Failed
    14 days ago
    #569794
  • 🇺🇸United States tim.plunkett Philadelphia

    Merged and backported!

  • Pipeline finished with Failed
    14 days ago
    Total: 869s
    #570106
Production build 0.71.5 2024