add ticket description to AI Query

This commit is contained in:
o-psi 2024-02-21 11:16:40 -06:00
parent 03bd7f837c
commit b31f1b4c49
3 changed files with 4 additions and 3 deletions

View File

@ -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 => {

View File

@ -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 = [

View File

@ -285,7 +285,7 @@ if (isset($_GET['ticket_id'])) {
<h3 class="card-title text-bold"><?php echo $ticket_subject; ?></h3>
</div>
<div class="card-body prettyContent">
<div class="card-body prettyContent" id="ticketDetails">
<?php echo $ticket_details; ?>
<?php