Moving to Needs review. Fixed the MR pipeline issues.
anjaliprasannan → made their first commit to this issue’s fork.
SS after fix
Work done:
- Correctly process the tools selected in the modal.
- Rebuild the detailed tool usage section when tools are selected.
Remaining work
- Update the save method in ai agent form to handle the data from the modal form on click apply.
To continue with the remaining work, I am a bit confused with the implementation of how to take the values in the modal form on apply click to the ai agent form and save them in the ai agent form?
This issue should go under ai_agents. Hence I have created one and linked the issue.
anjaliprasannan → created an issue.
ok @mrdalesmith. Waiting for the maintainers input.
I could not reproduce the issue.
Steps :
Set the administrative theme as claro
Uploaded files to image and media fields
No such issue was found
anjaliprasannan → made their first commit to this issue’s fork.
anjaliprasannan → made their first commit to this issue’s fork.
anjaliprasannan → made their first commit to this issue’s fork.
anjaliprasannan → made their first commit to this issue’s fork.
Screenshot of fix.
As per my understanding these are the required changes to be done. Pointing this for maintainers confirmation.
Redesign the AI Assistant Form Layout:
- Modify the existing AI Assistant configuration form to resemble the AI Agents form. This means consolidating the agent selection and creation process into a single interface.
- Replace the current "Use agent as assistant" dropdown with a more integrated field that allows both selecting an existing agent and creating a new one on the fly.
Create Agent on Save:
- When the user saves the AI Assistant configuration, implement logic to check if a "New agent" option is selected.
- If so, programmatically create a new agent using the provided details (e.g., the administrative description and selected tools).
- Automatically link this newly created agent to the AI Assistant by updating the assistant's configuration to reference the agent's ID.
Integrate Agent Selection Field:
- Add a dynamic dropdown or autocomplete field labeled "AI Agent" (as suggested in your description) that lists existing agents.
- If the user selects "New agent," display an inline form to input agent details (e.g., name, description, and tool preferences) before saving.
- Upon saving, the system should create the agent, assign it the selected tools, and connect it to the AI Assistant in one action.
@mrdalesmith Apologise, I have tried this again and I see the issue exist. Once the maintainers have a word on this, I will proceed on the fix.
@sanket.tale when you add the ai chatbot in claro theme, you can only see the block in admnistrative pages and not in homepage. To view the block in homepage try adding it in the olivero theme block layout.
I tried in a fresh installation of drupal and could not reproduce the issue.
@mrdalesmith
The current implementation removes the standalone field type and introduces an aiprovider entity, which is referenced using an entity reference field type. Additionally, the default value can now be set through the field widget.
There are still some issues with the implementation, but before proceeding further, I wanted to confirm if this is the kind of setup you were expecting for the AI Provider entity reference.
I couldn't reproduce the issue. Could you please update the steps to reproduce?
If someone implements FunctionCallInterface directly (without extending FunctionCallBase), they’ll need to provide their own implementations of normalize() and populateValues(). For example:
<?php
class CustomFunctionCall extends PluginBase implements FunctionCallInterface {
public function populateValues(ToolsFunctionOutput $output) {
// Custom logic without contexts.
$this->configuration['values'] = $output->getArguments();
}
public function normalize(): ToolsFunctionInput {
$function = new ToolsFunctionInput($this->getFunctionName(), []);
$function->setDescription($this->pluginDefinition['description']);
return $function;
}
}
Code that interacts with FunctionCallInterface instances and expects context-related methods (e.g., getContextDefinitions()) should check if the plugin implements ContextAwarePluginInterface. For example:
if ($function_call instanceof ContextAwarePluginInterface) {
$context_definitions = $function_call->getContextDefinitions();
// Work with contexts...
} else {
// Handle context-free plugin...
}
anjaliprasannan → made their first commit to this issue’s fork.
anjaliprasannan → made their first commit to this issue’s fork.
anjaliprasannan → made their first commit to this issue’s fork.
anjaliprasannan → made their first commit to this issue’s fork.
anjaliprasannan → made their first commit to this issue’s fork.
anjaliprasannan → made their first commit to this issue’s fork.
@marcus_johansson I tried the patch and it works well! I've incorporated the changes and improved in the MR.
Let me know if you have any feedback or further suggestions.
Attaching video reference to test the patch.
Will proceed once I have a complete understanding of the requirement.
anjaliprasannan → made their first commit to this issue’s fork.
Its my bad, I was mistaken that the ticket was to remove the ai plugin icon in the configurations. Now the patch is updated to remove the ai assistant dropdown in ckeditor.
User with ckeditor permission
User without ckeditor permission
Thank you mrdalesmith
Pipeline is passed. Moving to Needs review
@Marcus_Johansson I want to know more about the scenerio of the issue. I tried to check if the ai_automator_status field in the manage fields of an entity to display the ai automator run order tab for the entity.But is that the correct scenerio?
anjaliprasannan → made their first commit to this issue’s fork.
anjaliprasannan → made their first commit to this issue’s fork.
anjaliprasannan → made their first commit to this issue’s fork.
anjaliprasannan → made their first commit to this issue’s fork.
anjaliprasannan → made their first commit to this issue’s fork.
Detailed steps:
- Navigate to /admin/config/ai/automator_chain_types and click on Add Automator Chain Types to create an ai automator chain type.
- Name the automator chain type: Generate Alt Text from Image.
- Save the chain type and edit it to add fields.
- Input field: An image field (required) named Input Image.
- Output field: A text field named Image Alt Text.
- Formatted long text field: A field named Output Image with Alt Text to store the generated result.
Configuring the AI Automator for the fields:
- Enable AI Automator for Image Alt Text
- Edit Image Alt Text and check Enable AI Automator.
- Change Automator Input Mode to Advanced Mode (Token).
- In Automator Prompt (Token), add the following prompt:
- Check Edit when changed.
- Set Automator Worker to Direct - Processes and saves the value directly.
- Select AI Provider as OpenAI.
- Save the settings.
Generate an alt text for the input image in less than 5 words.
Input image: [automator_chain:field_input_image]
Enable AI Automator for Output Image with Alt Text
- Edit Output Image with Alt Text and check Enable AI Automator.
- Change Automator Input Mode to Advanced Mode (Token).
- Add the following Automator Prompt (Token):
- Check Edit when changed.
- Set Automator Weight to 110 (so it runs after Image Alt Text automator).
- Select AI Provider as OpenAI.
- Set Use text format to Basic HTML.
- Save the settings.
Generate the output in the below format : <img src="[automator_chain:field_input_image:entity:url]" data-entity-uuid="[automator_chain:field_input_image:entity:uuid]" alt="[automator_chain:field_image_alt_text]">
Enabling AI Automator in CKEditor
- Navigate to /admin/config/content/formats and configure the text format (e.g., Basic HTML).
- Add AI CKEditor to the Active Toolbar.
- In CKEditor 5 plugin settings, open the AI Tools section.
- Open AI Automator CKEditor and enable AI Automators.
- Enable Generate Alt Text from Image settings and select:
- Input field: Input Image
- Text Selection Input: Input Image
- Require Selection: Checked (ensures selected image is used as input).
- Write Mode: Replace (generated output replaces selected input).
- Output field: Output Image with Alt Text
Testing the AI Automator Chain Type
- Create article content.
- In the CKEditor field, add an image.
- Select the image and click on the AI Assistant plugin.
- Click on Generate Alt Text from Image to open the AI Assistant modal.
- The selected image appears in the upload field.
- Click Generate and wait for AI to process the image.
- Once done, the generated alt text appears in the response field.
- Click Save changes to editor and verify the image has the new alt text.
Prerequisites:
- Ensure the Media Library and Media modules are enabled.
- Create an AI Automator Chain Type with a Media Entity Reference Field as the input field.
- Enable this AI Automator Chain Type in AI Tools under CKEditor plugin settings.
- Select the Media Entity Reference Field as the input field in the AI Tools settings.
- Enable the Media Library plugin in CKEditor.
Test Steps:
Edit a Content Entity:
- Navigate to a content entity with a CKEditor field.
- Open the editor for the CKEditor-enabled field.
Add an Image via Media Library Plugin:
- Click the Media Library button in CKEditor.
- Select an existing image or upload a new image.
- Insert the image into the CKEditor field.
Trigger AI Assistant Plugin:
- Select the inserted image in CKEditor.
- Click on the AI Assistant Plugin that was configured.
Expected Result:
- The AI Assistant Plugin processes the selected image.
- The image is fetched and rendered correctly in the Media Entity Reference Field.
Added Media entity reference to add image in ckeditor
SS:
You can assign this issue to yourself in the edit page of this issue.
@mrdalesmith Can we modify the functionality so that clicking the "Re-sort" button first saves the current state (including enabling/disabling items based on their position relative to the disable row) and then resorts only the enabled items, we can combine the submitFormSave and submitFormResort logic into a single workflow triggered by the "Re-sort" button. This ensures that when you move an item below the disable row and click "Re-sort," the save operation happens first (updating the disabled/enabled states), followed by the re-sorting of enabled items.
I encountered the same issue as well. To resolve it, I ran
composer require openai-php/client
to install the required OpenAI PHP SDK, followed by drush cr
to rebuild the Drupal cache. This fixed the error, and the OpenAI provider was successfully added.
Updated MR for deepchat block.
@phenaproxima I tested again on a fresh installation of Drupal CMS and was unable to reproduce the issue. Although I had used a fresh installation before, the behavior is now different. It is correctly redirecting to the homepage instead of the user profile page. Everything is working as expected, so I am closing the ticket.
anjaliprasannan → created an issue.
This is due to the settings in /admin/config/system/site-information, Default front page is set to user/login. But this should be set to /home right? When I changed to /home it works as expected. For a fresh installation of drupal_cms the setting should be changed.
anjaliprasannan → created an issue.
anjaliprasannan → created an issue.
@marcus_johansson
I was able to reproduce the issue with latest drupal cms developer version with only ai assistance recipe added. This issue occurs when autosave is triggered for the content from chatbot. There is an issue raised for this, please refer :
🐛
Autosave node interfers with AI Chatbot
Active
This issue already an issue raised for this in Ai issue queue : 🐛 ChatBot closes itself when adding a modal Active
@ydahi
From the context you have provided. You can add extra fields for response details and prompt used and enable ai automators for them, Else you can modify your prompt to respond in the desired format for the response field itself.
If this does not satisfy your query, please come up with better senerio.
@joshua1234511 The test is failing in the pipeline. I tried it in the local by following the test steps where I could not find a message as in the test case. Is the test written as per requirement? Should the test be rewrorked on?
@nod_ Please find the screenshot
This issue seems to be fixed when removing the #tree tag from the form field in AiCkeditor plugin. But since #tree is a property used to group hierarchical values it is required. Reference:
https://www.drupal.org/docs/7/api/form-api/tree-and-parents →
Hence closing the ticket.