";
// Check if reasoning looks like GPT output
$recentQuery->data_seek(0);
$hasDetailedReasoning = false;
while ($row = $recentQuery->fetch_assoc()) {
if (strlen($row['llm_reasoning']) > 20 &&
(strpos($row['llm_reasoning'], 'combination') !== false ||
strpos($row['llm_reasoning'], 'possible') !== false ||
strpos($row['llm_reasoning'], 'demographic') !== false)) {
$hasDetailedReasoning = true;
break;
}
}
if ($hasDetailedReasoning) {
echo "
β Reasoning appears to be from GPT (detailed explanations)
";
} else {
echo "
β οΈ Reasoning appears simple - might not be from GPT
";
}
} else {
echo "
β οΈ No recent processed combinations found
";
}
echo "
";
// Test 4: Live GPT Test
echo "
";
echo "
π§ͺ Live GPT API Test
";
echo "";
echo "";
echo "
";
// Test 5: Check Processing Logs
echo "
";
echo "
π Check for API Call Logs
";
// Check if any error logs mention OpenAI
if (file_exists('error_log')) {
$errorLog = file_get_contents('error_log');
$openaiMentions = substr_count(strtolower($errorLog), 'openai');
$apiMentions = substr_count(strtolower($errorLog), 'api');
$gptMentions = substr_count(strtolower($errorLog), 'gpt');
echo "
Error log mentions: OpenAI ($openaiMentions), API ($apiMentions), GPT ($gptMentions)
";
if ($openaiMentions > 0) {
echo "
β οΈ OpenAI mentioned in error log - check for API issues
";
}
}
echo "
";
// Test 6: Manual Processing Test
echo "
";
echo "
π§ Manual Processing Test
";
echo "";
echo "";
echo "
";
// Test 7: Possible Issues
echo "
";
echo "
π¨ Possible Issues
";
$issues = [];
// Check if using cached/pre-existing data
$totalProcessed = $db->query("SELECT COUNT(*) as count FROM panel_directives WHERE llm_checked = 1")->fetch_assoc()['count'];
$recentProcessed = $db->query("SELECT COUNT(*) as count FROM panel_directives WHERE llm_checked = 1 AND updated_at > DATE_SUB(NOW(), INTERVAL 1 HOUR)")->fetch_assoc()['count'];
if ($totalProcessed > 0 && $recentProcessed == 0) {
$issues[] = "β All processed combinations are old - might be using cached data";
}
// Check API key format
if (defined('OPENAI_API_KEY') && !str_starts_with(OPENAI_API_KEY, 'sk-')) {
$issues[] = "β API key doesn't start with 'sk-' - invalid format";
}
// Check if rate limiting is preventing requests
if (class_exists('GptHelper') && method_exists('GptHelper', 'canMakeRequest')) {
if (!GptHelper::canMakeRequest()) {
$issues[] = "βΈοΈ Rate limiting is active - requests may be blocked";
}
}
if (empty($issues)) {
echo "