appwizard / index.html
sharon55's picture
app wizard is not openning any apps by the prompt
0478827 verified
Raw History Blame Contribute Delete
8.27 kB
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>AppWizard - Mobile Agentic App Launcher</title>
<link href="https://cdn.jsdelivr.net/npm/tailwindcss@2.2.19/dist/tailwind.min.css" rel="stylesheet">
<script src="https://cdn.jsdelivr.net/npm/axios/dist/axios.min.js"></script>
<link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0-beta3/css/all.min.css" rel="stylesheet">
</head>
<body class="bg-gray-100 min-h-screen">
<div class="container mx-auto px-4 py-8">
<div class="max-w-md mx-auto bg-white rounded-xl shadow-md overflow-hidden md:max-w-2xl">
<div class="md:flex">
<div class="p-8 w-full">
<div class="flex items-center justify-center mb-6">
<i class="fas fa-hat-wizard text-4xl text-purple-600 mr-3"></i>
<h1 class="text-3xl font-bold text-gray-800">AppWizard</h1>
</div>
<p class="mt-2 text-gray-600">Your magical app launcher that responds to voice and text commands!</p>
<div class="mt-8">
<div class="flex items-center mb-4">
<i class="fas fa-microphone text-purple-500 mr-2"></i>
<h2 class="text-xl font-semibold">Voice Command</h2>
</div>
<button class="w-full bg-purple-600 hover:bg-purple-700 text-white font-bold py-3 px-4 rounded-lg flex items-center justify-center">
<i class="fas fa-microphone mr-2"></i> Tap to Speak
</button>
</div>
<div class="mt-6">
<div class="flex items-center mb-4">
<i class="fas fa-keyboard text-purple-500 mr-2"></i>
<h2 class="text-xl font-semibold">Text Command</h2>
</div>
<div class="relative">
<input type="text" placeholder="Type your command..." class="w-full border border-gray-300 rounded-lg py-3 px-4 pr-12 focus:outline-none focus:ring-2 focus:ring-purple-500 focus:border-transparent" onkeypress="if(event.key === 'Enter') document.querySelector('.fa-paper-plane').click()">
<button class="absolute right-3 top-3 text-purple-600 hover:text-purple-800">
<i class="fas fa-paper-plane"></i>
</button>
</div>
</div>
<div class="mt-8">
<h3 class="text-lg font-medium mb-3">Quick Categories</h3>
<div class="grid grid-cols-3 gap-3">
<button class="bg-blue-100 text-blue-800 py-2 px-3 rounded-lg flex items-center justify-center">
<i class="fas fa-taxi mr-2"></i> Cabs
</button>
<button class="bg-green-100 text-green-800 py-2 px-3 rounded-lg flex items-center justify-center">
<i class="fas fa-utensils mr-2"></i> Food
</button>
<button class="bg-yellow-100 text-yellow-800 py-2 px-3 rounded-lg flex items-center justify-center">
<i class="fas fa-music mr-2"></i> Music
</button>
</div>
</div>
<div class="mt-8 pt-4 border-t border-gray-200">
<p class="text-sm text-gray-500">
<i class="fas fa-info-circle mr-1"></i> AppWizard only opens apps when you ask and cannot access their data.
</p>
</div>
</div>
</div>
</div>
</div>
<script>
// Check for speech recognition support
if (!('webkitSpeechRecognition' in window) && !('SpeechRecognition' in window)) {
document.querySelector('.fa-microphone').parentElement.style.display = 'none';
alert('Voice commands not supported in your browser. Try Chrome or Edge.');
}
document.querySelector('.fa-microphone').parentElement.addEventListener('click', async () => {
try {
const SpeechRecognition = window.SpeechRecognition || window.webkitSpeechRecognition;
if (!SpeechRecognition) {
alert('Speech recognition not supported in your browser');
return;
}
const recognition = new SpeechRecognition();
recognition.lang = 'en-US';
recognition.interimResults = false;
recognition.maxAlternatives = 1;
recognition.start();
recognition.onresult = async (event) => {
const command = event.results[0][0].transcript;
const response = await fetch('/api/process-command', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
},
body: JSON.stringify({ command, type: 'voice' })
});
const data = await response.json();
if (data.success) {
// Process the command and launch appropriate app
window.location.href = data.redirectUrl || '#';
} else {
alert('Voice command failed: ' + data.message);
}
} catch (error) {
console.error('Error:', error);
alert('Failed to process voice command');
}
});
// Text command functionality
document.querySelector('.fa-paper-plane').addEventListener('click', async () => {
const input = document.querySelector('input[type="text"]');
const command = input.value.trim();
if (!command) return;
try {
const response = await fetch('/api/process-command', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
},
body: JSON.stringify({ command, type: 'text' })
});
const data = await response.json();
if (data.success) {
// Process the command and launch appropriate app
window.location.href = data.redirectUrl || '#';
input.value = '';
} else {
alert('Command failed: ' + data.message);
}
} catch (error) {
console.error('Error:', error);
alert('Failed to process command');
}
});
// Quick category buttons
document.querySelectorAll('.grid button').forEach(button => {
button.addEventListener('click', async () => {
const category = button.textContent.trim().split('\n')[0];
try {
const response = await fetch('/api/process-command', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
},
body: JSON.stringify({ command: category, type: 'quick' })
});
const data = await response.json();
if (data.success) {
window.location.href = data.redirectUrl || '#';
} else {
alert('Failed to launch: ' + data.message);
}
} catch (error) {
console.error('Error:', error);
alert('Failed to process quick command');
}
});
});
</script>
</body>
</html>