Problem/Motivation

I updated a bunch of modules in my AI testing repository and suddenly "Analyze SEO" broke. When I click "Analyze", nothing happens and I get the following error in Drupal log:
TypeError: Drupal\openai\OpenAIApi::chat(): Argument #6 ($seed) must be of type ?int, string given, called in /var/www/html/web/modules/contrib/openai_seo/src/OpenAiAnalyzer.php on line 221 in Drupal\openai\OpenAIApi->chat() (line 227 of /var/www/html/web/modules/contrib/openai/src/OpenAIApi.php)

Steps to reproduce

Proposed resolution

Remaining tasks

User interface changes

API changes

Data model changes

Issue fork openai_seo-3448988

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

mErilainen created an issue. See original summary.

merilainen’s picture

Issue summary: View changes

immaculatexavier made their first commit to this issue’s fork.

immaculatexavier’s picture

Status: Active » Needs review

In this updated method, the $seed variable is cast to an integer only if it is not null. This ensures that the chat() method receives the correct type for the $seed parameter, resolving the TypeError you encountered.
Kindly review

j-vee’s picture

Thanks for that, I've pushed out a new version beta3 that fixes this bug and also changes the model in use to gpt-4o for cheaper and faster response generation.

j-vee’s picture

Status: Needs review » Fixed

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.