From e246f9a75d37c8768ce53c4c55248a66f72cc5b7 Mon Sep 17 00:00:00 2001 From: Riza Maulana Ardiyanto Date: Thu, 14 Nov 2024 20:29:04 +0700 Subject: [PATCH] add typesafety --- core/Requirement/Openai_item.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/core/Requirement/Openai_item.php b/core/Requirement/Openai_item.php index f420ad6..eb9c2e6 100644 --- a/core/Requirement/Openai_item.php +++ b/core/Requirement/Openai_item.php @@ -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'])) {