Overview

Currently, the "Canvas Page Builder" agent can only add new components to the page. It should also be able to:

Update the content of components (Eg:. when a user selects a component and asks to summarize or rewrite its content).
Rearrange components (Eg: when a user selects a component and asks to move it to a different region, slot, or position).

Proposed resolution

  • Store the component data containing UUID and prop values in the tempstore.
  • Create a tool named 'get_component_content' that accepts the UUID (string, required) of a component and returns its prop values.
  • Create a validator to validate that the UUID provided exists in the page.
  • Create a new tool named 'update_component_data' that accepts a UUID (string, required) and prop (list, required). Within this tool, validate the following:
    • The provided UUID is valid.
    • The prop names and values are valid.
  • Create a new tool named 'move_component_in_page' that accepts the following:
    • Component UUID (string, required)
    • Region (string, optional)
    • Reference UUID (string, optional)
    • Placement (string, with allowed values 'above' or 'below')
  • Within this tool, validate the following:
    • UUID is valid.
    • Region is used only when there are no child components in that region (used to move a component to an empty region). If region is used, reference UUID must not be provided.
    • If reference UUID is provided, then placement must be provided.
  • Update the set_component_structure tool to return a UUID for all the newly added components.
  • Store the output of CanvasAiPageBuilderHelper::createExpectedPageLayout in tempstore so that it can be accessed in the 'update_component_data' and 'move_component_in_page' tools, for handling cases with component addition, update, and move in a single go.

User interface changes

Issue fork canvas-3549232

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

akhil babu created an issue. See original summary.

akhil babu’s picture

akhil babu’s picture

Assigned: Unassigned » akhil babu
akhil babu’s picture

marcus_johansson’s picture

Issue tags: +AI Initiative Sprint
rakhimandhania’s picture

Issue tags: +AI Innovation
rakhimandhania’s picture

hi @afoster - Tagging you for sharing applicable use cases, prompts and screenshots (starting state and expected outcome after the prompt is run).

akhil babu’s picture

Issue summary: View changes

rakhimandhania’s picture

Issue tags: +AI Page Generation
rakhimandhania’s picture

Issue tags: -AI Initiative Sprint