- 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.
60 lines
2.1 KiB
PHP
60 lines
2.1 KiB
PHP
<?php
|
||
// analyze_case_proxy.php - 100% совместим с PHP 7.0
|
||
|
||
// 1. Получаем параметры (максимально простой способ)
|
||
$caseId = isset($_POST['id']) ? $_POST['id'] : (isset($_GET['id']) ? $_GET['id'] : '');
|
||
$description = isset($_POST['query_text']) ? $_POST['query_text'] : (isset($_GET['query_text']) ? $_GET['query_text'] : '');
|
||
|
||
// 2. Валидация
|
||
if (empty($caseId)) {
|
||
header('Content-Type: application/json');
|
||
die('{"status":"error","message":"Missing ID"}');
|
||
}
|
||
|
||
// 3. Подготовка запроса
|
||
$request = array(
|
||
'id' => $caseId,
|
||
'description' => $description
|
||
);
|
||
|
||
// 4. Отправка в n8n (упрощённый cURL)
|
||
$ch = curl_init('https://n8n.clientright.pro/webhook-test/analyze-case');
|
||
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
|
||
curl_setopt($ch, CURLOPT_POST, 1);
|
||
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($request));
|
||
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: application/json'));
|
||
$response = curl_exec($ch);
|
||
curl_close($ch);
|
||
|
||
// 5. Очистка ответа (удаляем BOM если есть)
|
||
if (substr($response, 0, 3) == pack('CCC', 0xEF, 0xBB, 0xBF)) {
|
||
$response = substr($response, 3);
|
||
}
|
||
|
||
// 6. Парсинг ответа (с защитой от ошибок)
|
||
$result = array(
|
||
'jobId' => '',
|
||
'case_id' => $caseId, // сохраняем исходный ID как fallback
|
||
'Id' => 0,
|
||
'moderationVerdict' => 'passed'
|
||
);
|
||
|
||
if (!empty($response)) {
|
||
$data = json_decode($response, true);
|
||
if (is_array($data)) {
|
||
// Обрабатываем как массив или одиночный объект
|
||
$item = isset($data[0]) ? $data[0] : $data;
|
||
|
||
if (isset($item['jobId'])) $result['jobId'] = $item['jobId'];
|
||
if (isset($item['case_id'])) $result['case_id'] = $item['case_id'];
|
||
if (isset($item['Id'])) $result['Id'] = intval($item['Id']);
|
||
if (isset($item['moderationVerdict'])) {
|
||
$result['moderationVerdict'] = $item['moderationVerdict'];
|
||
}
|
||
}
|
||
}
|
||
|
||
// 7. Отправляем результат
|
||
header('Content-Type: application/json');
|
||
echo json_encode($result);
|
||
?>
|