( ′∀`)σ≡σ☆))Д′)レ(゚∀゚;)ヘ=З=З=Зε≡(ノ´_ゝ`)ノ
<?php
include("../includes/limittext.php");
include('../Connections/videoondemand.php');
require("../DbSql2.inc.php");
require("../NewsSql2.inc.php");
$db = new NewsSQL();
include("../protect.php");
include("../includes/configAI.php");
$message = $_POST["message"];
$themeid = $_POST["themeid"];
$userid = $_POST["userid"];
$execute = $_POST["execute"];
$instructions = $_POST["instructions"];
if (!empty ($_POST["message"]) )
{
$json = '{
"openai_type": "turbo",
"message": "'.$message.'",
"chat_model": "text-davinci-003",
"conversation_id": "",
"parent_message_id": ""
}';
$searchQuery = $message ;
$message = urlencode($message);
$arr = json_decode($json, true);
if(!empty($message)){
$text = $message;
if (empty ($themeid) )
{
//INITIALIZATION
//Just provide default selected ID because of inittialization
// Initialize Brand AI
// URL to make the GET request to
$url = "https://www.thebrand.ai/TheBrandZ/mode.php?mode=addDesignGPTV2&userid=$userid&message=$message&selectedID=5607";
// Make the GET request using file_get_contents
$response = file_get_contents($url);
// Output the response
// Output the response
echo "$response";
// Close curl session
exit();
}
else
{
if (empty ($execute) )
{
//startm prpcess
// Construct the SQL query using search terms
$sql = "SELECT * FROM profilepicture WHERE id=$themeid and catalogid=$userid";
$result = mysqli_query($videoondemand, $sql);
$row = mysqli_fetch_assoc($result);
$message = $row['message'];
$sanitizedQuery = $message;
include("../includes/suggestDesign.php");
//STEP 2
//save the prompt
// URL to make the GET request to
$url = "https://www.thebrand.ai/TheBrandZ/mode.php?mode=addDesignGPTV2&themeid=$themeid&userid=$userid&message=$message&selectedID=$selectedID";
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL,"$url");
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS,
"");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);
$httpcode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
curl_close ($ch);
if($httpcode>=200 && $httpcode<300)
{
echo "$response ddddddddddddddd";
exit();
}
}
else
{
header('Content-Type: application/json');
$openai = [];
$openai = openai_api_gpt_4($text,$instructions);die($openai);
}
}
}
}