Add a condition when the user doesn't type any question to the AI provider

Created on 13 April 2025, 26 days ago

Problem/Motivation

When the user opens the Gutenberg Editor and opens the "AI Block" plugin and clicks on "Ask AI" without asking a question, you'll get a message like this:

Steps to reproduce

Follow the steps above

Proposed resolution

This message is coming from the AI REST Endpoint (GutenbergAIEndpoint.php):

// Check if we have enough data to work with.
    if (empty($data['ai_prompt'])) {
      // If an exception was thrown at this stage, there was a problem
      // decoding the data. Throw a 400 http exception.
      throw new BadRequestHttpException($this->t('Bad data format. Please make sure you have all data set in the request.'));
    }

It would be great if we set a condition in the edit.js React component to catch this before sending the question to the API

Remaining tasks

User interface changes

API changes

Data model changes

🐛 Bug report
Status

Active

Version

1.0

Component

User interface

Created by

🇨🇦Canada danrod Ottawa

Live updates comments and jobs are added and updated live.
  • Novice

    It would make a good project for someone who is new to the Drupal contribution process. It's preferred over Newbie.

Sign in to follow issues

Merge Requests

Comments & Activities

Production build 0.71.5 2024