learnfullabs / gutenberg-ai-tools

GNU General Public License v2.0
0 stars 0 forks source link

Create a Gutenberg block for creating Generative AI prompt/response #2

Closed ymdahi closed 2 months ago

ymdahi commented 3 months ago

Goal is to create something similar to this:

The new block will:

  1. Present the user with a text area input that allows the user to enter a prompt.
  2. The user can input any text into the textarea and submit the text.
  3. The text is sent to OpenAI GPT4 API endpoint.
  4. The response from OpenAI is added to Gutenberg editor body as gutenberg-compliant code/text.
danrod96 commented 3 months ago

This is in the works, I finally have all the basic structure for the AI Block, I can add it from the editor, next step is to send the question to OpenAI and render the answer in the main content div, I'll rely on the OpenAI Drupal Module which already has a service that I'll try to use it from the Gutenberg Block (Perhaps I'll need to create a custom REST Endpoint for that)

gutenberg-ai-block

danrod96 commented 3 months ago

@ymdahi I refactored the AI Block to move the OpenAI prompt in the block settings.

gutenberg-ai-block2

Pending: Integration with OpenAI (ongoing)

danrod96 commented 2 months ago

Hi @ymdahi this is done, I've managed to create an initial release of this module that actually works (screenshots included), there's some issues that need to be fixed, the onBlur event is not working as I expected, I'll look on that later. Good stuff !! Screenshot from 2024-08-21 22-36-43 Screenshot from 2024-08-21 22-35-13