Files
crm.clientright.ru/include/utils/filegetgpt.php
Fedor ac7467f0b4 Major CRM updates: AI Assistant, Court Status API, S3 integration improvements, and extensive file storage system
- 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.
2025-10-16 11:17:21 +03:00

69 lines
2.5 KiB
PHP
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<?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;
?>