From 48ba4445bf00f0a0076c316a1a63cbcbd99d83f8 Mon Sep 17 00:00:00 2001 From: johnnyq Date: Sat, 10 Feb 2024 21:25:18 -0500 Subject: [PATCH] Added LocalAI --- post/ai.php | 5 ++++- settings_ai.php | 1 + 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/post/ai.php b/post/ai.php index 965556d1..4ab0f301 100644 --- a/post/ai.php +++ b/post/ai.php @@ -12,11 +12,14 @@ if (isset($_GET['ai_reword'])) { $inputJSON = file_get_contents('php://input'); $input = json_decode($inputJSON, TRUE); // Convert JSON into array. + // Prefix the input text with "reword: " + $prefixedText = "reword: " . $input['text']; + // Preparing the data for the OpenAI Chat API request. $data = [ "model" => "$config_ai_model", // Specify the model "messages" => [ - ["role" => "user", "content" => $input['text']] + ["role" => "user", "content" => $prefixedText] ], "temperature" => 0.7 ]; diff --git a/settings_ai.php b/settings_ai.php index dc8ee6c9..76292c7a 100644 --- a/settings_ai.php +++ b/settings_ai.php @@ -21,6 +21,7 @@ require_once "inc_all_settings.php"; +