- 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.
74 lines
2.0 KiB
PHP
74 lines
2.0 KiB
PHP
<?php
|
|
// get_ai_result.php
|
|
// Polling endpoint для проверки статуса AI задачи
|
|
|
|
header('Content-Type: application/json');
|
|
header('Access-Control-Allow-Origin: *');
|
|
header('Access-Control-Allow-Methods: GET, OPTIONS');
|
|
header('Access-Control-Allow-Headers: Content-Type');
|
|
|
|
if ($_SERVER['REQUEST_METHOD'] === 'OPTIONS') {
|
|
http_response_code(200);
|
|
exit();
|
|
}
|
|
|
|
error_reporting(E_ALL);
|
|
ini_set('display_errors', 1);
|
|
|
|
try {
|
|
$taskId = $_GET['task_id'] ?? null;
|
|
|
|
if (!$taskId) {
|
|
throw new Exception('Missing task_id parameter');
|
|
}
|
|
|
|
// Подключаемся к БД
|
|
include_once('config.inc.php');
|
|
|
|
$conn = new mysqli($dbconfig['db_server'], $dbconfig['db_username'], $dbconfig['db_password'], $dbconfig['db_name']);
|
|
|
|
if ($conn->connect_error) {
|
|
throw new Exception("DB connection failed: " . $conn->connect_error);
|
|
}
|
|
|
|
$conn->set_charset('utf8mb4');
|
|
|
|
// Получаем статус задачи
|
|
$stmt = $conn->prepare("SELECT status, response_data, error_message FROM ai_responses WHERE task_id = ?");
|
|
$stmt->bind_param('s', $taskId);
|
|
$stmt->execute();
|
|
$result = $stmt->get_result();
|
|
|
|
if ($row = $result->fetch_assoc()) {
|
|
$response = [
|
|
'success' => true,
|
|
'status' => $row['status'],
|
|
'taskId' => $taskId
|
|
];
|
|
|
|
if ($row['status'] === 'completed') {
|
|
$response['response'] = $row['response_data'];
|
|
} elseif ($row['status'] === 'error') {
|
|
$response['error'] = $row['error_message'];
|
|
} else {
|
|
$response['message'] = 'Обработка...';
|
|
}
|
|
|
|
echo json_encode($response, JSON_UNESCAPED_UNICODE);
|
|
} else {
|
|
throw new Exception('Task not found');
|
|
}
|
|
|
|
$stmt->close();
|
|
$conn->close();
|
|
|
|
} catch (Exception $e) {
|
|
error_log("Get AI Result Error: " . $e->getMessage());
|
|
|
|
http_response_code(500);
|
|
echo json_encode([
|
|
'success' => false,
|
|
'error' => $e->getMessage()
|
|
]);
|
|
}
|
|
?>
|