diff --git a/js/ai_reword.js b/js/ai_reword.js index 515869a8..f2ae4902 100644 --- a/js/ai_reword.js +++ b/js/ai_reword.js @@ -1,5 +1,6 @@ document.getElementById('rewordButton').addEventListener('click', function() { var textInput = document.getElementById('textInput'); + var ticketDescription = document.getElementById('ticketDescription'); var rewordButton = document.getElementById('rewordButton'); var undoButton = document.getElementById('undoButton'); var previousText = textInput.value; // Store the current text @@ -13,7 +14,7 @@ document.getElementById('rewordButton').addEventListener('click', function() { headers: { 'Content-Type': 'application/json', }, - body: JSON.stringify({ text: textInput.value }), + body: JSON.stringify({ text: textInput.value, description: ticketDescription.value }), }) .then(response => response.json()) .then(data => { diff --git a/post/ai.php b/post/ai.php index 4ab0f301..fc6446f2 100644 --- a/post/ai.php +++ b/post/ai.php @@ -13,7 +13,7 @@ if (isset($_GET['ai_reword'])) { $input = json_decode($inputJSON, TRUE); // Convert JSON into array. // Prefix the input text with "reword: " - $prefixedText = "reword: " . $input['text']; + $prefixedText = "You are a technician at a help desk, training another technician. This is a response to the following issue " . $input['description'] . " Help me reword this for clarity and proffesionalism: " . $input['text']; // Preparing the data for the OpenAI Chat API request. $data = [ diff --git a/ticket.php b/ticket.php index 15c33ad9..9c57cb40 100644 --- a/ticket.php +++ b/ticket.php @@ -285,7 +285,7 @@ if (isset($_GET['ticket_id'])) {

-
+