This is working fine now. So merging the code
Ready for review
Tested with
AI Core 1.0.5
AI Agents 1.0.2
Gemini provider 1.0.0-beta1
Steps to use Gemini Provider
- Add your Gemini API key in Configuration > System > Keys
- Go to Configuration > AI > Provider Settings > Gemini provider and select the added key
- Go to Configuration > AI > AI Default Settings
- Select 'Gemini' as 'Default Provider' and 'Gemini 2.0 flash' as 'Default model' for 'Chat' and 'Chat with Complex JSON' operations
- Now, the assistant would work with the Gemini provider
akhil babu โ created an issue.
akhil babu โ created an issue.
akhil babu โ made their first commit to this issueโs fork.
Thanks @wim leers. I have updated GeneratedFieldExplicitInputUxComponentSourceBase::validateComponentInput()
and added a check for unexpected props.
However, no exception was thrown for the curl request mentioned in #5, and the heading component was still added to the canvas. The expected error only appeared when publishing the page (Because ValidComponentTree constratint was invoked)
Shouldn't the error have been thrown at the time of the request?
I also tried to validate 'missing' props but that resulted in many test failures as some props are not always part of user input (Like 'attribute' prop in sdc.experience_builder.my-hero component)
Thanks @wim leers๐. I just tested this using the 'Heading' SDC, by adding an extra property 'textUnwanted' when making a curl request to the endpoint /xb/api/v0/layout/xb_page/5
and the changes were successfully saved. There were no validation errors regarding the unexpected prop
curl --location 'https://starshot.ddev.site/xb/api/v0/layout/xb_page/5' \
--header 'accept: */*' \
--header 'accept-language: en-US,en-GB;q=0.9,en;q=0.8' \
--header 'content-type: application/json' \
--header 'origin: https://starshot.ddev.site' \
--header 'priority: u=1, i' \
--header 'referer: https://starshot.ddev.site/xb/xb_page/5/editor/component/fdc18261-ef6e-41bd-bdba-99ecc72bf359' \
--header 'sec-ch-ua: "Chromium";v="136", "Google Chrome";v="136", "Not.A/Brand";v="99"' \
--header 'sec-ch-ua-mobile: ?0' \
--header 'sec-ch-ua-platform: "Linux"' \
--header 'sec-fetch-dest: empty' \
--header 'sec-fetch-mode: cors' \
--header 'sec-fetch-site: same-origin' \
--header 'user-agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/136.0.0.0 Safari/537.36' \
--header 'x-csrf-token: PIqRn04kuCGgm5leY3w_pc0Oq9ZGv0mzWXds0SE7cmg' \
--header 'Cookie: SSESS1a128ff57fee5bd2b5663cea7bd52db5=n4epfmoesptq7m91dcj6skrvtl' \
--data '{
"layout": [
{
"nodeType": "region",
"id": "content",
"name": "Content",
"components": [
{
"slots": [],
"nodeType": "component",
"type": "sdc.experience_builder.heading",
"uuid": "fdc18261-ef6e-41bd-bdba-99ecc72bf359"
}
]
}
],
"model": {
"fdc18261-ef6e-41bd-bdba-99ecc72bf359": {
"name": "Heading",
"resolved": {
"text": "A heading element new text",
"style": "primary",
"element": "h1",
"textUnwanted": "An unwanted heading" // Invalid prop
},
"source": {
"text": {
"expression": "โน๏ธstringโvalue",
"sourceType": "static:field_item:string",
"value": [
{
"value": "A heading element new text"
}
]
},
"textUnwanted": { // Invalid prop
"expression": "โน๏ธstringโvalue",
"sourceType": "static:field_item:string",
"value": [
{
"value": "An unwanted heading"
}
]
},
"style": {
"expression": "โน๏ธlist_stringโvalue",
"sourceType": "static:field_item:list_string",
"value": [
{
"value": "primary"
}
],
"sourceTypeSettings": {
"storage": {
"allowed_values": [
{
"value": "primary",
"label": "primary"
},
{
"value": "secondary",
"label": "secondary"
}
]
}
}
},
"element": {
"expression": "โน๏ธlist_stringโvalue",
"sourceType": "static:field_item:list_string",
"value": [
{
"value": "h1"
}
],
"sourceTypeSettings": {
"storage": {
"allowed_values": [
{
"value": "div",
"label": "div"
},
{
"value": "h1",
"label": "h1"
},
{
"value": "h2",
"label": "h2"
},
{
"value": "h3",
"label": "h3"
},
{
"value": "h4",
"label": "h4"
},
{
"value": "h5",
"label": "h5"
},
{
"value": "h6",
"label": "h6"
}
]
}
}
}
}
}
},
"entity_form_fields": {
"langcode[0][value]": "en",
"revision_log[0][value]": "",
"title[0][value]": "Untitled page",
"path[0][alias]": "",
"path[0][source]": "/page/5",
"path[0][langcode]": "en",
"image[media_library_selection]": "",
"description[0][value]": ""
}
}'
Just to confirm, does this mean validateComponentInput()
currently allows unexpected properties (i.e., garbage values) for SDCs?
Could you please give an example for 'garbage value'?
I have created an MR based on the patch in #4 with some additional changes
1. Got the following error for blocks
When a #lazy_builder callback is specified, no properties can exist; all properties must be generated by the #lazy_builder callback. You specified the following properties: #prefix, #suffix, #access
So updated the lazybuilder callback to include the #access, #prefix and #suffix properties. But the Drupal\Tests\experience_builder\Kernel\Plugin\ExperienceBuilder\ComponentSource\BlockComponentTest::testRenderComponentLive
fails as #prefix and #suffix are not included in the assertion. Should the test be updated, or is there a better approach?
akhil babu โ made their first commit to this issueโs fork.
Please review
akhil babu โ created an issue.
I have tested the changes in https://git.drupalcode.org/project/ai_agents/-/merge_requests/124/diffs?... and https://git.drupalcode.org/project/ai_agents/-/merge_requests/124/diffs?... and its working fine.
[ai_agent:agent_instructions]
token is properly added for content type and taxonomy agents- The
[agent_instructions]
token is correctly updated to [ai_aent:agent_instructions]
in previously created agents, after runningdrush updb
MR 1008 adds an error message when the code component does not exist.
However user can't navigate to a new code component from the left side bar. The URL changes, but the code editor is not renderd unless 'Try again' is clicked. The error boundary needs to be reset. I belive 'resetBoundary' should be used, but it didn't work (I probably implemented it incorrectly. still learning react ๐ )
akhil babu โ created an issue.
akhil babu โ made their first commit to this issueโs fork.
Looks like this is already being implemented in โจ Add the actual agents as configs Active
Please review
akhil babu โ created an issue.
Will try to create the agents
Looking at the available tools, all tools mentioned in the issue summary are already there
'List Bundles'
tool already provides bundle types for an entity type.
'Get Content Type Info'
provides information about any node types.
'Create Content Type'
for Creating content types
'Edit Content Type'
for editing content types
'Delete Content Type'
for deleting content types.
Please review
I was able to reproduce this issue. When the page title is updated, the entity_form_fields store the correct value, but the HTML section in the autosave data does not get updated.
Rather than adding '/' to paths that dont start with it, we should add validation to the entity form fields
Validation for entity fields are not yet impletemted
file: experience_builder/ui/src/components/form/inputBehaviors.tsx
const validateNewValue = (e: React.ChangeEvent, newValue: any) => {
// @todo Implement this.
return { valid: true, errors: null };
};
This should be updated to
const validateNewValue = (e: React.ChangeEvent, newValue: any) => {
const target = e.target as HTMLInputElement;
if (target.id === 'edit-path-0-alias' && typeof newValue === 'string') {
if (newValue && !newValue.startsWith('/')) {
return {
valid: false,
errors: [
{
keyword: 'value',
instancePath: '',
schemaPath: '',
params: {},
message: 'The alias path has to start with a slash',
},
],
};
}
}
// @todo Implement for other entity fields.
return { valid: true, errors: null };
};
hestenet โ credited akhil babu โ .
"#2 is no longer valid.
The module's architecture has completely changed. It now leverages utility functions defined by the XB UI, such as addNewComponentToLayout, to place components rather than updating the autosave data. This is inspired by the code of the ConceptProvider
extension added in XB.
The current implementation has only one agent with two sub-agents. The new version has the following agents:
- Main Agent โ An orchestration agent that parses the user request and assigns the task to the corresponding sub-agents.
- Template Designer Agent: Used as a tool by the main agent. Responsible for building an entire page (e.g. a template for a news article).
- Layout Editor: Used as a tool by the main agent. Responsible for adding new components to an already created page (e.g. "Add a paragraph with text explaining 5 new features of Drupal.")
- Contextual Editor: Used as a tool by the main agent. Can update content or child components of a selected component placed on the page (e.g. the user selects a 2 column layout and asks, "Add 2 images to both columns").
The module now supports creating code components from Figma design, using the Figma MCP Server. These new agents have been created for that:
- Figma Agent: Creates Preact code from Figma data.
- Figma Image Decoder Agent: Used as a tool by the Figma agent when the code component should use the exact images present in the Figma design, if any."
These are not yet published.
I have raised a PR. Please review
akhil babu โ created an issue.
Please review
akhil babu โ created an issue.
This is an early version of the workflow plan. It may change as development progresses.
akhil babu โ created an issue.
Not sure if this is the correct way:
To show the warning, first add
if (isset($this->agentsManager->getDefinition($default_agent)['custom_type']) && $this->agentsManager->getDefinition($default_agent)['custom_type'] === 'config') {
if (empty($this->providerManager->getSimpleProviderModelOptions('chat', FALSE, TRUE, [AiModelCapability::ChatTools]))) {
$this->messenger->addError($this->t('This agent will not work with the selected model as function calling is not supported.'));
}
}
to Drupal\ai_agents_explorer\Form\AiAgentExplorerForm::buildForm
But for this to work,
if (in_array(AiModelCapability::ChatTools, $capabilities)) {
continue;
}
should be added to Drupal\ai_provider_openai\Plugin\AiProvider\OpenAiProvider::getModels
in the
1.0.2 version code
marcus_johansson โ credited akhil babu โ .
Merged. Thanks
akhil babu โ made their first commit to this issueโs fork.
akhil babu โ created an issue.
akhil babu โ created an issue.
The module will not work with the 0.2.0-alpha6 version of experience builder. Could you try with the latest dev release of experience builder?
https://www.drupal.org/project/experience_builder/releases/0.x-dev โ
Fixed
Now the dev release of experience builder would get downloaded when the module is downloaded using composer
akhil babu โ created an issue. See original summary โ .
Merged
Working now
akhil babu โ created an issue. See original summary โ .
akhil babu โ created an issue.
akhil babu โ created an issue.
Raised a PR
griffynh โ credited akhil babu โ .
akhil babu โ created an issue. See original summary โ .
kristen pol โ credited akhil babu โ .
kristen pol โ credited akhil babu โ .
kristen pol โ credited akhil babu โ .
kristen pol โ credited akhil babu โ .
kristen pol โ credited akhil babu โ .
kristen pol โ credited akhil babu โ .
griffynh โ credited akhil babu โ .
This warning was appearing in logs while running the tests. So I have updated the AutoSaveManager::save() method to check if $data["entity_form_fields"] exists or not.
/var/www/html/web/modules/contrib/experience_builder/src/AutoSave/AutoSaveManager.php:34
Undefined array key "entity_form_fields"
Please review
akhil babu โ made their first commit to this issueโs fork.
Resolved the conflicts and rebased. Thanks
akhil babu โ made their first commit to this issueโs fork.
Just saw similar test failures in another merged MR: https://git.drupalcode.org/project/experience_builder/-/jobs/4335852. So I am moving this issue to needs review
Few test are failing even after rebasing. But those are fine in local..๐คจ
akhil babu โ made their first commit to this issueโs fork.
Added the tests as well. Thanks
Thanks for the review @wimleers. I have updated the code to camelCase. Changes are made to the drupalsettings.xb
values. Please review
akhil babu โ changed the visibility of the branch 0.x to hidden.
I have added a config action 'setBlockSettings' for updating the block settings
config:
actions:
block.block.claro_primary_local_tasks:
setBlockSettings:
secondary: false
Please review. I will add the tests if the current implementation looks good.
I will try to add the config action
Drupal\Component\Render\FormattableMarkup::placeholderFormat
always escapes the special characters in the string if the placeholder passed is '@'. This happens every time, and then the render API properly renders the special characters. But not sure why it's not happening in this case (Maybe because the rendering happens in the decoupled UI, but the label in the component listing /admin/structure/component
is also double escaped). Should we use html_entity_decode
here?
This issue does not affect for SDC components.
This part of the code is causing the issue
experience_builder_block_alter() {
//
$component = Component::create([
//
'label' => (string) new TranslatableMarkup('@label block', ['@label' => $definition['admin_label']]),
//
]);
}
(string) new TranslatableMarkup('@label block', ['@label' => $definition['admin_label']])
returns the incorrect label for blocks
Created a new MR. This time I am using snake_case for all parameters as it was more simpler to implement ๐ฌ