Fix API port mismatch and improve error handling

This commit is contained in:
Aherobo Ovie Victor
2025-07-11 21:43:33 +01:00
parent bdc171b009
commit 0e49829d23
2 changed files with 11 additions and 2 deletions
+10 -1
View File
@@ -1,6 +1,6 @@
// Memory Module Detection QA Interface JavaScript
const API_BASE_URL = 'http://localhost:5001';
const API_BASE_URL = 'http://localhost:5002';
let uploadedFile = null;
// Initialize the application
@@ -288,8 +288,16 @@ async function testHardcodedImage() {
showLoading('Testing hardcoded image...');
try {
console.log(`Making request to: ${API_BASE_URL}/detect/hardcoded?confidence=0.8`);
const response = await fetch(`${API_BASE_URL}/detect/hardcoded?confidence=0.8`);
console.log('Response status:', response.status);
if (!response.ok) {
throw new Error(`HTTP ${response.status}: ${response.statusText}`);
}
const result = await response.json();
console.log('Response data:', result);
hideLoading();
if (result.success) {
@@ -299,6 +307,7 @@ async function testHardcodedImage() {
}
} catch (error) {
hideLoading();
console.error('Hardcoded test error:', error);
alert(`Error: ${error.message}`);
}
}