- Issue created by @MrDaleSmith
-
marcus_johansson →
committed 83b9cd00 on 1.0.x
Issue #3487287: Fatal error altering form display
-
marcus_johansson →
committed 83b9cd00 on 1.0.x
- 🇩🇪Germany marcus_johansson
@mrdalesmith - this has been pushed into the dev branch, could you retest if you get the same error?
- 🇬🇧United Kingdom MrDaleSmith
Still erroring in a different way: I really think this needs a catch on it so unexpected errors don't get shown to the user:
The website encountered an unexpected error. Try again later. Prompts: 1. Could you make sure that only high-definition images can be uploaded to a wine tour? (To ensure only high-definition images can be uploaded, I can set a minimum resolution for the images on the "Wine tour" content type. Would you like me to proceed with this change? If so, please specify the minimum width and height (in pixels) for the images.) 2. 2048×1536 (Error as below) TypeError: implode(): Argument #1 ($array) must be of type array, string given in implode() (line 479 of modules/contrib/aiagents/src/Plugin/AiAgent/FieldType.php). Drupal\aiagents\Plugin\AiAgent\FieldType->solve() (Line: 232) Drupal\aiagents\Plugin\AiAssistantAction\AgentAction->triggerAction() (Line: 406) Drupal\aiassistantapi\AiAssistantApiRunner->process() (Line: 127) Drupal\aichatbot\Form\ChatForm->submitForm() calluserfuncarray() (Line: 129) Drupal\Core\Form\FormSubmitter->executeSubmitHandlers() (Line: 67) Drupal\Core\Form\FormSubmitter->doSubmitForm() (Line: 597) Drupal\Core\Form\FormBuilder->processForm() (Line: 144) Drupal\autosaveform\Form\AutosaveFormBuilder->processForm() (Line: 326) Drupal\Core\Form\FormBuilder->buildForm() (Line: 97) Drupal\autosaveform\Form\AutosaveFormBuilder->buildForm() (Line: 242) Drupal\aichatbot\Plugin\Block\ChatFormBlock->build() (Line: 171) Drupal\block\BlockViewBuilder::preRender() calluserfunc_array() (Line: 113) Drupal\Core\Render\Renderer->doTrustedCallback() (Line: 870) Drupal\Core\Render\Renderer->doCallback() (Line: 432) Drupal\Core\Render\Renderer->doRender() (Line: 504) Drupal\Core\Render\Renderer->doRender() (Line: 248) Drupal\Core\Render\Renderer->render() (Line: 476) Drupal\Core\Template\TwigExtension->escapeFilter() (Line: 163) _TwigTemplatea6daddf5db7afd38bdd7a28820cbf4a7->doDisplay() (Line: 393) Twig\Template->yield() (Line: 349) Twig\Template->display() (Line: 364) Twig\Template->render() (Line: 35) Twig\TemplateWrapper->render() (Line: 33) twigrendertemplate() (Line: 348) Drupal\Core\Theme\ThemeManager->render() (Line: 491) Drupal\Core\Render\Renderer->doRender() (Line: 248) Drupal\Core\Render\Renderer->render() (Line: 476) Drupal\Core\Template\TwigExtension->escapeFilter() (Line: 92) _TwigTemplatec80b4cee356caa7a247354cd1c770e6b->doDisplay() (Line: 393) Twig\Template->yield() (Line: 349) Twig\Template->display() (Line: 364) Twig\Template->render() (Line: 35) Twig\TemplateWrapper->render() (Line: 33) twigrendertemplate() (Line: 348) Drupal\Core\Theme\ThemeManager->render() (Line: 491) Drupal\Core\Render\Renderer->doRender() (Line: 248) Drupal\Core\Render\Renderer->render() (Line: 158) Drupal\Core\Render\MainContent\HtmlRenderer->Drupal\Core\Render\MainContent{closure}() (Line: 638) Drupal\Core\Render\Renderer->executeInRenderContext() (Line: 153) Drupal\Core\Render\MainContent\HtmlRenderer->renderResponse() (Line: 90) Drupal\Core\EventSubscriber\MainContentViewSubscriber->onViewRenderArray() calluserfunc() (Line: 111) Drupal\Component\EventDispatcher\ContainerAwareEventDispatcher->dispatch() (Line: 186) Symfony\Component\HttpKernel\HttpKernel->handleRaw() (Line: 76) Symfony\Component\HttpKernel\HttpKernel->handle() (Line: 53) Drupal\Core\StackMiddleware\Session->handle() (Line: 48) Drupal\Core\StackMiddleware\KernelPreHandle->handle() (Line: 28) Drupal\Core\StackMiddleware\ContentLength->handle() (Line: 32) Drupal\bigpipe\StackMiddleware\ContentLength->handle() (Line: 116) Drupal\pagecache\StackMiddleware\PageCache->pass() (Line: 90) Drupal\page_cache\StackMiddleware\PageCache->handle() (Line: 48) Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle() (Line: 51) Drupal\Core\StackMiddleware\NegotiationMiddleware->handle() (Line: 36) Drupal\Core\StackMiddleware\AjaxPageState->handle() (Line: 51) Drupal\Core\StackMiddleware\StackedHttpKernel->handle() (Line: 741) Drupal\Core\DrupalKernel->handle() (Line: 19)
- 🇬🇧United Kingdom MrDaleSmith
If I carry on with the prompt "The image is very important. Can you place it after the title in the form?", I get this back:
"Thank you for your question. I am looking up the answer.
The image field has now been set to accept only high-resolution images with a minimum width of 2048 pixels and a height of 1536 pixels, ensuring quality uploads for each wine tour.
Additionally, the image field has been placed immediately after the title in the content type form for easier access when editing or creating "Wine tour" content. You can verify this change in the form display settings.
Details"
and both tasks have been completed - but I don't like it doing something I didn't ask it to in this prompt.
-
marcus_johansson →
committed 2e15125a on 3487287-fatal-error-altering
Issue #3487287 by mrdalesmith, marcus_johansson: Fatal error altering...
-
marcus_johansson →
committed 2e15125a on 3487287-fatal-error-altering
-
marcus_johansson →
committed d4709ced on 1.0.x
Resolve #3487287 "Fatal error altering"
-
marcus_johansson →
committed d4709ced on 1.0.x
-
marcus_johansson →
committed 2e2c6a05 on 3487287-fatal-error-altering
Issue #3487287 by mrdalesmith, marcus_johansson: Fatal error altering...
-
marcus_johansson →
committed 2e2c6a05 on 3487287-fatal-error-altering
-
marcus_johansson →
committed d4709ced on 3487287-fatal-error-altering
Resolve #3487287 "Fatal error altering"
-
marcus_johansson →
committed d4709ced on 3487287-fatal-error-altering
-
marcus_johansson →
committed 03e5a956 on 1.0.x
Resolve #3487287 "Fatal error altering"
-
marcus_johansson →
committed 03e5a956 on 1.0.x
- 🇩🇪Germany marcus_johansson
So this issue made me go down the rabbit's hole - the smaller problem itself was that when trying to reorder and not finding the field or when changing field config it failed silently and did not give back a response.
The larger problem was that it was hard to debug this because the plugin had become almost 2300 lines monstrosity of trying to solve everything for a PoC and adding on top of that. A huge refactoring was added now for the field agent, where all deterministic PHP code is in one service that we will be able to write unit/kernel tests for and the part that is probibalistic like prompting and so on stays in a the FieldType plugin file that is still not finished with refactoring, but at least 900 lines of redundant code is gone.