🇮🇳India @anjaliprasannan

Account created on 3 February 2020, over 5 years ago
  • Drupal Developer at QED42 
#

Recent comments

🇮🇳India anjaliprasannan

anjaliprasannan made their first commit to this issue’s fork.

🇮🇳India anjaliprasannan

anjaliprasannan made their first commit to this issue’s fork.

🇮🇳India anjaliprasannan

Great work! @Sijumpk. I have reviewed and the menu agent is working fine. Only thing is you no need to specify to install drupal cms in steps to reproduce, we can test in drupal core as well.
Steps followed:

  1. Run the database updates to register the new agent configuration:
  2. drush updb
  3. Edit the AI Assistant configuration settings.
  4. Under "Agents Enabled", enable the Menu Agent by checking the corresponding checkbox.
  5. Open the Drupal Agent Chatbot prompt.
  6. Tried creating or editing menus and menu links using natural language commands (e.g., "Create a menu Cities with terms as metro cities in India", "You can add Delhi, Chennai, kochi, Bangalore, Mumbai", Add a home page link to the Footer menu with title Home").

Cities menu got created and terms where added. Home page link to the Footer menu with title Home was added.

SS attached

🇮🇳India anjaliprasannan

@mandclu

I could not reproduce the issue, I was able to create fields and content type using the ai chatbot. Also there was no error loged
Attaching the screenshots of fields created.

🇮🇳India anjaliprasannan

@binoli instead of raising new mr you can run git rebase -i HEAD~n n being the number of other commits, remove the commits and push.
Appolozise I was just checking if pipeline passed and did not notice the extra comits added. My bad

🇮🇳India anjaliprasannan

@binoli instead of raising new mr you can run git rebase -i HEAD~n n being the number of other commits, remove the commits and push.
Appolozise I was just checking if pipeline passed and did not notice the extra comits added. My bad

🇮🇳India anjaliprasannan

@bisonbleu

I am trying to improve the saveFormValues() in AutomatorBaseAction like,

protected function saveFormValues(array &$form, string $form_key, $entity, ?int $key = NULL): array {

    if (is_null($key)) {
      // If not key is provided, we should iterate through all items.
      foreach ($entity->get($form_key) as $index => $item) {
        $value = NULL;
        if (is_array($item)) {
          if (isset($item[$this->formElementProperty])) {
            $value = $item[$this->formElementProperty];
          }
        }
        elseif (is_object($item) && method_exists($item, 'get')) {
          if ($item->get($this->formElementProperty)) {
            $value = $item->get($this->formElementProperty)->getValue();
          }
        }
        if ($value !== NULL) {
          $form[$form_key]['widget'][$index][$this->formElementProperty]['#value'] = $value;
        }
      }
    }
    else {
      if (isset($entity->get($form_key)[$key])) {
        $item = NULL;
        foreach ($entity->get($form_key) as $index => $item) {
          if ($index === $key) {
            break;
          }
        }
        $value = NULL;
        if (is_array($item)) {
          if (isset($item[$this->formElementProperty])) {
            $value = $item[$this->formElementProperty];
          }
        }
        elseif (is_object($item) && method_exists($item, 'get')) {
          if ($item->get($this->formElementProperty)) {
            $value = $item->get($this->formElementProperty)->getValue();
          }
        }
        if ($value !== NULL) {
          $form[$form_key]['widget'][$key][$this->formElementProperty]['#value'] = $value;
        }
      }
    }

    return $form[$form_key];
  }

the method now correctly handles both array and object field items. This means that most plugin-level overrides of saveFormValues() are no longer necessary unless they add widget-specific logic.

I recommend removing the redundant saveFormValues() methods from individual FieldWidgetAction plugins and letting them inherit the base implementation. If that is allowed I can move further.

Thanks

🇮🇳India anjaliprasannan

Hi @andrewbelcher,

Before proceeding with implementation, I wanted to clarify the intended purpose and use case of exposing AI Agents in the ai_ckeditor plugin.

  • Should this allow editors to invoke an agent inline (e.g., generate content, classify text, summarize)?
  • Should it support inserting content into the editor based on the agent response?
  • Are we targeting general-purpose agents (like OpenAI chat), or also structured agents like: Node content agents, Taxonomy agents, Field-specific agents ?
🇮🇳India anjaliprasannan

AiSearchSetupMySqlTest is marked as old. in the codebase. should that be reverted? I have added test to AiSearchSetupMySqlTest but since this was named old I am reverting back. Once its confirmed, I will proceed.

🇮🇳India anjaliprasannan

I have reviewed this after the fix in 📌 Create Context upcaster for complex data types Active and its working fine. Hope this ticket can be closed now.

🇮🇳India anjaliprasannan

Discussed after discussing with @riyas_nr over slack and retesting the changes with OpenAI - dall-e-2 provider the image generation is done successfully. attaching the screenshot.

🇮🇳India anjaliprasannan

@bisonbleu Have moved the resort and save logic together.

🇮🇳India anjaliprasannan

Reviewed the fix and its working fine. Code also LGTM
Steps followed:

  • Enable the AI Search module.
  • Ensure that no Vector Database Providers are installed or configured (uninstall any if present).
  • Navigate to: /admin/config/search/search-api/add-server.
  • Select Backend as AI Search.
  • Submit the form without selecting any Vector Database Provider.
🇮🇳India anjaliprasannan

I created the MR and when I tried the command

 ddev drush ai:translate-entity node 21,22 en es

it resulted in

 [warning] Undefined array key "_columns" AiTranslateCommands.php:105
 [warning] foreach() argument must be of type array|object, null given AiTranslateCommands.php:105
 [warning] foreach() argument must be of type array|object, null given AiTranslateCommands.php:121
 [error]  Drupal\Core\Database\IntegrityConstraintViolationException: SQLSTATE[23000]: Integrity constraint violation: 1048 Column 'title' cannot be null: INSERT INTO "node_field_data" ("nid", "vid", "type", "langcode", "status", "uid", "title", "created", "changed", "promote", "sticky", "default_langcode", "revision_translation_affected", "content_translation_source", "content_translation_outdated") VALUES (:db_insert_placeholder_0, :db_insert_placeholder_1, :db_insert_placeholder_2, :db_insert_placeholder_3, :db_insert_placeholder_4, :db_insert_placeholder_5, :db_insert_placeholder_6, :db_insert_placeholder_7, :db_insert_placeholder_8, :db_insert_placeholder_9, :db_insert_placeholder_10, :db_insert_placeholder_11, :db_insert_placeholder_12, :db_insert_placeholder_13, :db_insert_placeholder_14), (:db_insert_placeholder_15, :db_insert_placeholder_16, :db_insert_placeholder_17, :db_insert_placeholder_18, :db_insert_placeholder_19, :db_insert_placeholder_20, :db_insert_placeholder_21, :db_insert_placeholder_22, :db_insert_placeholder_23, :db_insert_placeholder_24, :db_insert_placeholder_25, :db_insert_placeholder_26, :db_insert_placeholder_27, :db_insert_placeholder_28, :db_insert_placeholder_29); Array
(
    [:db_insert_placeholder_0] => 21
    [:db_insert_placeholder_1] => 94
    [:db_insert_placeholder_2] => page
    [:db_insert_placeholder_3] => en-gb
    [:db_insert_placeholder_4] => 0
    [:db_insert_placeholder_5] => 1
    [:db_insert_placeholder_6] => Test
    [:db_insert_placeholder_7] => 1753097174
    [:db_insert_placeholder_8] => 1753097179
    [:db_insert_placeholder_9] => 0
    [:db_insert_placeholder_10] => 0
    [:db_insert_placeholder_11] => 1
    [:db_insert_placeholder_12] => 
    [:db_insert_placeholder_13] => und
    [:db_insert_placeholder_14] => 0
    [:db_insert_placeholder_15] => 21
    [:db_insert_placeholder_16] => 94
    [:db_insert_placeholder_17] => page
    [:db_insert_placeholder_18] => es
    [:db_insert_placeholder_19] => 1
    [:db_insert_placeholder_20] => 0
    [:db_insert_placeholder_21] => 
    [:db_insert_placeholder_22] => 1753097334
    [:db_insert_placeholder_23] => 1753097334
    [:db_insert_placeholder_24] => 0
    [:db_insert_placeholder_25] => 0
    [:db_insert_placeholder_26] => 0
    [:db_insert_placeholder_27] => 1
    [:db_insert_placeholder_28] => und
    [:db_insert_placeholder_29] => 0
)
 in Drupal\mysql\Driver\Database\mysql\ExceptionHandler->rethrowNormalizedException() (line 83 of /var/www/html/core/modules/mysql/src/Driver/Database/mysql/ExceptionHandler.php). 
 [warning] SQLSTATE[23000]: Integrity constraint violation: 1048 Column 'title' cannot be null: INSERT INTO "node_field_data" ("nid", "vid", "type", "langcode", "status", "uid", "title", "created", "changed", "promote", "sticky", "default_langcode", "revision_translation_affected", "content_translation_source", "content_translation_outdated") VALUES (:db_insert_placeholder_0, :db_insert_placeholder_1, :db_insert_placeholder_2, :db_insert_placeholder_3, :db_insert_placeholder_4, :db_insert_placeholder_5, :db_insert_placeholder_6, :db_insert_placeholder_7, :db_insert_placeholder_8, :db_insert_placeholder_9, :db_insert_placeholder_10, :db_insert_placeholder_11, :db_insert_placeholder_12, :db_insert_placeholder_13, :db_insert_placeholder_14), (:db_insert_placeholder_15, :db_insert_placeholder_16, :db_insert_placeholder_17, :db_insert_placeholder_18, :db_insert_placeholder_19, :db_insert_placeholder_20, :db_insert_placeholder_21, :db_insert_placeholder_22, :db_insert_placeholder_23, :db_insert_placeholder_24, :db_insert_placeholder_25, :db_insert_placeholder_26, :db_insert_placeholder_27, :db_insert_placeholder_28, :db_insert_placeholder_29); Array
(
    [:db_insert_placeholder_0] => 21
    [:db_insert_placeholder_1] => 94
    [:db_insert_placeholder_2] => page
    [:db_insert_placeholder_3] => en-gb
    [:db_insert_placeholder_4] => 0
    [:db_insert_placeholder_5] => 1
    [:db_insert_placeholder_6] => Test
    [:db_insert_placeholder_7] => 1753097174
    [:db_insert_placeholder_8] => 1753097179
    [:db_insert_placeholder_9] => 0
    [:db_insert_placeholder_10] => 0
    [:db_insert_placeholder_11] => 1
    [:db_insert_placeholder_12] => 
    [:db_insert_placeholder_13] => und
    [:db_insert_placeholder_14] => 0
    [:db_insert_placeholder_15] => 21
    [:db_insert_placeholder_16] => 94
    [:db_insert_placeholder_17] => page
    [:db_insert_placeholder_18] => es
    [:db_insert_placeholder_19] => 1
    [:db_insert_placeholder_20] => 0
    [:db_insert_placeholder_21] => 
    [:db_insert_placeholder_22] => 1753097334
    [:db_insert_placeholder_23] => 1753097334
    [:db_insert_placeholder_24] => 0
    [:db_insert_placeholder_25] => 0
    [:db_insert_placeholder_26] => 0
    [:db_insert_placeholder_27] => 1
    [:db_insert_placeholder_28] => und
    [:db_insert_placeholder_29] => 0
)

Also attaching other results
when I execute ddev drush ai:translate-entity node 16,18,20 fr en
results in Message: Translation already exists.
where I have not added french as language.

for ddev drush ai:translate-entity node 16,18,20 en es
again results in Message: Translation already exists.
whereas there is translations for 16, 18 but for node 20 does not have translation,

for ddev drush ai:translate-entity node 20 en es
results in

ddev drush ai:translate-entity node 20 en es
 [warning] Undefined array key "_columns" AiTranslateCommands.php:105
 [warning] foreach() argument must be of type array|object, null given AiTranslateCommands.php:105
 [warning] foreach() argument must be of type array|object, null given AiTranslateCommands.php:121
 [warning] Undefined array key "_columns" AiTranslateCommands.php:105
 [warning] foreach() argument must be of type array|object, null given AiTranslateCommands.php:105
 [warning] foreach() argument must be of type array|object, null given AiTranslateCommands.php:121
 [warning] Call to a member function checkIfEmpty() on null
 [error]  Message: There was some issue with content translation.
🇮🇳India anjaliprasannan

@marcus_johansson I have changed to 1.2.x.

🇮🇳India anjaliprasannan

@marcus_johansson can you please review and suggest if any changes required.

🇮🇳India anjaliprasannan

I have tested the fix.
The generate image plugin is available in AI Tools plugins and on enable it appears in ckeditor.
But when I select the text and use the generate image plugin in ai assistant, the text appears in selected text. On generate image button click image is not created and a console error is thrown.

Production build 0.71.5 2024