fazeel007's picture
initial commit
7c012de
#!/usr/bin/env node
const fetch = require('node-fetch');
async function testNebiusSetup() {
console.log('πŸ§ͺ Testing Nebius Integration...\n');
const baseUrl = 'http://localhost:5000';
try {
// Test 1: Health Check
console.log('1. Testing API Health...');
const healthResponse = await fetch(`${baseUrl}/api/health`);
if (healthResponse.ok) {
const health = await healthResponse.json();
console.log('βœ… Health check passed');
console.log('Services status:', health.services?.map(s => `${s.service}: ${s.status}`).join(', '));
} else {
console.log('❌ Health check failed:', healthResponse.status);
}
// Test 2: Documents endpoint
console.log('\n2. Testing Documents API...');
const docsResponse = await fetch(`${baseUrl}/api/documents`);
if (docsResponse.ok) {
const docs = await docsResponse.json();
console.log(`βœ… Documents API working (${docs.length} documents found)`);
} else {
console.log('❌ Documents API failed:', docsResponse.status);
}
// Test 3: Query Enhancement (Nebius)
console.log('\n3. Testing Nebius Query Enhancement...');
const enhanceResponse = await fetch(`${baseUrl}/api/enhance-query`, {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({ query: 'machine learning' })
});
if (enhanceResponse.ok) {
const enhancement = await enhanceResponse.json();
console.log('βœ… Nebius query enhancement working');
console.log('Enhanced query:', enhancement.enhancedQuery);
console.log('Intent:', enhancement.intent);
} else {
console.log('❌ Nebius query enhancement failed:', enhanceResponse.status);
const error = await enhanceResponse.text();
console.log('Error:', error);
}
// Test 4: AI Explanation (Nebius)
console.log('\n4. Testing Nebius AI Explanation...');
const explainResponse = await fetch(`${baseUrl}/api/explain`, {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({
title: 'Test Document',
snippet: 'This is a test document about artificial intelligence and machine learning.'
})
});
if (explainResponse.ok) {
const explanation = await explainResponse.json();
console.log('βœ… Nebius AI explanation working');
console.log('Explanation:', explanation.explanation);
} else {
console.log('❌ Nebius AI explanation failed:', explainResponse.status);
const error = await explainResponse.text();
console.log('Error:', error);
}
} catch (error) {
console.error('❌ Test failed with error:', error.message);
}
console.log('\nπŸŽ‰ Testing complete!');
console.log('\nπŸ’‘ If all tests passed, your KnowledgeBridge app is ready with Nebius AI!');
console.log('πŸ“± Open http://localhost:5000 in your browser to use the app.');
}
testNebiusSetup();