-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
312 lines (276 loc) · 16.2 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>ReasonAI - Voice Assistant</title>
<script src="https://cdn.tailwindcss.com"></script>
<script src="https://unpkg.com/lucide@latest"></script>
<script src="https://cdn.jsdelivr.net/npm/langdetect/dist/langdetect.min.js"></script>
<style>
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');
* {
font-family: 'Inter', sans-serif;
}
.glass-effect {
background: rgba(255, 255, 255, 0.9);
backdrop-filter: blur(10px);
-webkit-backdrop-filter: blur(10px);
}
.pulse-ring {
animation: pulse-ring 1.25s cubic-bezier(0.215, 0.61, 0.355, 1) infinite;
}
@keyframes pulse-ring {
0% {
transform: scale(0.95);
box-shadow: 0 0 0 0 rgba(99, 102, 241, 0.7);
}
70% {
transform: scale(1);
box-shadow: 0 0 0 15px rgba(99, 102, 241, 0);
}
100% {
transform: scale(0.95);
box-shadow: 0 0 0 0 rgba(99, 102, 241, 0);
}
}
.feature-card {
transition: all 0.3s ease;
}
.feature-card:hover {
transform: translateY(-5px);
}
</style>
</head>
<!-- Google tag (gtag.js) -->
<script async src="https://www.googletagmanager.com/gtag/js?id=G-ZY9S9E5VGC"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', 'G-ZY9S9E5VGC');
</script>
<body class="bg-gradient-to-br from-indigo-500 via-purple-500 to-pink-500 min-h-screen p-4 md:p-8">
<div class="glass-effect max-w-4xl mx-auto rounded-2xl shadow-2xl p-6 md:p-8">
<!-- Header Section -->
<div class="text-center mb-8">
<div class="flex items-center justify-center gap-2 mb-4">
<svg xmlns="http://www.w3.org/2000/svg" class="h-10 w-10 text-indigo-600" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
<path d="M12 2a3 3 0 0 0-3 3v7a3 3 0 0 0 6 0V5a3 3 0 0 0-3-3Z"/>
<path d="M19 10v2a7 7 0 0 1-14 0v-2"/>
<line x1="12" y1="19" x2="12" y2="22"/>
</svg>
<h1 class="text-4xl font-bold bg-clip-text text-transparent bg-gradient-to-r from-indigo-600 to-purple-600">
ReasonAI
</h1>
</div>
<p class="text-gray-600 text-lg">Your intelligent voice companion</p>
</div>
<!-- Main Interface -->
<div class="grid md:grid-cols-2 gap-8">
<!-- Left Column: Voice Interface -->
<div class="space-y-6">
<!-- Voice Button -->
<div class="flex justify-center">
<button id="startButton" class="relative group">
<div class="absolute -inset-1 bg-gradient-to-r from-indigo-600 to-purple-600 rounded-full blur opacity-25 group-hover:opacity-75 transition duration-200"></div>
<div class="relative bg-white rounded-full p-6 flex items-center justify-center hover:bg-gray-50 transition duration-200">
<svg id="micIcon" xmlns="http://www.w3.org/2000/svg" class="h-12 w-12 text-indigo-600" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
<path d="M12 2a3 3 0 0 0-3 3v7a3 3 0 0 0 6 0V5a3 3 0 0 0-3-3Z"/>
<path d="M19 10v2a7 7 0 0 1-14 0v-2"/>
<line x1="12" y1="19" x2="12" y2="22"/>
</svg>
</div>
</button>
</div>
<!-- Output Display -->
<div id="output" class="bg-white/80 rounded-xl p-6 min-h-[150px] shadow-lg border border-gray-100 flex items-center justify-center text-gray-700 text-lg">
<div class="flex items-center gap-3">
<svg xmlns="http://www.w3.org/2000/svg" class="h-6 w-6 text-indigo-600" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
<circle cx="12" cy="12" r="10"/>
<line x1="12" y1="16" x2="12" y2="12"/>
<line x1="12" y1="8" x2="12.01" y2="8"/>
</svg>
<span>Click the microphone to start speaking</span>
</div>
</div>
<!-- Action Buttons -->
<div class="flex gap-4">
<button id="copyButton" class="flex-1 bg-white hover:bg-gray-50 text-gray-700 rounded-xl py-3 px-4 flex items-center justify-center gap-2 transition duration-200 shadow-lg border border-gray-100">
<svg xmlns="http://www.w3.org/2000/svg" class="h-5 w-5 text-indigo-600" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
<rect x="9" y="9" width="13" height="13" rx="2" ry="2"/>
<path d="M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"/>
</svg>
Copy Text
</button>
<button id="shareButton" class="flex-1 bg-white hover:bg-gray-50 text-gray-700 rounded-xl py-3 px-4 flex items-center justify-center gap-2 transition duration-200 shadow-lg border border-gray-100">
<svg xmlns="http://www.w3.org/2000/svg" class="h-5 w-5 text-indigo-600" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
<circle cx="18" cy="5" r="3"/>
<circle cx="6" cy="12" r="3"/>
<circle cx="18" cy="19" r="3"/>
<line x1="8.59" y1="13.51" x2="15.42" y2="17.49"/>
<line x1="15.41" y1="6.51" x2="8.59" y2="10.49"/>
</svg>
Share
</button>
</div>
</div>
<!-- Right Column: Features & Suggestions -->
<div class="space-y-6">
<!-- Quick Actions -->
<div class="grid grid-cols-2 gap-4">
<div class="feature-card bg-white/80 rounded-xl p-4 text-center shadow-lg border border-gray-100">
<svg xmlns="http://www.w3.org/2000/svg" class="h-8 w-8 mx-auto mb-2 text-indigo-600" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
<circle cx="12" cy="12" r="10"/>
<path d="M8 14s1.5 2 4 2 4-2 4-2"/>
<line x1="9" y1="9" x2="9.01" y2="9"/>
<line x1="15" y1="9" x2="15.01" y2="9"/>
</svg>
<h3 class="font-semibold text-gray-700">Easy to Use</h3>
<p class="text-sm text-gray-500">Just speak naturally</p>
</div>
<div class="feature-card bg-white/80 rounded-xl p-4 text-center shadow-lg border border-gray-100">
<svg xmlns="http://www.w3.org/2000/svg" class="h-8 w-8 mx-auto mb-2 text-indigo-600" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
<path d="M14.5 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7.5L14.5 2z"/>
<polyline points="14 2 14 8 20 8"/>
</svg>
<h3 class="font-semibold text-gray-700">Save & Share</h3>
<p class="text-sm text-gray-500">Keep your conversations</p>
</div>
</div>
<!-- Suggestions -->
<div class="bg-white/80 rounded-xl p-6 shadow-lg border border-gray-100">
<div class="flex items-center gap-2 mb-4">
<svg xmlns="http://www.w3.org/2000/svg" class="h-5 w-5 text-indigo-600" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
<polygon points="12 2 15.09 8.26 22 9.27 17 14.14 18.18 21.02 12 17.77 5.82 21.02 7 14.14 2 9.27 8.91 8.26 12 2"/>
</svg>
<h3 class="font-semibold text-gray-700">Try Saying:</h3>
</div>
<ul class="space-y-3">
<li class="flex items-center gap-2 text-gray-600 hover:text-indigo-600 cursor-pointer transition-colors">
<svg xmlns="http://www.w3.org/2000/svg" class="h-4 w-4" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
<path d="M22 17H2a3 3 0 0 0 3-3V9a7 7 0 0 1 14 0v5a3 3 0 0 0 3 3Z"/>
<path d="M12 19v3"/>
</svg>
"What's the weather like?"
</li>
<li class="flex items-center gap-2 text-gray-600 hover:text-indigo-600 cursor-pointer transition-colors">
<svg xmlns="http://www.w3.org/2000/svg" class="h-4 w-4" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
<circle cx="12" cy="12" r="10"/>
<path d="M8 14s1.5 2 4 2 4-2 4-2"/>
<line x1="9" y1="9" x2="9.01" y2="9"/>
<line x1="15" y1="9" x2="15.01" y2="9"/>
</svg>
"Tell me a joke"
</li>
<li class="flex items-center gap-2 text-gray-600 hover:text-indigo-600 cursor-pointer transition-colors">
<svg xmlns="http://www.w3.org/2000/svg" class="h-4 w-4" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
<path d="M4 19.5v-15A2.5 2.5 0 0 1 6.5 2H20v20H6.5a2.5 2.5 0 0 1 0-5H20"/>
</svg>
"How do I learn to read?"
</li>
</ul>
</div>
<!-- Learning Tips -->
<div id="learningTip" class="hidden bg-gradient-to-r from-indigo-50 to-purple-50 rounded-xl p-6 shadow-lg border border-indigo-100">
<div class="flex items-center gap-2 mb-3">
<svg xmlns="http://www.w3.org/2000/svg" class="h-5 w-5 text-indigo-600" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
<path d="M18 8A6 6 0 0 0 6 8c0 7-3 9-3 9h18s-3-2-3-9"/>
<path d="M13.73 21a2 2 0 0 1-3.46 0"/>
</svg>
<h3 class="font-semibold text-gray-700">Learning Tip</h3>
</div>
<p id="tipContent" class="text-gray-600"></p>
</div>
</div>
</div>
</div>
<script>
const startButton = document.getElementById('startButton');
const output = document.getElementById('output');
const copyButton = document.getElementById('copyButton');
const shareButton = document.getElementById('shareButton');
const learningTip = document.getElementById('learningTip');
const tipContent = document.getElementById('tipContent');
const recognition = new (window.SpeechRecognition || window.webkitSpeechRecognition)();
recognition.continuous = false;
recognition.interimResults = false;
const supportedLanguages = [
'en-US', 'es-ES', 'fr-FR', 'de-DE', 'it-IT',
'pt-PT', 'nl-NL', 'sv-SE', 'da-DK', 'fi-FI',
'nb-NO', 'tr-TR', 'ru-RU', 'pl-PL', 'cs-CZ',
'hu-HU', 'ro-RO', 'el-GR', 'ja-JP', 'ko-KR',
'zh-CN', 'zh-TW', 'th-TH', 'id-ID', 'ms-MY',
'vi-VN', 'hi-IN', 'bn-IN', 'ta-IN', 'te-IN',
'pcm', 'ha-NG', 'ig-NG', 'yo-NG', 'sw-TZ',
'sw-KE', 'am-ET', 'so-SO', 'sn-ZW', 'xh-ZA',
'zu-ZA', 'rw-RW', 'lg-UG', 'st-LS', 'tn-ZA',
'ss-ZA', 'ks-KE', 'nso-ZA', 'dje-NE'
];
recognition.lang = 'en-US'; // default language
function detectLanguage(text) {
const detector = new LangDetect();
return detector.detect(text);
}
startButton.addEventListener('click', () => {
recognition.start();
output.textContent = 'Listening...';
startButton.classList.add('animate-pulse');
});
recognition.onresult = (event) => {
const transcript = event.results[0][0].transcript;
output.textContent = transcript;
startButton.classList.remove('animate-pulse');
const detectedLanguage = detectLanguage(transcript);
if (supportedLanguages.includes(detectedLanguage)) {
recognition.lang = detectedLanguage;
}
handleUserInput(transcript);
};
recognition.onerror = (event) => {
console.error('Speech recognition error:', event.error);
output.textContent = 'Error occurred. Please try again.';
startButton.classList.remove('animate-pulse');
};
function handleUserInput(input) {
// Simple response logic (expand this for more functionality)
let response = "I heard you say: " + input;
if (input.toLowerCase().includes('weather')) {
response = "I'm sorry, I can't provide real-time weather information. You can check a weather app or website for accurate forecasts.";
} else if (input.toLowerCase().includes('joke')) {
response = "Here's a joke: Why don't scientists trust atoms? Because they make up everything!";
} else if (input.toLowerCase().includes('learn to read')) {
response = "Learning to read is a gradual process. Start with alphabet recognition, then move to simple words and sentences. Regular practice and patience are key!";
showLearningTip("Try associating letters with familiar objects. For example, 'A' for Apple, 'B' for Ball.");
}
speakResponse(response);
}
function speakResponse(response) {
const synthesis = window.speechSynthesis;
const utterance = new SpeechSynthesisUtterance(response);
utterance.lang = recognition.lang;
synthesis.speak(utterance);
}
function showLearningTip(tip) {
tipContent.textContent = tip;
learningTip.classList.remove('hidden');
}
copyButton.addEventListener('click', () => {
navigator.clipboard.writeText(output.textContent)
.then(() => alert('Text copied to clipboard!'))
.catch(err => console.error('Error copying text: ', err));
});
shareButton.addEventListener('click', () => {
if (navigator.share) {
navigator.share({
title: 'ReasonAI Transcription',
text: output.textContent
}).then(() => console.log('Shared successfully'))
.catch((error) => console.log('Error sharing:', error));
} else {
alert('Web Share API not supported in your browser');
}
});
</script>
</body>
</html>