Skip to content

Commit

Permalink
add typesafety
Browse files Browse the repository at this point in the history
  • Loading branch information
rizaardiyanto1412 committed Nov 14, 2024
1 parent 2c1e3ff commit e246f9a
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion core/Requirement/Openai_item.php
Original file line number Diff line number Diff line change
Expand Up @@ -362,8 +362,11 @@ public function handle_ajax_request() {

// Extract Yes/No response
$yes_no_response = '';

if (preg_match('/^(Yes|No):/i', $api_content, $matches)) {
$yes_no_response = strtolower(trim($matches[1]));
if (isset($matches[1])) {
$yes_no_response = strtolower(trim($matches[1]));
}
}

if (in_array($yes_no_response, ['yes', 'no'])) {
Expand Down

0 comments on commit e246f9a

Please sign in to comment.