38 lines
1.4 KiB
PHP
38 lines
1.4 KiB
PHP
<?php
|
|
header('Content-Type: application/json');
|
|
|
|
// Récupère le contenu du bloc ACTUEL dans chatbot-api
|
|
$content = file_get_contents('/var/www/weval/wevia-ia/weval-chatbot-api.php');
|
|
$start = strpos($content, 'OPUS4-AUTOWIRE-CHATBOT-v1 (17avr 02h35)');
|
|
$end = strpos($content, 'OPUS4-AUTOWIRE-CHATBOT-v1 END');
|
|
$block = $start !== false ? substr($content, $start, $end - $start) : 'MARKER NOT FOUND';
|
|
|
|
// Trouve la regex exacte
|
|
preg_match('#preg_match\("([^"]+)"#', $block, $rx_match);
|
|
$actual_regex = $rx_match[1] ?? 'NOT EXTRACTED';
|
|
|
|
// Test la regex sur le message standard
|
|
$msg = "master add intent opus4_decisive :: trigger_a :: echo hello";
|
|
$msg_lower = mb_strtolower(trim($msg));
|
|
|
|
// Test avec la regex extraite
|
|
$match1 = preg_match($actual_regex, $msg_lower, $m);
|
|
|
|
// Test avec regex explicite
|
|
$match2 = preg_match('/^\s*master\s+add\s+intent\s+([a-z0-9_]+)\s*::\s*(.+?)\s*::\s*(.+)$/i', $msg_lower, $m2);
|
|
|
|
// Test write /tmp (www-data OK)
|
|
$w = @file_put_contents('/tmp/opus4-trace.log', date('c')." regex_decisive msg_len=" . strlen($msg) . "\n", FILE_APPEND);
|
|
|
|
echo json_encode([
|
|
'block_found' => $start !== false,
|
|
'block_len' => strlen($block),
|
|
'actual_regex' => substr($actual_regex, 0, 100),
|
|
'match_actual' => $match1,
|
|
'match_ref' => $match2,
|
|
'captures_ref' => $m2,
|
|
'msg_lower' => $msg_lower,
|
|
'tmp_write' => $w,
|
|
'php_version' => phpversion(),
|
|
], JSON_PRETTY_PRINT);
|