Misspelled property triggers errors in ECA module

Created on 28 May 2024, 7 months ago
Updated 7 August 2024, 5 months ago

Problem/Motivation

I've been testing some ECA models using the openai_eca sub-module and, every time I use the OpenAI/ChatGPT Chat template for my model, I see lots of PHP errors like the following in the logs:

Error: Call to a member function getTokenData() on null in Drupal\openai_eca\Plugin\Action\Chat->execute() (line 102 of /var/www/html/web/modules/contrib/openai/modules/openai_eca/src/Plugin/Action/Chat.php)

These errors are accompanied by the following PHP warning:
Warning: Undefined property: Drupal\openai_eca\Plugin\Action\Chat::$tokenServices in Drupal\openai_eca\Plugin\Action\Chat->execute() (line 102 of /var/www/html/web/modules/contrib/openai/modules/openai_eca/src/Plugin/Action/Chat.php)

I've found that the $tokenServices property used in openai_eca module's Action Plugins doesn't exist, whereas $tokenService can be found in the base class \Drupal\eca\Plugin\Action\ActionBase all these plugins extend from.

Steps to reproduce

Enable the openai_eca sub-module and add an ECA flow with any chatGPT action from the list:

  • OpenAI/ChatGPT Chat
  • OpenAI/ChatGPT Completion
  • OpenAI/ChatGPT Embedding
  • OpenAI/ChatGPT Moderation
  • OpenAI/ChatGPT Speech to Text
  • OpenAI/ChatGPT Text to Speech

When the ECA model runs and the chatGPT action is triggered, the errors mentioned above occur.

Proposed resolution

Replacing tokenServices with tokenService seems to resolve the issue.

πŸ› Bug report
Status

RTBC

Version

1.0

Component

Code

Created by

πŸ‡¬πŸ‡§United Kingdom ioanmar

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

Merge Requests

Comments & Activities

Production build 0.71.5 2024