v1.0 - Version stable: multi-PC, détection UI-DETR-1, 3 modes exécution
- Frontend v4 accessible sur réseau local (192.168.1.40) - Ports ouverts: 3002 (frontend), 5001 (backend), 5004 (dashboard) - Ollama GPU fonctionnel - Self-healing interactif - Dashboard confiance Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
200
visual_workflow_builder/test_capture_simple.html
Normal file
200
visual_workflow_builder/test_capture_simple.html
Normal file
@@ -0,0 +1,200 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="fr">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>Test Capture Simple - VWB</title>
|
||||
<style>
|
||||
body {
|
||||
font-family: Arial, sans-serif;
|
||||
max-width: 600px;
|
||||
margin: 50px auto;
|
||||
padding: 20px;
|
||||
background: #f5f5f5;
|
||||
}
|
||||
.container {
|
||||
background: white;
|
||||
padding: 30px;
|
||||
border-radius: 10px;
|
||||
box-shadow: 0 2px 10px rgba(0,0,0,0.1);
|
||||
}
|
||||
button {
|
||||
background: #1976d2;
|
||||
color: white;
|
||||
border: none;
|
||||
padding: 15px 30px;
|
||||
border-radius: 5px;
|
||||
cursor: pointer;
|
||||
font-size: 16px;
|
||||
margin: 10px 0;
|
||||
width: 100%;
|
||||
}
|
||||
button:hover {
|
||||
background: #1565c0;
|
||||
}
|
||||
button:disabled {
|
||||
background: #ccc;
|
||||
cursor: not-allowed;
|
||||
}
|
||||
.result {
|
||||
margin: 20px 0;
|
||||
padding: 15px;
|
||||
border-radius: 5px;
|
||||
font-family: monospace;
|
||||
white-space: pre-wrap;
|
||||
}
|
||||
.success {
|
||||
background: #e8f5e8;
|
||||
border: 1px solid #4caf50;
|
||||
color: #2e7d32;
|
||||
}
|
||||
.error {
|
||||
background: #ffeaea;
|
||||
border: 1px solid #f44336;
|
||||
color: #c62828;
|
||||
}
|
||||
.info {
|
||||
background: #e3f2fd;
|
||||
border: 1px solid #2196f3;
|
||||
color: #1565c0;
|
||||
}
|
||||
img {
|
||||
max-width: 100%;
|
||||
border: 1px solid #ddd;
|
||||
border-radius: 5px;
|
||||
margin: 10px 0;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div class="container">
|
||||
<h1>🔧 Test Capture Simple - VWB</h1>
|
||||
<p><strong>Backend:</strong> http://localhost:5003/api</p>
|
||||
|
||||
<button id="testBtn" onclick="testCapture()">
|
||||
🔍 Tester la Capture d'Écran
|
||||
</button>
|
||||
|
||||
<div id="result"></div>
|
||||
<div id="image"></div>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
const API_URL = 'http://localhost:5003/api/screen-capture';
|
||||
|
||||
function showResult(type, message) {
|
||||
const resultDiv = document.getElementById('result');
|
||||
resultDiv.className = `result ${type}`;
|
||||
resultDiv.textContent = message;
|
||||
}
|
||||
|
||||
function showImage(base64Data) {
|
||||
const imageDiv = document.getElementById('image');
|
||||
if (base64Data) {
|
||||
imageDiv.innerHTML = `<img src="data:image/png;base64,${base64Data}" alt="Capture d'écran">`;
|
||||
} else {
|
||||
imageDiv.innerHTML = '';
|
||||
}
|
||||
}
|
||||
|
||||
async function testCapture() {
|
||||
const button = document.getElementById('testBtn');
|
||||
button.disabled = true;
|
||||
button.textContent = '🔄 Capture en cours...';
|
||||
|
||||
showResult('info', 'Démarrage de la capture d\'écran...');
|
||||
showImage(null);
|
||||
|
||||
try {
|
||||
console.log('🔧 Début de la requête de capture...');
|
||||
|
||||
const response = await fetch(API_URL, {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
'Accept': 'application/json',
|
||||
},
|
||||
body: JSON.stringify({
|
||||
format: 'png',
|
||||
quality: 90
|
||||
})
|
||||
});
|
||||
|
||||
console.log('📡 Réponse reçue:', response.status, response.statusText);
|
||||
|
||||
if (!response.ok) {
|
||||
const errorText = await response.text();
|
||||
throw new Error(`HTTP ${response.status}: ${errorText}`);
|
||||
}
|
||||
|
||||
const data = await response.json();
|
||||
console.log('📊 Données reçues:', {
|
||||
success: data.success,
|
||||
width: data.width,
|
||||
height: data.height,
|
||||
method: data.method,
|
||||
screenshotLength: data.screenshot ? data.screenshot.length : 0
|
||||
});
|
||||
|
||||
if (data.success) {
|
||||
showResult('success',
|
||||
`✅ Capture réussie !\n` +
|
||||
`Résolution: ${data.width}x${data.height}\n` +
|
||||
`Méthode: ${data.method}\n` +
|
||||
`Taille: ${data.screenshot ? data.screenshot.length : 0} caractères`
|
||||
);
|
||||
|
||||
if (data.screenshot) {
|
||||
showImage(data.screenshot);
|
||||
}
|
||||
} else {
|
||||
throw new Error(data.error || 'Capture échouée');
|
||||
}
|
||||
|
||||
} catch (error) {
|
||||
console.error('❌ Erreur:', error);
|
||||
|
||||
let errorMessage = `❌ Erreur: ${error.message}`;
|
||||
|
||||
if (error.name === 'TypeError' && error.message.includes('fetch')) {
|
||||
errorMessage += '\n\n🔧 Causes possibles:';
|
||||
errorMessage += '\n- Le backend n\'est pas démarré';
|
||||
errorMessage += '\n- Problème de CORS';
|
||||
errorMessage += '\n- Problème de réseau';
|
||||
} else if (error.message.includes('Failed to fetch')) {
|
||||
errorMessage += '\n\n🔧 "Failed to fetch" indique généralement:';
|
||||
errorMessage += '\n- Le serveur backend n\'est pas accessible';
|
||||
errorMessage += '\n- Problème de CORS (Cross-Origin Resource Sharing)';
|
||||
errorMessage += '\n- Le port 5003 n\'est pas ouvert';
|
||||
}
|
||||
|
||||
showResult('error', errorMessage);
|
||||
showImage(null);
|
||||
} finally {
|
||||
button.disabled = false;
|
||||
button.textContent = '🔍 Tester la Capture d\'Écran';
|
||||
}
|
||||
}
|
||||
|
||||
// Test automatique au chargement
|
||||
window.addEventListener('load', () => {
|
||||
console.log('🚀 Page chargée - Prêt pour les tests');
|
||||
|
||||
// Vérifier si le backend est accessible
|
||||
fetch('http://localhost:5003/api/health')
|
||||
.then(response => response.json())
|
||||
.then(data => {
|
||||
console.log('✅ Backend accessible:', data);
|
||||
showResult('info', 'Backend accessible - Cliquez pour tester la capture');
|
||||
})
|
||||
.catch(error => {
|
||||
console.error('❌ Backend inaccessible:', error);
|
||||
showResult('error',
|
||||
`❌ Backend inaccessible: ${error.message}\n\n` +
|
||||
`Vérifiez que le backend est démarré sur le port 5003`
|
||||
);
|
||||
});
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
Reference in New Issue
Block a user