CKEditor AI Assistant broken after update to alpha6

Created on 6 August 2024, 4 months ago
Updated 18 September 2024, 3 months ago

Problem/Motivation

After updating to alpha6, I am seeing no dropdown menu (or anything else that might be new) when I click the button…

Warning: Undefined array key "plugins" in Drupal\ai_ckeditor\Plugin\CKEditor5Plugin\AiCKEditor->getDynamicPluginConfig() (line 190 of modules\contrib\ai\modules\ai_ckeditor\src\Plugin\CKEditor5Plugin\AiCKEditor.php).
Drupal\ai_ckeditor\Plugin\CKEditor5Plugin\AiCKEditor->getDynamicPluginConfig(Array, Object) (Line: 323)
Drupal\ckeditor5\Plugin\CKEditor5PluginManager->getCKEditor5PluginConfig(Object) (Line: 949)
Drupal\ckeditor5\Plugin\Editor\CKEditor5->getJSSettings(Object) (Line: 82)
Drupal\editor\Plugin\EditorManager->getAttachments(Array) (Line: 100)
Drupal\editor\Element->preRenderTextFormat(Array)
call_user_func_array(Array, Array) (Line: 113)
Drupal\Core\Render\Renderer->doTrustedCallback(Array, Array, 'Render #pre_render callbacks must be methods of a class that implements \Drupal\Core\Security\TrustedCallbackInterface or be an anonymous function. The callback was %s. See https://www.drupal.org/node/2966725', 'exception', 'Drupal\Core\Render\Element\RenderCallbackInterface') (Line: 870)
Drupal\Core\Render\Renderer->doCallback('#pre_render', 'element.editor:preRenderTextFormat', Array) (Line: 432)
Drupal\Core\Render\Renderer->doRender(Array, ) (Line: 248)
Drupal\Core\Render\Renderer->render(Array) (Line: 475)
Drupal\Core\Template\TwigExtension->escapeFilter(Object, Array, 'html', NULL, 1) (Line: 90)
__TwigTemplate_563a3c4c20b3e926e5486f3dff516eb0->doDisplay(Array, Array) (Line: 360)
Twig\Template->yield(Array) (Line: 335)
Twig\Template->render(Array) (Line: 38)
Twig\TemplateWrapper->render(Array) (Line: 33)
twig_render_template('core/themes/claro/templates/form/field-multiple-value-form.html.twig', Array) (Line: 348)
Drupal\Core\Theme\ThemeManager->render('field_multiple_value_form', Array) (Line: 491)
Drupal\Core\Render\Renderer->doRender(Array) (Line: 504)
Drupal\Core\Render\Renderer->doRender(Array) (Line: 504)
Drupal\Core\Render\Renderer->doRender(Array, ) (Line: 248)
Drupal\Core\Render\Renderer->render(Array) (Line: 475)
Drupal\Core\Template\TwigExtension->escapeFilter(Object, Array, 'html', NULL, 1) (Line: 63)
__TwigTemplate_418f7a7d458a07ad792c56a66c9858f8->doDisplay(Array, Array) (Line: 360)
Twig\Template->yield(Array) (Line: 335)
Twig\Template->render(Array) (Line: 38)
Twig\TemplateWrapper->render(Array) (Line: 33)
twig_render_template('themes/contrib/gin/templates/node/node-edit-form.html.twig', Array) (Line: 348)
Drupal\Core\Theme\ThemeManager->render('node_edit_form', Array) (Line: 491)
Drupal\Core\Render\Renderer->doRender(Array, ) (Line: 248)
Drupal\Core\Render\Renderer->render(Array, ) (Line: 238)
Drupal\Core\Render\MainContent\HtmlRenderer->Drupal\Core\Render\MainContent\{closure}() (Line: 638)
Drupal\Core\Render\Renderer->executeInRenderContext(Object, Object) (Line: 231)
Drupal\Core\Render\MainContent\HtmlRenderer->prepare(Array, Object, Object) (Line: 128)
Drupal\Core\Render\MainContent\HtmlRenderer->renderResponse(Array, Object, Object) (Line: 90)
Drupal\Core\EventSubscriber\MainContentViewSubscriber->onViewRenderArray(Object, 'kernel.view', Object)
call_user_func(Array, Object, 'kernel.view', Object) (Line: 111)
Drupal\Component\EventDispatcher\ContainerAwareEventDispatcher->dispatch(Object, 'kernel.view') (Line: 186)
Symfony\Component\HttpKernel\HttpKernel->handleRaw(Object, 1) (Line: 76)
Symfony\Component\HttpKernel\HttpKernel->handle(Object, 1, 1) (Line: 53)
Drupal\Core\StackMiddleware\Session->handle(Object, 1, 1) (Line: 48)
Drupal\Core\StackMiddleware\KernelPreHandle->handle(Object, 1, 1) (Line: 28)
Drupal\Core\StackMiddleware\ContentLength->handle(Object, 1, 1) (Line: 32)
Drupal\big_pipe\StackMiddleware\ContentLength->handle(Object, 1, 1) (Line: 106)
Drupal\page_cache\StackMiddleware\PageCache->pass(Object, 1, 1) (Line: 85)
Drupal\page_cache\StackMiddleware\PageCache->handle(Object, 1, 1) (Line: 48)
Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle(Object, 1, 1) (Line: 51)
Drupal\Core\StackMiddleware\NegotiationMiddleware->handle(Object, 1, 1) (Line: 36)
Drupal\Core\StackMiddleware\AjaxPageState->handle(Object, 1, 1) (Line: 51)
Drupal\Core\StackMiddleware\StackedHttpKernel->handle(Object, 1, 1) (Line: 741)
Drupal\Core\DrupalKernel->handle(Object) (Line: 19)

and..

Warning: foreach() argument must be of type array|object, null given in Drupal\ai_ckeditor\Plugin\CKEditor5Plugin\AiCKEditor->getDynamicPluginConfig() (line 190 of modules\contrib\ai\modules\ai_ckeditor\src\Plugin\CKEditor5Plugin\AiCKEditor.php).
Drupal\ai_ckeditor\Plugin\CKEditor5Plugin\AiCKEditor->getDynamicPluginConfig(Array, Object) (Line: 323)
Drupal\ckeditor5\Plugin\CKEditor5PluginManager->getCKEditor5PluginConfig(Object) (Line: 949)
Drupal\ckeditor5\Plugin\Editor\CKEditor5->getJSSettings(Object) (Line: 82)
Drupal\editor\Plugin\EditorManager->getAttachments(Array) (Line: 100)
Drupal\editor\Element->preRenderTextFormat(Array)
call_user_func_array(Array, Array) (Line: 113)
Drupal\Core\Render\Renderer->doTrustedCallback(Array, Array, 'Render #pre_render callbacks must be methods of a class that implements \Drupal\Core\Security\TrustedCallbackInterface or be an anonymous function. The callback was %s. See https://www.drupal.org/node/2966725', 'exception', 'Drupal\Core\Render\Element\RenderCallbackInterface') (Line: 870)
Drupal\Core\Render\Renderer->doCallback('#pre_render', 'element.editor:preRenderTextFormat', Array) (Line: 432)
Drupal\Core\Render\Renderer->doRender(Array, ) (Line: 248)
Drupal\Core\Render\Renderer->render(Array) (Line: 475)
Drupal\Core\Template\TwigExtension->escapeFilter(Object, Array, 'html', NULL, 1) (Line: 90)
__TwigTemplate_563a3c4c20b3e926e5486f3dff516eb0->doDisplay(Array, Array) (Line: 360)
Twig\Template->yield(Array) (Line: 335)
Twig\Template->render(Array) (Line: 38)
Twig\TemplateWrapper->render(Array) (Line: 33)
twig_render_template('core/themes/claro/templates/form/field-multiple-value-form.html.twig', Array) (Line: 348)
Drupal\Core\Theme\ThemeManager->render('field_multiple_value_form', Array) (Line: 491)
Drupal\Core\Render\Renderer->doRender(Array) (Line: 504)
Drupal\Core\Render\Renderer->doRender(Array) (Line: 504)
Drupal\Core\Render\Renderer->doRender(Array, ) (Line: 248)
Drupal\Core\Render\Renderer->render(Array) (Line: 475)
Drupal\Core\Template\TwigExtension->escapeFilter(Object, Array, 'html', NULL, 1) (Line: 63)
__TwigTemplate_418f7a7d458a07ad792c56a66c9858f8->doDisplay(Array, Array) (Line: 360)
Twig\Template->yield(Array) (Line: 335)
Twig\Template->render(Array) (Line: 38)
Twig\TemplateWrapper->render(Array) (Line: 33)
twig_render_template('themes/contrib/gin/templates/node/node-edit-form.html.twig', Array) (Line: 348)
Drupal\Core\Theme\ThemeManager->render('node_edit_form', Array) (Line: 491)
Drupal\Core\Render\Renderer->doRender(Array, ) (Line: 248)
Drupal\Core\Render\Renderer->render(Array, ) (Line: 238)
Drupal\Core\Render\MainContent\HtmlRenderer->Drupal\Core\Render\MainContent\{closure}() (Line: 638)
Drupal\Core\Render\Renderer->executeInRenderContext(Object, Object) (Line: 231)
Drupal\Core\Render\MainContent\HtmlRenderer->prepare(Array, Object, Object) (Line: 128)
Drupal\Core\Render\MainContent\HtmlRenderer->renderResponse(Array, Object, Object) (Line: 90)
Drupal\Core\EventSubscriber\MainContentViewSubscriber->onViewRenderArray(Object, 'kernel.view', Object)
call_user_func(Array, Object, 'kernel.view', Object) (Line: 111)
Drupal\Component\EventDispatcher\ContainerAwareEventDispatcher->dispatch(Object, 'kernel.view') (Line: 186)
Symfony\Component\HttpKernel\HttpKernel->handleRaw(Object, 1) (Line: 76)
Symfony\Component\HttpKernel\HttpKernel->handle(Object, 1, 1) (Line: 53)
Drupal\Core\StackMiddleware\Session->handle(Object, 1, 1) (Line: 48)
Drupal\Core\StackMiddleware\KernelPreHandle->handle(Object, 1, 1) (Line: 28)
Drupal\Core\StackMiddleware\ContentLength->handle(Object, 1, 1) (Line: 32)
Drupal\big_pipe\StackMiddleware\ContentLength->handle(Object, 1, 1) (Line: 106)
Drupal\page_cache\StackMiddleware\PageCache->pass(Object, 1, 1) (Line: 85)
Drupal\page_cache\StackMiddleware\PageCache->handle(Object, 1, 1) (Line: 48)
Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle(Object, 1, 1) (Line: 51)
Drupal\Core\StackMiddleware\NegotiationMiddleware->handle(Object, 1, 1) (Line: 36)
Drupal\Core\StackMiddleware\AjaxPageState->handle(Object, 1, 1) (Line: 51)
Drupal\Core\StackMiddleware\StackedHttpKernel->handle(Object, 1, 1) (Line: 741)
Drupal\Core\DrupalKernel->handle(Object) (Line: 19)

Multiple Drupal cache-clears tried and browser frontend cache kill off but no good.

I had a hunch that enabling the AI Assistant API might help but it did not.

System

Drupal 10.3.1
Apache/2.4.33 (Win64) OpenSSL/1.0.2u mod_fcgid/2.3.9 PHP/8.3.1
PHP 8.3.7, memory limit: 256M
MySQL 5.7.24
PHP Caching module: OpCache
Web browser: Version 127.0.6533.89 (Official Build) (64-bit)
πŸ› Bug report
Status

Active

Version

1.0

Component

User interface

Created by

πŸ‡¬πŸ‡§United Kingdom SirClickALot Somerset

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

Comments & Activities

  • Issue created by @SirClickALot
  • πŸ‡§πŸ‡ͺBelgium wouters_f Leuven

    Did you try clearing the cache?
    I was not able to reproduce this.
    Is this still happening?

  • πŸ‡¬πŸ‡§United Kingdom SirClickALot Somerset

    Yes, cache cleared multiple times.

    @wouters_f Did you install from scratch or update?

  • πŸ‡¨πŸ‡³China fishfree

    +1
    My environment: Drupal 10.3.3, PHP 8.2, the latest ai dev version.

  • πŸ‡©πŸ‡ͺGermany marcus_johansson

    Hi guys, I recorded a video of me setting it up from scratch, maybe you are missing some config?

    https://www.youtube.com/watch?v=CUjZ4HQTZ14&ab_channel=DrupalAIVideos

    If you replicate that and it still doesn't work, let me know.

  • πŸ‡¬πŸ‡§United Kingdom SirClickALot Somerset

    Thanks @marcus_johansson, I will try again with a fresh D10 site and report back).

    Was the video based on the current DEV (1.0.x-dev) or the current release version (1.0.0-alpha6) ?

  • πŸ‡©πŸ‡ͺGermany marcus_johansson

    Current DEV.

  • πŸ‡¬πŸ‡§United Kingdom SirClickALot Somerset

    OK, I can confirm that with 1.0.x-dev on a bradnb new D10 site (10.3.5) works all good.

    I wonder if, in may case, it was because I was trying to use the alpha.

    I notice also that you mention that you had previously installed the key module and then presumably you added your OpenAI key (which I don't think you mentioned) but what you didn't seem to do/say in the video was to associate your chosen default model with that key? I'm sure that you must have previously done so or the whole thing couldn't possibly work but I think you should perhaps point it out.

    When I first tried out the original Open AI module many months ago, I had no idea that need to even have a key, let alone needed to associate with a particular provider model within the Drupal site. That might seem blindingly obvious to someone working with GPT via API all day every day but to the average site-builder it certainly might not be β€” they might naively assume that the API connection to OpenAI was merely using some kind of 'free' version that didn't need a key much like the public do when using ChatGPT.

    Given that a key tenet of the module suite is to enable site builders to get going ASAP with zero coding, what I am hopefully pointing out is that it is basically best - SPELL IT ALL OUT;-) We can only hope and trust that people then read it guidance.

    Great work team, a brilliant module, brilliantly implemented - this will I'm sure become a standard sooner or later.

  • πŸ‡§πŸ‡ͺBelgium wouters_f Leuven

    Thanks for your feedback sir clickalot!
    I totally agree on that we should make it as obvious as possible.
    Feel free to help document things too.
    Any helpfull addition in the README's is also warmly welcomed!
    our docs folder (readme's from the module and submodules) needs a lot of love!
    https://git.drupalcode.org/project/ai/-/tree/1.0.x/docs

  • πŸ‡§πŸ‡ͺBelgium wouters_f Leuven

    @sir, will you close the issue then?

  • πŸ‡§πŸ‡ͺBelgium victonator

    I had the same error on a fresh install.
    I added the button to a text format without configuring the options below. Configuring the options below got rid of the error and added the button to the text format :).

Production build 0.71.5 2024