- Added comprehensive AI Assistant system (aiassist/ directory): * Vector search and embedding capabilities * Typebot proxy integration * Elastic search functionality * Message classification and chat history * MCP proxy for external integrations - Implemented Court Status API (GetCourtStatus.php): * Real-time court document status checking * Integration with external court systems * Comprehensive error handling and logging - Enhanced S3 integration: * Improved file backup system with metadata * Batch processing capabilities * Enhanced error logging and recovery * Copy operations with URL fixing - Added Telegram contact creation API - Improved error logging across all modules - Enhanced callback system for AI responses - Extensive backup file storage with timestamps - Updated documentation and README files - File storage improvements: * Thousands of backup files with proper metadata * Fix operations for broken file references * Project-specific backup and recovery systems * Comprehensive file integrity checking Total: 26,461+ files added/modified including AWS SDK, vendor dependencies, and extensive backup system.
69 lines
2.5 KiB
PHP
69 lines
2.5 KiB
PHP
<?php
|
||
header('Content-Type: application/json');
|
||
|
||
// Функция логирования
|
||
function logToFile($message) {
|
||
$logFile = __DIR__ . '/logs/getfilegpt.log';
|
||
$timestamp = date("Y-m-d H:i:s");
|
||
$logMessage = "[{$timestamp}] " . $message . "\n";
|
||
file_put_contents($logFile, $logMessage, FILE_APPEND);
|
||
}
|
||
|
||
// Проверяем, что запрос пришёл методом POST
|
||
if ($_SERVER['REQUEST_METHOD'] !== 'POST') {
|
||
logToFile("Ошибка: Ожидается POST-запрос.");
|
||
echo json_encode(["status" => "error", "message" => "Ожидается POST-запрос с данными."]);
|
||
exit;
|
||
}
|
||
|
||
// Логируем все данные из $_POST
|
||
logToFile("Входящие данные: " . print_r($_POST, true));
|
||
|
||
// Проверяем, что переменная `files` передана
|
||
if (!isset($_POST['files'])) {
|
||
logToFile("Ошибка: В POST-запросе отсутствует параметр 'files'.");
|
||
echo json_encode(["status" => "error", "message" => "Отсутствует параметр 'files'."]);
|
||
exit;
|
||
}
|
||
|
||
// Преобразуем строку в массив (если нужно)
|
||
$files = $_POST['files'];
|
||
if (!is_array($files)) {
|
||
parse_str($_POST['files'], $files);
|
||
}
|
||
|
||
// Проверяем, что данные — это массив
|
||
if (!is_array($files)) {
|
||
logToFile("Ошибка: 'files' не является массивом.");
|
||
echo json_encode(["status" => "error", "message" => "Неверный формат данных."]);
|
||
exit;
|
||
}
|
||
|
||
// Формируем массив с обработанными файлами
|
||
$response = [
|
||
"status" => "success",
|
||
"processed_files" => []
|
||
];
|
||
|
||
foreach ($files as $file) {
|
||
if (isset($file["title"], $file["filepath"])) {
|
||
$processedFile = [
|
||
"title" => $file["title"],
|
||
"filepath" => $file["filepath"],
|
||
"download_link" => "<a href='" . htmlspecialchars($file["filepath"], ENT_QUOTES) . "' target='_blank'>Скачать</a>"
|
||
];
|
||
$response["processed_files"][] = $processedFile;
|
||
|
||
// Логируем обработанный файл
|
||
logToFile("Обработан файл: " . json_encode($processedFile, JSON_UNESCAPED_UNICODE));
|
||
}
|
||
}
|
||
|
||
// Логируем итоговый JSON-ответ
|
||
logToFile("Ответ вебхуку: " . json_encode($response, JSON_UNESCAPED_UNICODE));
|
||
|
||
// Возвращаем JSON-ответ
|
||
echo json_encode($response, JSON_UNESCAPED_UNICODE | JSON_PRETTY_PRINT);
|
||
exit;
|
||
?>
|