초기 커밋: 5130 레거시 시스템
- URL 하드코딩 → .env APP_URL 기반 동적 URL로 변경 - DB 연결 하드코딩 → .env 기반으로 변경 - MySQL strict mode DATE 오류 수정
This commit is contained in:
39
chatbot/rag/debug_search.php
Normal file
39
chatbot/rag/debug_search.php
Normal file
@@ -0,0 +1,39 @@
|
||||
<?php
|
||||
// chatbot/rag/debug_search.php
|
||||
require_once __DIR__ . '/search.php';
|
||||
require_once dirname(__DIR__) . '/../apikey/google_vertex_api.txt'; // Path verify
|
||||
|
||||
$apiKeyPath = dirname(__DIR__, 2) . '/apikey/google_vertex_api.txt';
|
||||
$apiKey = trim(file_get_contents($apiKeyPath));
|
||||
|
||||
echo "=== RAG Debug Tool ===\n";
|
||||
echo "API Key Path: $apiKeyPath\n";
|
||||
echo "API Key Length: " . strlen($apiKey) . "\n";
|
||||
|
||||
$search = new VectorSearch();
|
||||
|
||||
// Reflect into the object to check vector count
|
||||
$reflection = new ReflectionClass($search);
|
||||
$property = $reflection->getProperty('vectors');
|
||||
$property->setAccessible(true);
|
||||
$vectors = $property->getValue($search);
|
||||
|
||||
echo "Loaded Vectors Count: " . count($vectors) . "\n";
|
||||
|
||||
if (empty($vectors)) {
|
||||
echo "CRITICAL ERROR: No vectors loaded. Check vectors.json format or path.\n";
|
||||
exit;
|
||||
}
|
||||
|
||||
$query = "개발 dump";
|
||||
echo "Testing Query: '$query'\n";
|
||||
|
||||
// Run Search
|
||||
try {
|
||||
$results = $search->search($query, $apiKey, 3);
|
||||
echo "Search Result Count: " . count($results) . "\n";
|
||||
print_r($results);
|
||||
} catch (Exception $e) {
|
||||
echo "Search Error: " . $e->getMessage() . "\n";
|
||||
}
|
||||
?>
|
||||
Reference in New Issue
Block a user