Cannot get CKEDitor 5 widget to do anything

Created on 30 September 2023, over 1 year ago
Updated 6 January 2024, about 1 year ago

Problem/Motivation

I am trying to experiment with using this module with the CKEditor 5 in Drupal 9.

My local system

Drupal Version 9.5.11
Web server: Apache/2.4.33 (Win64) OpenSSL/1.0.2u mod_fcgid/2.3.9
Database: MySQL 5.7.24
PHP: 8.1.12

I have created an Augmentor and configured my Full HTML Text format to use it as illustrated below ...

However, when I go to use it with some text, selecting it from the available Augmentors seems to 'work' as below...

... but absolutely nothing happens.

Database logging

The Watchdog appears to suggest that the GPT3 key could not be read?...

Warning: Undefined array key "4402c42b-2e0f-4163-8199-61d7f121a919" in Drupal\augmentor\AugmentorManager->getAugmentor() (line 59 of <my-site>\modules\contrib\augmentor\src\AugmentorManager.php)
#0 <my-site>\core\includes\bootstrap.inc(347): _drupal_error_handler_real(2, 'Undefined array...', 'C:\\Users\\nick\\S...', 59)
#1 <my-site>\modules\contrib\augmentor\src\AugmentorManager.php(59): _drupal_error_handler(2, 'Undefined array...', 'C:\\Users\\nick\\S...', 59)
#2 <my-site>\modules\contrib\augmentor\src\Controller\AugmentorController.php(81): Drupal\augmentor\AugmentorManager->getAugmentor('4402c42b-2e0f-4...')
#3 [internal function]: Drupal\augmentor\Controller\AugmentorController->execute()

My Aumentor(s) configuration

The documentation on exactly how to set it all up is spares but I think I was able to deduce that I needed to install an actual Augmentor and so that's when I installed OpenAI GPT3 Augmentor module and I then visited my OpenAI account and set up an API key successfully and use that key to define and new GPT3 Augmentor as below 1,2(?),3..

All seemed to be well and the Augmentor appear in the UI as below ...

HOWEVER, when I go to EDIT it, I get...

Error: Class "Orhanerday\OpenAi\OpenAi" not found in Drupal\augmentor_openai_gpt3\OpenAiGPT3Base->getClient() (line 36 of modules\contrib\augmentor_openai_gpt3\src\OpenAiGPT3Base.php).
Drupal\augmentor_openai_gpt3\OpenAiGPT3Base->getClient() (Line: 285)
Drupal\augmentor_openai_gpt3\Plugin\Augmentor\OpenAiGPT3Completions->engines() (Line: 61)
Drupal\augmentor_openai_gpt3\Plugin\Augmentor\OpenAiGPT3Completions->buildConfigurationForm(Array, Object) (Line: 112)
Drupal\augmentor\Form\AugmentorFormBase->buildForm(Array, Object, '6aa0f64e-b707-4acf-81f5-758385299a8d') (Line: 18)
Drupal\augmentor\Form\AugmentorEditForm->buildForm(Array, Object, '6aa0f64e-b707-4acf-81f5-758385299a8d')
call_user_func_array(Array, Array) (Line: 536)
Drupal\Core\Form\FormBuilder->retrieveForm('augmentor_form', Object) (Line: 283)
Drupal\Core\Form\FormBuilder->buildForm(Object, Object) (Line: 73)
Drupal\Core\Controller\FormController->getContentResult(Object, Object)
call_user_func_array(Array, Array) (Line: 123)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() (Line: 580)
Drupal\Core\Render\Renderer->executeInRenderContext(Object, Object) (Line: 124)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->wrapControllerExecutionInRenderContext(Array, Array) (Line: 97)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() (Line: 169)
Symfony\Component\HttpKernel\HttpKernel->handleRaw(Object, 1) (Line: 81)
Symfony\Component\HttpKernel\HttpKernel->handle(Object, 1, 1) (Line: 58)
Drupal\Core\StackMiddleware\Session->handle(Object, 1, 1) (Line: 48)
Drupal\Core\StackMiddleware\KernelPreHandle->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: 270)
Drupal\shield\ShieldMiddleware->bypass(Object, 1, 1) (Line: 137)
Drupal\shield\ShieldMiddleware->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: 23)
Stack\StackedHttpKernel->handle(Object, 1, 1) (Line: 718)
Drupal\Core\DrupalKernel->handle(Object) (Line: 19)

So I'm not sure whether this problem is with Augmentor AI module or with the OpenAI GPT3 Augmentor module.

Can anyone offer any guidance please?

Thank you

🐛 Bug report
Status

Closed: cannot reproduce

Version

1.1

Component

Documentation

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
  • Assigned to mandclu
  • 🇯🇵Japan eleonel Itoshima 🇯🇵
  • Issue was unassigned.
  • 🇯🇵Japan eleonel Itoshima 🇯🇵

    I'm not able to replicate the issue using the 1.1.0 release, could you please update and try again?

  • 🇬🇧United Kingdom SirClickALot Somerset

    @eleonel ,

    Thanks for coming back to me on this.

    System: Apache/2.4.33 (Win64) OpenSSL/1.0.2u mod_fcgid/2.3.9 PHP/8.1.0

    1 )I have just set up a new, clean Drupal 10.1.6 and added:

    https://www.drupal.org/project/augmentor and https://www.drupal.org/project/augmentor_chatgpt.

    2) I have set up a brand new key at OpenAI and configured everything as above - i.e. Key, ChatGPT Augmentor, Text formats and so.

    I am no longer seeing the error when I try to EDIT my existing key but, as before, when I try to do some augmenting - not I'm altogether certain as to what to expect!, I get a short twirling throbber (3)...

    And nothing else after that?

    Except for the following two Watchdog log entries...

    Warning: foreach() argument must be of type array|object, null given in Drupal\augmentor_chatgpt\Plugin\Augmentor\ChatGpt->execute() (line 327 of C:\Users\nick\Sites\drupal10\modules\contrib\augmentor_chatgpt\src\Plugin\Augmentor\ChatGpt.php)
    #0 C:\Users\nick\Sites\drupal10\core\includes\bootstrap.inc(164): _drupal_error_handler_real(2, 'foreach() argum...', 'C:\\Users\\nick\\S...', 327)
    #1 C:\Users\nick\Sites\drupal10\modules\contrib\augmentor_chatgpt\src\Plugin\Augmentor\ChatGpt.php(327): _drupal_error_handler(2, 'foreach() argum...', 'C:\\Users\\nick\\S...', 327)
    #2 C:\Users\nick\Sites\drupal10\modules\contrib\augmentor\src\Controller\AugmentorController.php(82): Drupal\augmentor_chatgpt\Plugin\Augmentor\ChatGpt->execute('one, two, three...')
    #3 [internal function]: Drupal\augmentor\Controller\AugmentorController->execute()
    #4 C:\Users\nick\Sites\drupal10\core\lib\Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber.php(123): call_user_func_array(Array, Array)
    #5 C:\Users\nick\Sites\drupal10\core\lib\Drupal\Core\Render\Renderer.php(592): Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}()
    #6 C:\Users\nick\Sites\drupal10\core\lib\Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber.php(124): Drupal\Core\Render\Renderer->executeInRenderContext(Object(Drupal\Core\Render\RenderContext), Object(Closure))
    #7 C:\Users\nick\Sites\drupal10\core\lib\Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber.php(97): Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->wrapControllerExecutionInRenderContext(Array, Array)
    #8 C:\Users\nick\Sites\drupal10\vendor\symfony\http-kernel\HttpKernel.php(181): Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}()
    #9 C:\Users\nick\Sites\drupal10\vendor\symfony\http-kernel\HttpKernel.php(76): Symfony\Component\HttpKernel\HttpKernel->handleRaw(Object(Symfony\Component\HttpFoundation\Request), 1)
    #10 C:\Users\nick\Sites\drupal10\core\lib\Drupal\Core\StackMiddleware\Session.php(58): Symfony\Component\HttpKernel\HttpKernel->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
    #11 C:\Users\nick\Sites\drupal10\core\lib\Drupal\Core\StackMiddleware\KernelPreHandle.php(48): Drupal\Core\StackMiddleware\Session->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
    #12 C:\Users\nick\Sites\drupal10\core\modules\page_cache\src\StackMiddleware\PageCache.php(106): Drupal\Core\StackMiddleware\KernelPreHandle->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
    #13 C:\Users\nick\Sites\drupal10\core\modules\page_cache\src\StackMiddleware\PageCache.php(85): Drupal\page_cache\StackMiddleware\PageCache->pass(Object(Symfony\Component\HttpFoundation\Request), 1, true)
    #14 C:\Users\nick\Sites\drupal10\core\lib\Drupal\Core\StackMiddleware\ReverseProxyMiddleware.php(48): Drupal\page_cache\StackMiddleware\PageCache->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
    #15 C:\Users\nick\Sites\drupal10\core\lib\Drupal\Core\StackMiddleware\NegotiationMiddleware.php(51): Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
    #16 C:\Users\nick\Sites\drupal10\core\lib\Drupal\Core\StackMiddleware\StackedHttpKernel.php(51): Drupal\Core\StackMiddleware\NegotiationMiddleware->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
    #17 C:\Users\nick\Sites\drupal10\core\lib\Drupal\Core\DrupalKernel.php(704): Drupal\Core\StackMiddleware\StackedHttpKernel->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
    #18 C:\Users\nick\Sites\drupal10\index.php(19): Drupal\Core\DrupalKernel->handle(Object(Symfony\Component\HttpFoundation\Request))
    #19 {main}

    and...

    Warning: Undefined array key "choices" in Drupal\augmentor_chatgpt\Plugin\Augmentor\ChatGpt->execute() (line 327 of C:\Users\nick\Sites\drupal10\modules\contrib\augmentor_chatgpt\src\Plugin\Augmentor\ChatGpt.php)
    #0 C:\Users\nick\Sites\drupal10\core\includes\bootstrap.inc(164): _drupal_error_handler_real(2, 'Undefined array...', 'C:\\Users\\nick\\S...', 327)
    #1 C:\Users\nick\Sites\drupal10\modules\contrib\augmentor_chatgpt\src\Plugin\Augmentor\ChatGpt.php(327): _drupal_error_handler(2, 'Undefined array...', 'C:\\Users\\nick\\S...', 327)
    #2 C:\Users\nick\Sites\drupal10\modules\contrib\augmentor\src\Controller\AugmentorController.php(82): Drupal\augmentor_chatgpt\Plugin\Augmentor\ChatGpt->execute('one, two, three...')
    #3 [internal function]: Drupal\augmentor\Controller\AugmentorController->execute()
    #4 C:\Users\nick\Sites\drupal10\core\lib\Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber.php(123): call_user_func_array(Array, Array)
    #5 C:\Users\nick\Sites\drupal10\core\lib\Drupal\Core\Render\Renderer.php(592): Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}()
    #6 C:\Users\nick\Sites\drupal10\core\lib\Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber.php(124): Drupal\Core\Render\Renderer->executeInRenderContext(Object(Drupal\Core\Render\RenderContext), Object(Closure))
    #7 C:\Users\nick\Sites\drupal10\core\lib\Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber.php(97): Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->wrapControllerExecutionInRenderContext(Array, Array)
    #8 C:\Users\nick\Sites\drupal10\vendor\symfony\http-kernel\HttpKernel.php(181): Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}()
    #9 C:\Users\nick\Sites\drupal10\vendor\symfony\http-kernel\HttpKernel.php(76): Symfony\Component\HttpKernel\HttpKernel->handleRaw(Object(Symfony\Component\HttpFoundation\Request), 1)
    #10 C:\Users\nick\Sites\drupal10\core\lib\Drupal\Core\StackMiddleware\Session.php(58): Symfony\Component\HttpKernel\HttpKernel->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
    #11 C:\Users\nick\Sites\drupal10\core\lib\Drupal\Core\StackMiddleware\KernelPreHandle.php(48): Drupal\Core\StackMiddleware\Session->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
    #12 C:\Users\nick\Sites\drupal10\core\modules\page_cache\src\StackMiddleware\PageCache.php(106): Drupal\Core\StackMiddleware\KernelPreHandle->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
    #13 C:\Users\nick\Sites\drupal10\core\modules\page_cache\src\StackMiddleware\PageCache.php(85): Drupal\page_cache\StackMiddleware\PageCache->pass(Object(Symfony\Component\HttpFoundation\Request), 1, true)
    #14 C:\Users\nick\Sites\drupal10\core\lib\Drupal\Core\StackMiddleware\ReverseProxyMiddleware.php(48): Drupal\page_cache\StackMiddleware\PageCache->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
    #15 C:\Users\nick\Sites\drupal10\core\lib\Drupal\Core\StackMiddleware\NegotiationMiddleware.php(51): Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
    #16 C:\Users\nick\Sites\drupal10\core\lib\Drupal\Core\StackMiddleware\StackedHttpKernel.php(51): Drupal\Core\StackMiddleware\NegotiationMiddleware->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
    #17 C:\Users\nick\Sites\drupal10\core\lib\Drupal\Core\DrupalKernel.php(704): Drupal\Core\StackMiddleware\StackedHttpKernel->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
    #18 C:\Users\nick\Sites\drupal10\index.php(19): Drupal\Core\DrupalKernel->handle(Object(Symfony\Component\HttpFoundation\Request))
    #19 {main}

    As per the original issue, I'm not really very sure exactly what 'type' of Key to set up so I have gone with 'configuration' as in the original screenshot, is that right, could that be the problem, I could not see any guidance on this on the module page.

    It might be really helpful to other newbies on this to set up a short but complete step-by-step page including an example of SECRET generation on (say) the OpenAI site as I suspect that it is the one that most dabblers like me would try first.

    Thanks again.

  • 🇬🇧United Kingdom SirClickALot Somerset

    Any more thoughts core Augmentor Team?

    I'd love to be able to get started with this module!

  • 🇯🇵Japan eleonel Itoshima 🇯🇵

    Hey there, we're still evaluating the situation. We'll review it again shortly and return with some guidance soon.

  • 🇬🇧United Kingdom SirClickALot Somerset

    Might this be it?

    ChatGPT will not allow your system to make API request if the site is not SSL enabled. So in order to make it work with your local project setup, you can download the cacert.pem file from here - https://curl.se/docs/caextract.html. Then create a 'certificates' folder inside your wamp directory and place the cacert file inside the folder. Now you can edit your php.ini file and provide the cacert.pem file path for the "curl.cainfo" option. This will allow your local project also to make secure cURL call.

    Guidance taken from: https://www.drupal.org/project/chatgpt_plugin

  • 🇯🇵Japan eleonel Itoshima 🇯🇵

    Oh that could be yeah, please try to setup the project in your local with ddev or lando so you can have SSL and run it on your local.

    In another issue I'm working in improving the error logging to catch problems like this one and provide more useful information to the user.

  • Status changed to Closed: cannot reproduce about 1 year ago
  • 🇯🇵Japan eleonel Itoshima 🇯🇵
Production build 0.71.5 2024