do it in a working conditional with backend
Browse files- api.html +86 -0
- index.html +85 -7
api.html
ADDED
|
@@ -0,0 +1,86 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<!DOCTYPE html>
|
| 2 |
+
<html lang="en">
|
| 3 |
+
<head>
|
| 4 |
+
<meta charset="UTF-8">
|
| 5 |
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
| 6 |
+
<title>AppWizard API Documentation</title>
|
| 7 |
+
<link href="https://cdn.jsdelivr.net/npm/tailwindcss@2.2.19/dist/tailwind.min.css" rel="stylesheet">
|
| 8 |
+
<link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0-beta3/css/all.min.css" rel="stylesheet">
|
| 9 |
+
</head>
|
| 10 |
+
<body class="bg-gray-100 min-h-screen">
|
| 11 |
+
<div class="container mx-auto px-4 py-8">
|
| 12 |
+
<div class="max-w-4xl mx-auto bg-white rounded-xl shadow-md overflow-hidden">
|
| 13 |
+
<div class="p-8">
|
| 14 |
+
<div class="flex items-center justify-center mb-6">
|
| 15 |
+
<i class="fas fa-code text-4xl text-purple-600 mr-3"></i>
|
| 16 |
+
<h1 class="text-3xl font-bold text-gray-800">AppWizard API Documentation</h1>
|
| 17 |
+
</div>
|
| 18 |
+
|
| 19 |
+
<div class="mt-8 space-y-8">
|
| 20 |
+
<div class="bg-gray-50 p-6 rounded-lg">
|
| 21 |
+
<h2 class="text-xl font-semibold mb-4 text-purple-700">Voice Command API</h2>
|
| 22 |
+
<div class="bg-gray-800 text-gray-100 p-4 rounded-md mb-4 overflow-x-auto">
|
| 23 |
+
<code class="text-sm">
|
| 24 |
+
POST /api/voice-command<br>
|
| 25 |
+
Content-Type: application/json<br><br>
|
| 26 |
+
Response:<br>
|
| 27 |
+
{<br>
|
| 28 |
+
"success": boolean,<br>
|
| 29 |
+
"message": string,<br>
|
| 30 |
+
"redirectUrl": string<br>
|
| 31 |
+
}
|
| 32 |
+
</code>
|
| 33 |
+
</div>
|
| 34 |
+
</div>
|
| 35 |
+
|
| 36 |
+
<div class="bg-gray-50 p-6 rounded-lg">
|
| 37 |
+
<h2 class="text-xl font-semibold mb-4 text-purple-700">Text Command API</h2>
|
| 38 |
+
<div class="bg-gray-800 text-gray-100 p-4 rounded-md mb-4 overflow-x-auto">
|
| 39 |
+
<code class="text-sm">
|
| 40 |
+
POST /api/text-command<br>
|
| 41 |
+
Content-Type: application/json<br><br>
|
| 42 |
+
Request Body:<br>
|
| 43 |
+
{<br>
|
| 44 |
+
"command": string<br>
|
| 45 |
+
}<br><br>
|
| 46 |
+
Response:<br>
|
| 47 |
+
{<br>
|
| 48 |
+
"success": boolean,<br>
|
| 49 |
+
"message": string,<br>
|
| 50 |
+
"redirectUrl": string<br>
|
| 51 |
+
}
|
| 52 |
+
</code>
|
| 53 |
+
</div>
|
| 54 |
+
</div>
|
| 55 |
+
|
| 56 |
+
<div class="bg-gray-50 p-6 rounded-lg">
|
| 57 |
+
<h2 class="text-xl font-semibold mb-4 text-purple-700">Quick Command API</h2>
|
| 58 |
+
<div class="bg-gray-800 text-gray-100 p-4 rounded-md overflow-x-auto">
|
| 59 |
+
<code class="text-sm">
|
| 60 |
+
POST /api/quick-command<br>
|
| 61 |
+
Content-Type: application/json<br><br>
|
| 62 |
+
Request Body:<br>
|
| 63 |
+
{<br>
|
| 64 |
+
"category": string<br>
|
| 65 |
+
}<br><br>
|
| 66 |
+
Response:<br>
|
| 67 |
+
{<br>
|
| 68 |
+
"success": boolean,<br>
|
| 69 |
+
"message": string,<br>
|
| 70 |
+
"redirectUrl": string<br>
|
| 71 |
+
}
|
| 72 |
+
</code>
|
| 73 |
+
</div>
|
| 74 |
+
</div>
|
| 75 |
+
</div>
|
| 76 |
+
|
| 77 |
+
<div class="mt-8 pt-4 border-t border-gray-200">
|
| 78 |
+
<a href="/" class="text-purple-600 hover:text-purple-800 flex items-center">
|
| 79 |
+
<i class="fas fa-arrow-left mr-2"></i> Back to AppWizard
|
| 80 |
+
</a>
|
| 81 |
+
</div>
|
| 82 |
+
</div>
|
| 83 |
+
</div>
|
| 84 |
+
</div>
|
| 85 |
+
</body>
|
| 86 |
+
</html>
|
index.html
CHANGED
|
@@ -5,7 +5,8 @@
|
|
| 5 |
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
| 6 |
<title>AppWizard - Mobile Agentic App Launcher</title>
|
| 7 |
<link href="https://cdn.jsdelivr.net/npm/tailwindcss@2.2.19/dist/tailwind.min.css" rel="stylesheet">
|
| 8 |
-
<
|
|
|
|
| 9 |
</head>
|
| 10 |
<body class="bg-gray-100 min-h-screen">
|
| 11 |
<div class="container mx-auto px-4 py-8">
|
|
@@ -34,8 +35,8 @@
|
|
| 34 |
<h2 class="text-xl font-semibold">Text Command</h2>
|
| 35 |
</div>
|
| 36 |
<div class="relative">
|
| 37 |
-
|
| 38 |
-
|
| 39 |
<i class="fas fa-paper-plane"></i>
|
| 40 |
</button>
|
| 41 |
</div>
|
|
@@ -65,11 +66,88 @@
|
|
| 65 |
</div>
|
| 66 |
</div>
|
| 67 |
</div>
|
| 68 |
-
|
| 69 |
<script>
|
| 70 |
-
//
|
| 71 |
-
document.querySelector('.fa-microphone').parentElement.addEventListener('click', () => {
|
| 72 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 73 |
});
|
| 74 |
</script>
|
| 75 |
</body>
|
|
|
|
| 5 |
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
| 6 |
<title>AppWizard - Mobile Agentic App Launcher</title>
|
| 7 |
<link href="https://cdn.jsdelivr.net/npm/tailwindcss@2.2.19/dist/tailwind.min.css" rel="stylesheet">
|
| 8 |
+
<script src="https://cdn.jsdelivr.net/npm/axios/dist/axios.min.js"></script>
|
| 9 |
+
<link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0-beta3/css/all.min.css" rel="stylesheet">
|
| 10 |
</head>
|
| 11 |
<body class="bg-gray-100 min-h-screen">
|
| 12 |
<div class="container mx-auto px-4 py-8">
|
|
|
|
| 35 |
<h2 class="text-xl font-semibold">Text Command</h2>
|
| 36 |
</div>
|
| 37 |
<div class="relative">
|
| 38 |
+
<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()">
|
| 39 |
+
<button class="absolute right-3 top-3 text-purple-600 hover:text-purple-800">
|
| 40 |
<i class="fas fa-paper-plane"></i>
|
| 41 |
</button>
|
| 42 |
</div>
|
|
|
|
| 66 |
</div>
|
| 67 |
</div>
|
| 68 |
</div>
|
|
|
|
| 69 |
<script>
|
| 70 |
+
// Voice command functionality
|
| 71 |
+
document.querySelector('.fa-microphone').parentElement.addEventListener('click', async () => {
|
| 72 |
+
try {
|
| 73 |
+
const response = await fetch('/api/voice-command', {
|
| 74 |
+
method: 'POST',
|
| 75 |
+
headers: {
|
| 76 |
+
'Content-Type': 'application/json',
|
| 77 |
+
}
|
| 78 |
+
});
|
| 79 |
+
|
| 80 |
+
const data = await response.json();
|
| 81 |
+
|
| 82 |
+
if (data.success) {
|
| 83 |
+
// Process the command and launch appropriate app
|
| 84 |
+
window.location.href = data.redirectUrl || '#';
|
| 85 |
+
} else {
|
| 86 |
+
alert('Voice command failed: ' + data.message);
|
| 87 |
+
}
|
| 88 |
+
} catch (error) {
|
| 89 |
+
console.error('Error:', error);
|
| 90 |
+
alert('Failed to process voice command');
|
| 91 |
+
}
|
| 92 |
+
});
|
| 93 |
+
|
| 94 |
+
// Text command functionality
|
| 95 |
+
document.querySelector('.fa-paper-plane').addEventListener('click', async () => {
|
| 96 |
+
const input = document.querySelector('input[type="text"]');
|
| 97 |
+
const command = input.value.trim();
|
| 98 |
+
|
| 99 |
+
if (!command) return;
|
| 100 |
+
|
| 101 |
+
try {
|
| 102 |
+
const response = await fetch('/api/text-command', {
|
| 103 |
+
method: 'POST',
|
| 104 |
+
headers: {
|
| 105 |
+
'Content-Type': 'application/json',
|
| 106 |
+
},
|
| 107 |
+
body: JSON.stringify({ command })
|
| 108 |
+
});
|
| 109 |
+
|
| 110 |
+
const data = await response.json();
|
| 111 |
+
|
| 112 |
+
if (data.success) {
|
| 113 |
+
// Process the command and launch appropriate app
|
| 114 |
+
window.location.href = data.redirectUrl || '#';
|
| 115 |
+
input.value = '';
|
| 116 |
+
} else {
|
| 117 |
+
alert('Command failed: ' + data.message);
|
| 118 |
+
}
|
| 119 |
+
} catch (error) {
|
| 120 |
+
console.error('Error:', error);
|
| 121 |
+
alert('Failed to process command');
|
| 122 |
+
}
|
| 123 |
+
});
|
| 124 |
+
|
| 125 |
+
// Quick category buttons
|
| 126 |
+
document.querySelectorAll('.grid button').forEach(button => {
|
| 127 |
+
button.addEventListener('click', async () => {
|
| 128 |
+
const category = button.textContent.trim().split('\n')[0];
|
| 129 |
+
|
| 130 |
+
try {
|
| 131 |
+
const response = await fetch('/api/quick-command', {
|
| 132 |
+
method: 'POST',
|
| 133 |
+
headers: {
|
| 134 |
+
'Content-Type': 'application/json',
|
| 135 |
+
},
|
| 136 |
+
body: JSON.stringify({ category })
|
| 137 |
+
});
|
| 138 |
+
|
| 139 |
+
const data = await response.json();
|
| 140 |
+
|
| 141 |
+
if (data.success) {
|
| 142 |
+
window.location.href = data.redirectUrl || '#';
|
| 143 |
+
} else {
|
| 144 |
+
alert('Failed to launch: ' + data.message);
|
| 145 |
+
}
|
| 146 |
+
} catch (error) {
|
| 147 |
+
console.error('Error:', error);
|
| 148 |
+
alert('Failed to process quick command');
|
| 149 |
+
}
|
| 150 |
+
});
|
| 151 |
});
|
| 152 |
</script>
|
| 153 |
</body>
|