Automator Chain not working with ai_ckeditor

Created on 13 February 2025, 9 days ago

This is using Drupal CMS 1.0 on Drupal 11 with the drupal_cms_ai recipe.

When creating a custom Automator Chain as per the docs the the "Setup complex CKEditor AI Assistants in Drupal" video, it never sends the prompt to the AI provider and throws errors in the log.

Steps to reproduce:

  1. Create a new Automator Chain (called it "Test Automator")
  2. Add a field called "Input Text" that is Plain Text (long) and mark it as Required
  3. Add a field called "Process Text" that is Plain Text (long) and enable the AI Automator
  4. Use Basic mode and point it to Input Text as the input field
  5. Enter a simple prompt. In my example, I used "Rewrite the input text to make it sound like a pirate. Input text: {{ context }}"
  6. Add a field called "Output Text" that is Formatted Text (long) and enable the AI Automator
  7. Use Basic mode and point it to Process Text" as the input field
  8. Enter a prompt like "Convert the input text to html. Input text: {{ context }}"
  9. Go to the CKEditor AI Agent configuration and enable this new Automator chain.
  10. Select Input Text as the input and in the dropdown for Selected Text. Ensure the Output field is set to Output Text
  11. Within CKEditor, select some content and select the Automator from the dropdown menu
  12. The dialog should open with the selected text in the input. Click the Generate button
  13. No output text will be shown and you should see the error message "Oops, something went wrong. Check your browser's developer console for more details."

Errors in log:

Looking in the recent log messages, there is the following error:

Symfony\Component\HttpKernel\Exception\HttpException: The specified #ajax callback is empty or not callable. in Drupal\Core\Form\FormAjaxResponseBuilder->buildResponse() (line 67 of /var/www/docroot/core/lib/Drupal/Core/Form/FormAjaxResponseBuilder.php).

#0 /var/www/docroot/core/lib/Drupal/Core/Form/EventSubscriber/FormAjaxSubscriber.php(112): Drupal\Core\Form\FormAjaxResponseBuilder->buildResponse(Object(Symfony\Component\HttpFoundation\Request), Array, Object(Drupal\Core\Form\FormState), Array)
#1 /var/www/vendor/symfony/event-dispatcher/EventDispatcher.php(246): Drupal\Core\Form\EventSubscriber\FormAjaxSubscriber->onException(Object(Symfony\Component\HttpKernel\Event\ExceptionEvent), 'kernel.exceptio...', Object(Symfony\Component\EventDispatcher\EventDispatcher))
#2 /var/www/vendor/symfony/event-dispatcher/EventDispatcher.php(206): Symfony\Component\EventDispatcher\EventDispatcher::Symfony\Component\EventDispatcher\{closure}(Object(Symfony\Component\HttpKernel\Event\ExceptionEvent), 'kernel.exceptio...', Object(Symfony\Component\EventDispatcher\EventDispatcher))
#3 /var/www/vendor/symfony/event-dispatcher/EventDispatcher.php(56): Symfony\Component\EventDispatcher\EventDispatcher->callListeners(Array, 'kernel.exceptio...', Object(Symfony\Component\HttpKernel\Event\ExceptionEvent))
#4 /var/www/vendor/symfony/http-kernel/HttpKernel.php(241): Symfony\Component\EventDispatcher\EventDispatcher->dispatch(Object(Symfony\Component\HttpKernel\Event\ExceptionEvent), 'kernel.exceptio...')
#5 /var/www/vendor/symfony/http-kernel/HttpKernel.php(91): Symfony\Component\HttpKernel\HttpKernel->handleThrowable(Object(Drupal\Core\Form\FormAjaxException), Object(Symfony\Component\HttpFoundation\Request), 1)
#6 /var/www/docroot/core/lib/Drupal/Core/StackMiddleware/Session.php(53): Symfony\Component\HttpKernel\HttpKernel->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#7 /var/www/docroot/core/lib/Drupal/Core/StackMiddleware/KernelPreHandle.php(48): Drupal\Core\StackMiddleware\Session->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#8 /var/www/docroot/core/lib/Drupal/Core/StackMiddleware/ContentLength.php(28): Drupal\Core\StackMiddleware\KernelPreHandle->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#9 /var/www/docroot/core/modules/big_pipe/src/StackMiddleware/ContentLength.php(32): Drupal\Core\StackMiddleware\ContentLength->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#10 /var/www/docroot/core/modules/page_cache/src/StackMiddleware/PageCache.php(116): Drupal\big_pipe\StackMiddleware\ContentLength->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#11 /var/www/docroot/core/modules/page_cache/src/StackMiddleware/PageCache.php(90): Drupal\page_cache\StackMiddleware\PageCache->pass(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#12 /var/www/docroot/core/lib/Drupal/Core/StackMiddleware/ReverseProxyMiddleware.php(48): Drupal\page_cache\StackMiddleware\PageCache->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#13 /var/www/docroot/core/lib/Drupal/Core/StackMiddleware/NegotiationMiddleware.php(51): Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#14 /var/www/docroot/core/lib/Drupal/Core/StackMiddleware/AjaxPageState.php(36): Drupal\Core\StackMiddleware\NegotiationMiddleware->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#15 /var/www/docroot/core/lib/Drupal/Core/StackMiddleware/StackedHttpKernel.php(51): Drupal\Core\StackMiddleware\AjaxPageState->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#16 /var/www/docroot/core/lib/Drupal/Core/DrupalKernel.php(709): Drupal\Core\StackMiddleware\StackedHttpKernel->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#17 /var/www/docroot/index.php(19): Drupal\Core\DrupalKernel->handle(Object(Symfony\Component\HttpFoundation\Request))
#18 {main}

and the Location URL is:
/api/ai-ckeditor/dialog?_wrapper_format=drupal_ajax&ajax_form=1
According to the AI logs, no call is ever made to the AI providers. However, using one of the other ckeditor options, such as "Summarize" works fine, which shows that the API keys and Providers are working correctly.

(NOTE: In my original report in Slack I had the ckeditor_ai_agent module enabled, but I've removed that for this new test and only get the single log entry for the HttpException error)

πŸ› Bug report
Status

Active

Version

1.0

Component

AI Automators

Created by

πŸ‡ΊπŸ‡ΈUnited States mpotter

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

Merge Requests

Comments & Activities

Production build 0.71.5 2024