📄 Source: delete_chat.php
<?php
session_name('INBOXZERO');
session_start();
header('Content-Type: application/json');
$input = json_decode(file_get_contents('php://input'), true);
$chatId = $input['chat_id'] ?? '';
if ($chatId && isset($_SESSION['chat_histories'][$chatId])) {
unset($_SESSION['chat_histories'][$chatId]);
if ($_SESSION['current_conversation_id'] == $chatId) {
$newId = uniqid('chat_');
$_SESSION['current_conversation_id'] = $newId;
$_SESSION['chat_histories'][$newId] = [];
}
echo json_encode(['success' => true]);
} else {
echo json_encode(['error' => 'Chat not found']);
}
?>
← Back