mirror of
https://github.com/itflow-org/itflow
synced 2026-02-28 02:44:53 +00:00
add ticket description to AI Query
This commit is contained in:
@@ -1,5 +1,6 @@
|
|||||||
document.getElementById('rewordButton').addEventListener('click', function() {
|
document.getElementById('rewordButton').addEventListener('click', function() {
|
||||||
var textInput = document.getElementById('textInput');
|
var textInput = document.getElementById('textInput');
|
||||||
|
var ticketDescription = document.getElementById('ticketDescription');
|
||||||
var rewordButton = document.getElementById('rewordButton');
|
var rewordButton = document.getElementById('rewordButton');
|
||||||
var undoButton = document.getElementById('undoButton');
|
var undoButton = document.getElementById('undoButton');
|
||||||
var previousText = textInput.value; // Store the current text
|
var previousText = textInput.value; // Store the current text
|
||||||
@@ -13,7 +14,7 @@ document.getElementById('rewordButton').addEventListener('click', function() {
|
|||||||
headers: {
|
headers: {
|
||||||
'Content-Type': 'application/json',
|
'Content-Type': 'application/json',
|
||||||
},
|
},
|
||||||
body: JSON.stringify({ text: textInput.value }),
|
body: JSON.stringify({ text: textInput.value, description: ticketDescription.value }),
|
||||||
})
|
})
|
||||||
.then(response => response.json())
|
.then(response => response.json())
|
||||||
.then(data => {
|
.then(data => {
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ if (isset($_GET['ai_reword'])) {
|
|||||||
$input = json_decode($inputJSON, TRUE); // Convert JSON into array.
|
$input = json_decode($inputJSON, TRUE); // Convert JSON into array.
|
||||||
|
|
||||||
// Prefix the input text with "reword: "
|
// 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.
|
// Preparing the data for the OpenAI Chat API request.
|
||||||
$data = [
|
$data = [
|
||||||
|
|||||||
@@ -285,7 +285,7 @@ if (isset($_GET['ticket_id'])) {
|
|||||||
<h3 class="card-title text-bold"><?php echo $ticket_subject; ?></h3>
|
<h3 class="card-title text-bold"><?php echo $ticket_subject; ?></h3>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="card-body prettyContent">
|
<div class="card-body prettyContent" id="ticketDetails">
|
||||||
<?php echo $ticket_details; ?>
|
<?php echo $ticket_details; ?>
|
||||||
|
|
||||||
<?php
|
<?php
|
||||||
|
|||||||
Reference in New Issue
Block a user