From 500e7137645f4ea23c8584525a3b802432711d32 Mon Sep 17 00:00:00 2001 From: Marcus Hill Date: Sun, 22 Jun 2025 10:01:10 +0100 Subject: [PATCH] clarify error message wording --- post/ai.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/post/ai.php b/post/ai.php index e5ced6c3..74e4aedc 100644 --- a/post/ai.php +++ b/post/ai.php @@ -51,13 +51,13 @@ if (isset($_GET['ai_reword'])) { if (isset($responseData['choices'][0]['message']['content'])) { // Get the response content. $content = $responseData['choices'][0]['message']['content']; - + // Clean any leading "html" word or other unwanted text at the beginning. $content = preg_replace('/^html/i', '', $content); // Remove any occurrence of 'html' at the start // Clean the response content to remove backticks or code block markers. $cleanedContent = str_replace('```', '', $content); // Remove backticks if they exist. - + // Trim any leading/trailing whitespace. $cleanedContent = trim($cleanedContent); @@ -65,7 +65,7 @@ if (isset($_GET['ai_reword'])) { echo json_encode(['rewordedText' => $cleanedContent]); } else { // Handle errors or unexpected response structure. - echo json_encode(['rewordedText' => 'Failed to get a response from the OpenAI API.']); + echo json_encode(['rewordedText' => 'Failed to get a response from the AI API.']); } } @@ -188,4 +188,4 @@ if (isset($_GET['ai_create_document_template'])) { // Print the generated HTML template directly echo $template; -} \ No newline at end of file +}