Konversationen eingefügt

This commit is contained in:
2024-11-19 10:25:02 +01:00
parent a41ebc2e98
commit 2a31ef1c19
5 changed files with 53 additions and 81 deletions

View File

@@ -5,11 +5,10 @@ require_once 'config.php';
// Check if a POST request is sent
if ($_SERVER['REQUEST_METHOD'] === 'POST') {
$input = json_decode(file_get_contents('php://input'), true);
$user_message = $input['message'];
$conversation = $input['conversation'];
// Prepare the command to execute the Python script
// Note: Make sure `python` or `python3` is properly configured in your system's PATH.
$command = escapeshellcmd("python3 assistant.py '$user_message'");
$command = escapeshellcmd("python3 assistant.py '" . json_encode($conversation) . "'");
$output = shell_exec($command);
// Decode the response from Python script