Some checks failed
CI/CD Pipeline / Backend - Lint & Test (push) Has been cancelled
CI/CD Pipeline / Frontend - Lint & Test (push) Has been cancelled
CI/CD Pipeline / Security Scan (push) Has been cancelled
CI/CD Pipeline / Build Backend (push) Has been cancelled
CI/CD Pipeline / Build Frontend (push) Has been cancelled
CI/CD Pipeline / Integration Tests (push) Has been cancelled
CI/CD Pipeline / Deploy to Staging (push) Has been cancelled
CI/CD Pipeline / Deploy to Production (push) Has been cancelled
CI/CD Pipeline / Performance Tests (push) Has been cancelled
CI/CD Pipeline / Dependency Updates (push) Has been cancelled
- Updated Anthropic API to latest version (2024-01-01) - Set Claude 3.7 Sonnet Latest as primary model - Removed deprecated Opus 3.5 references - Fixed LLM response validation and JSON parsing - Improved error handling and logging - Updated model configurations and pricing - Enhanced document processing reliability - Fixed TypeScript type issues - Updated environment configuration
102 lines
3.3 KiB
JavaScript
102 lines
3.3 KiB
JavaScript
#!/usr/bin/env node
|
||
|
||
// Test script to verify agents are working in the live testing environment
|
||
const https = require('https');
|
||
|
||
const API_BASE = 'https://us-central1-cim-summarizer-testing.cloudfunctions.net/api';
|
||
|
||
function makeRequest(path, options = {}) {
|
||
return new Promise((resolve, reject) => {
|
||
const url = new URL(API_BASE + path);
|
||
const requestOptions = {
|
||
hostname: url.hostname,
|
||
path: url.pathname + url.search,
|
||
method: options.method || 'GET',
|
||
headers: {
|
||
'Content-Type': 'application/json',
|
||
...options.headers
|
||
}
|
||
};
|
||
|
||
const req = https.request(requestOptions, (res) => {
|
||
let data = '';
|
||
res.on('data', chunk => data += chunk);
|
||
res.on('end', () => {
|
||
try {
|
||
const jsonData = JSON.parse(data);
|
||
resolve({ status: res.statusCode, data: jsonData });
|
||
} catch (e) {
|
||
resolve({ status: res.statusCode, data: data });
|
||
}
|
||
});
|
||
});
|
||
|
||
req.on('error', reject);
|
||
|
||
if (options.body) {
|
||
req.write(JSON.stringify(options.body));
|
||
}
|
||
|
||
req.end();
|
||
});
|
||
}
|
||
|
||
async function testAgents() {
|
||
console.log('🧪 Testing Agentic RAG System in Live Environment...');
|
||
console.log('======================================================');
|
||
|
||
try {
|
||
// 1. Check health status
|
||
console.log('\n1️⃣ Checking API Health...');
|
||
const health = await makeRequest('/health');
|
||
console.log(`Status: ${health.status}`);
|
||
console.log(`Response:`, health.data);
|
||
|
||
if (health.status !== 200) {
|
||
console.log('❌ API not healthy, aborting tests');
|
||
return;
|
||
}
|
||
|
||
// 2. Check recent documents to see if any have been processed
|
||
console.log('\n2️⃣ Checking Recent Documents...');
|
||
try {
|
||
const docs = await makeRequest('/documents');
|
||
console.log(`Documents Status: ${docs.status}`);
|
||
console.log(`Documents Response:`, docs.data);
|
||
} catch (e) {
|
||
console.log('📋 Documents endpoint requires auth (expected)');
|
||
}
|
||
|
||
// 3. Check if we can hit the processing endpoint
|
||
console.log('\n3️⃣ Testing Processing Endpoint Access...');
|
||
try {
|
||
const process = await makeRequest('/documents/test/process', { method: 'POST' });
|
||
console.log(`Process Status: ${process.status}`);
|
||
console.log(`Process Response:`, process.data);
|
||
} catch (e) {
|
||
console.log('🔧 Processing endpoint requires auth (expected)');
|
||
}
|
||
|
||
// 4. Check logs for recent LLM activity (if accessible)
|
||
console.log('\n4️⃣ Checking System Configuration...');
|
||
|
||
// Check if the service is using the right configuration
|
||
const timestamp = new Date().toISOString();
|
||
console.log(`✅ Test completed at: ${timestamp}`);
|
||
console.log('\n📊 Results Summary:');
|
||
console.log(`- API Health: ${health.status === 200 ? '✅ HEALTHY' : '❌ UNHEALTHY'}`);
|
||
console.log(`- Environment: ${health.data?.environment || 'unknown'}`);
|
||
console.log(`- Version: ${health.data?.version || 'unknown'}`);
|
||
|
||
console.log('\n🔬 To test agents properly, we need to:');
|
||
console.log('1. Upload a test document through the frontend');
|
||
console.log('2. Monitor the Firebase Functions logs');
|
||
console.log('3. Check the Supabase database for processed results');
|
||
|
||
} catch (error) {
|
||
console.error('❌ Test failed:', error.message);
|
||
}
|
||
}
|
||
|
||
// Run the test
|
||
testAgents(); |