From 01ba1c2d489c26421865b97748f7829153e52fbb Mon Sep 17 00:00:00 2001 From: Bartholomew Date: Thu, 18 Apr 2024 09:58:51 +0100 Subject: [PATCH] Fixed an issue where different cache keys could be generated with the same input resulting in different responses. * Fixed an issue where different cache key is generated for the same message content * Feedback fixed --- class-gwiz-gf-openai.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/class-gwiz-gf-openai.php b/class-gwiz-gf-openai.php index 9b1e04e..cf1b4b8 100644 --- a/class-gwiz-gf-openai.php +++ b/class-gwiz-gf-openai.php @@ -1358,7 +1358,7 @@ public function make_request( $endpoint, $body, $feed ) { $cache_key = sha1( serialize( array( 'url' => $url, - 'body' => $body, + 'body' => map_deep( $body, 'sanitize_text_field' ), // Sanitize the `$body` variable to ensure consistent `$cache_key` 'request_params' => $this->get_request_params( $feed ), ) ) );