From b31f1b4c49755b693d091b9efd5f87f2a09c25c8 Mon Sep 17 00:00:00 2001 From: o-psi Date: Wed, 21 Feb 2024 11:16:40 -0600 Subject: [PATCH] add ticket description to AI Query --- js/ai_reword.js | 3 ++- post/ai.php | 2 +- ticket.php | 2 +- 3 files changed, 4 insertions(+), 3 deletions(-) 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'])) {

-
+