From 6474e2e191a2b4977654c6d6e1c45b39dcde6d8c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafa=C5=82=20Ca=C5=82ka?= Date: Wed, 8 Nov 2023 21:01:26 +0100 Subject: [PATCH] fix: set request timeout --- includes/AltGenerator.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/includes/AltGenerator.php b/includes/AltGenerator.php index e4d8681..51b51ed 100644 --- a/includes/AltGenerator.php +++ b/includes/AltGenerator.php @@ -43,11 +43,13 @@ public static function generate_alt_text( int $attachment_id ): string|WP_Error $api_response = wp_remote_post( self::API_URL, [ - 'headers' => [ + 'headers' => [ 'Content-Type' => 'application/json', 'Authorization' => 'Bearer ' . $api_key, ], - 'body' => json_encode( [ + 'timeout' => 90, + 'httpversion' => '1.1', + 'body' => json_encode( [ 'model' => self::MODEL, 'messages' => [ [