Content Generator & openAI db logs

Created on 11 September 2023, over 1 year ago
Updated 3 November 2023, about 1 year ago

Problem/Motivation

Getting below errors on admin/reports/dblog/event/{id} page

 TypeError: nl2br(): Argument #1 ($string) must be of type string, null given in nl2br() (line 107 of modules/contrib/openai/modules/openai_dblog/src/Controller/OpenAIDbLogController.php).
 

Warning: Undefined variable $explanation in Drupal\openai_dblog\Controller\OpenAIDbLogController->eventDetails() (line 107 of modules/contrib/openai/modules/openai_dblog/src/Controller/OpenAIDbLogController.php).

Steps to reproduce

  1. Enable Open AI and Open AI logs module
  2. Configure API key and Organization
  3. Add content using Open AI content generator

Proposed resolution

Proper check should be added for $explanation

$rows[] = [
        [
          'data' => $header,
          'header' => TRUE,
        ],
        [
          'data' => [
            '#markup' => nl2br($explanation) ?? 'No possible explanations were found, or the API service is not responding.',
          ],
        ],
      ];

in OpenAIDbLogControllercontroller

🐛 Bug report
Status

Fixed

Version

1.0

Component

Code

Created by

🇮🇳India sonvir249 Pune

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

Comments & Activities

Production build 0.71.5 2024