Spaces:
Running
Running
Download index.html from guiarantes98/whats: direct link, hf CLI and curl.
- Browser
- Download file 39.3 kB
-
https://huggingface.co/spaces/guiarantes98/whats/resolve/main/index.html
- Command line
-
hf download hf://spaces/guiarantes98/whats/index.html
-
curl -L -o index.html https://huggingface.co/spaces/guiarantes98/whats/resolve/main/index.html
39.3 kB
| <html lang="en"> | |
| <head> | |
| <meta charset="UTF-8"> | |
| <meta name="viewport" content="width=device-width, initial-scale=1.0"> | |
| <title>Advanced WhatsApp Assistant</title> | |
| <script src="https://cdn.tailwindcss.com"></script> | |
| <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css"> | |
| <style> | |
| @import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap'); | |
| body { | |
| font-family: 'Inter', sans-serif; | |
| background-color: #f0f2f5; | |
| } | |
| .chat-container { | |
| height: calc(100vh - 160px); | |
| } | |
| .message-in { | |
| background-color: #ffffff; | |
| border-radius: 0 8px 8px 8px; | |
| } | |
| .message-out { | |
| background-color: #d9fdd3; | |
| border-radius: 8px 0 8px 8px; | |
| } | |
| .voice-wave { | |
| display: flex; | |
| align-items: center; | |
| gap: 2px; | |
| } | |
| .wave-bar { | |
| width: 2px; | |
| background-color: #25D366; | |
| animation: wave 1.2s infinite ease-in-out; | |
| } | |
| @keyframes wave { | |
| 0%, 100% { height: 10px; } | |
| 50% { height: 20px; } | |
| } | |
| .wave-bar:nth-child(1) { animation-delay: 0s; } | |
| .wave-bar:nth-child(2) { animation-delay: 0.2s; } | |
| .wave-bar:nth-child(3) { animation-delay: 0.4s; } | |
| .wave-bar:nth-child(4) { animation-delay: 0.6s; } | |
| .wave-bar:nth-child(5) { animation-delay: 0.8s; } | |
| .tab-content { | |
| display: none; | |
| } | |
| .tab-content.active { | |
| display: block; | |
| } | |
| .tab-button.active { | |
| border-bottom: 3px solid #25D366; | |
| color: #25D366; | |
| font-weight: 600; | |
| } | |
| .slider-thumb::-webkit-slider-thumb { | |
| -webkit-appearance: none; | |
| appearance: none; | |
| width: 20px; | |
| height: 20px; | |
| background: #25D366; | |
| cursor: pointer; | |
| border-radius: 50%; | |
| } | |
| .recording-indicator { | |
| animation: pulse 1.5s infinite; | |
| } | |
| @keyframes pulse { | |
| 0%, 100% { opacity: 1; } | |
| 50% { opacity: 0.5; } | |
| } | |
| .audio-visualizer { | |
| display: flex; | |
| align-items: flex-end; | |
| height: 40px; | |
| gap: 2px; | |
| } | |
| .audio-bar { | |
| width: 3px; | |
| background-color: #25D366; | |
| border-radius: 2px; | |
| transition: height 0.1s ease; | |
| } | |
| .emoji-picker { | |
| position: absolute; | |
| bottom: 60px; | |
| right: 20px; | |
| width: 300px; | |
| height: 300px; | |
| background: white; | |
| border-radius: 8px; | |
| box-shadow: 0 4px 12px rgba(0,0,0,0.15); | |
| padding: 10px; | |
| display: none; | |
| z-index: 100; | |
| } | |
| .emoji-picker.active { | |
| display: block; | |
| } | |
| .attachment-menu { | |
| position: absolute; | |
| bottom: 60px; | |
| left: 20px; | |
| width: 200px; | |
| background: white; | |
| border-radius: 8px; | |
| box-shadow: 0 4px 12px rgba(0,0,0,0.15); | |
| padding: 10px; | |
| display: none; | |
| z-index: 100; | |
| } | |
| .attachment-menu.active { | |
| display: block; | |
| } | |
| .send-options { | |
| position: absolute; | |
| bottom: 60px; | |
| right: 20px; | |
| background: white; | |
| border-radius: 8px; | |
| box-shadow: 0 4px 12px rgba(0,0,0,0.15); | |
| padding: 10px; | |
| display: none; | |
| z-index: 100; | |
| } | |
| .send-options.active { | |
| display: block; | |
| } | |
| </style> | |
| </head> | |
| <body class="bg-gray-100"> | |
| <div class="container mx-auto max-w-6xl p-4"> | |
| <div class="bg-white rounded-xl shadow-lg overflow-hidden"> | |
| <!-- Header --> | |
| <div class="bg-[#075E54] text-white p-4 flex items-center justify-between"> | |
| <div class="flex items-center space-x-3"> | |
| <div class="w-10 h-10 rounded-full bg-white flex items-center justify-center"> | |
| <i class="fas fa-robot text-[#075E54] text-xl"></i> | |
| </div> | |
| <div> | |
| <h1 class="font-bold text-lg">WhatsApp Assistant Pro</h1> | |
| <p class="text-xs opacity-80">Online • v2.1.0</p> | |
| </div> | |
| </div> | |
| <div class="flex space-x-4"> | |
| <button class="text-white hover:text-gray-200"> | |
| <i class="fas fa-search"></i> | |
| </button> | |
| <button class="text-white hover:text-gray-200"> | |
| <i class="fas fa-ellipsis-vertical"></i> | |
| </button> | |
| </div> | |
| </div> | |
| <!-- Main Content --> | |
| <div class="flex"> | |
| <!-- Sidebar --> | |
| <div class="w-1/3 border-r border-gray-200 bg-gray-50"> | |
| <!-- Tabs --> | |
| <div class="flex border-b border-gray-200"> | |
| <button class="tab-button active flex-1 py-3 text-center" onclick="openTab('chat-tab')"> | |
| <i class="fas fa-comment-dots mr-2"></i> Chat | |
| </button> | |
| <button class="tab-button flex-1 py-3 text-center" onclick="openTab('settings-tab')"> | |
| <i class="fas fa-cog mr-2"></i> Settings | |
| </button> | |
| </div> | |
| <!-- Chat Tab --> | |
| <div id="chat-tab" class="tab-content active p-4"> | |
| <div class="mb-4"> | |
| <h3 class="font-semibold text-gray-700 mb-2">Active Conversations</h3> | |
| <div class="space-y-2"> | |
| <div class="flex items-center p-2 rounded-lg hover:bg-gray-100 cursor-pointer"> | |
| <div class="w-10 h-10 rounded-full bg-green-100 flex items-center justify-center mr-3"> | |
| <i class="fas fa-user text-green-600"></i> | |
| </div> | |
| <div> | |
| <p class="font-medium">John Doe</p> | |
| <p class="text-xs text-gray-500 truncate">Hey, how's the project going?</p> | |
| </div> | |
| </div> | |
| <div class="flex items-center p-2 rounded-lg hover:bg-gray-100 cursor-pointer"> | |
| <div class="w-10 h-10 rounded-full bg-blue-100 flex items-center justify-center mr-3"> | |
| <i class="fas fa-user text-blue-600"></i> | |
| </div> | |
| <div> | |
| <p class="font-medium">Sarah Smith</p> | |
| <p class="text-xs text-gray-500 truncate">Can we meet tomorrow?</p> | |
| </div> | |
| </div> | |
| </div> | |
| </div> | |
| <div> | |
| <h3 class="font-semibold text-gray-700 mb-2">New Conversation</h3> | |
| <div class="relative"> | |
| <input type="text" placeholder="Search or start new chat" class="w-full p-2 pl-10 rounded-lg border border-gray-300 focus:outline-none focus:ring-2 focus:ring-green-500 focus:border-transparent"> | |
| <i class="fas fa-search absolute left-3 top-3 text-gray-400"></i> | |
| </div> | |
| </div> | |
| </div> | |
| <!-- Settings Tab --> | |
| <div id="settings-tab" class="tab-content p-4"> | |
| <h3 class="font-semibold text-gray-700 mb-4">Assistant Configuration</h3> | |
| <div class="space-y-6"> | |
| <!-- Personality Settings --> | |
| <div> | |
| <h4 class="font-medium text-gray-600 mb-2">Personality Style</h4> | |
| <div class="space-y-3"> | |
| <div class="flex items-center"> | |
| <input type="radio" id="professional" name="personality" class="mr-2" checked> | |
| <label for="professional">Professional</label> | |
| </div> | |
| <div class="flex items-center"> | |
| <input type="radio" id="friendly" name="personality" class="mr-2"> | |
| <label for="friendly">Friendly</label> | |
| </div> | |
| <div class="flex items-center"> | |
| <input type="radio" id="humorous" name="personality" class="mr-2"> | |
| <label for="humorous">Humorous</label> | |
| </div> | |
| </div> | |
| </div> | |
| <!-- Response Settings --> | |
| <div> | |
| <h4 class="font-medium text-gray-600 mb-2">Response Settings</h4> | |
| <div class="space-y-4"> | |
| <div> | |
| <label class="block text-sm text-gray-500 mb-1">Response Time (seconds)</label> | |
| <input type="range" min="1" max="60" value="10" class="w-full slider-thumb"> | |
| <div class="flex justify-between text-xs text-gray-500"> | |
| <span>Instant</span> | |
| <span>1 min</span> | |
| </div> | |
| </div> | |
| <div> | |
| <label class="block text-sm text-gray-500 mb-1">Message Length</label> | |
| <input type="range" min="1" max="5" value="3" class="w-full slider-thumb"> | |
| <div class="flex justify-between text-xs text-gray-500"> | |
| <span>Brief</span> | |
| <span>Detailed</span> | |
| </div> | |
| </div> | |
| </div> | |
| </div> | |
| <!-- Voice Settings --> | |
| <div> | |
| <h4 class="font-medium text-gray-600 mb-2">Voice Settings</h4> | |
| <div class="space-y-3"> | |
| <div class="flex items-center"> | |
| <input type="checkbox" id="enable-voice" class="mr-2" checked> | |
| <label for="enable-voice">Enable Voice Messages</label> | |
| </div> | |
| <div> | |
| <label class="block text-sm text-gray-500 mb-1">Voice Similarity</label> | |
| <input type="range" min="1" max="100" value="85" class="w-full slider-thumb"> | |
| <div class="flex justify-between text-xs text-gray-500"> | |
| <span>Generic</span> | |
| <span>Your Voice</span> | |
| </div> | |
| </div> | |
| <div> | |
| <label class="block text-sm text-gray-500 mb-1">Voice Message Length Limit</label> | |
| <select class="w-full p-2 border rounded-lg"> | |
| <option>15 seconds</option> | |
| <option selected>30 seconds</option> | |
| <option>1 minute</option> | |
| <option>2 minutes</option> | |
| </select> | |
| </div> | |
| <button class="w-full py-2 bg-green-600 text-white rounded-lg hover:bg-green-700 flex items-center justify-center"> | |
| <i class="fas fa-microphone mr-2"></i> Record Voice Sample | |
| </button> | |
| </div> | |
| </div> | |
| <!-- Message Sending Settings --> | |
| <div> | |
| <h4 class="font-medium text-gray-600 mb-2">Message Sending</h4> | |
| <div class="space-y-3"> | |
| <div class="flex items-center"> | |
| <input type="checkbox" id="send-animations" class="mr-2" checked> | |
| <label for="send-animations">Enable Send Animations</label> | |
| </div> | |
| <div class="flex items-center"> | |
| <input type="checkbox" id="typing-indicator" class="mr-2" checked> | |
| <label for="typing-indicator">Show Typing Indicators</label> | |
| </div> | |
| <div class="flex items-center"> | |
| <input type="checkbox" id="read-receipts" class="mr-2" checked> | |
| <label for="read-receipts">Send Read Receipts</label> | |
| </div> | |
| <div> | |
| <label class="block text-sm text-gray-500 mb-1">Message Send Delay</label> | |
| <input type="range" min="0" max="5" value="1" class="w-full slider-thumb"> | |
| <div class="flex justify-between text-xs text-gray-500"> | |
| <span>Instant</span> | |
| <span>5 sec</span> | |
| </div> | |
| </div> | |
| </div> | |
| </div> | |
| <!-- Learning Settings --> | |
| <div> | |
| <h4 class="font-medium text-gray-600 mb-2">Learning Settings</h4> | |
| <div class="space-y-3"> | |
| <div class="flex items-center"> | |
| <input type="checkbox" id="enable-learning" class="mr-2" checked> | |
| <label for="enable-learning">Enable Continuous Learning</label> | |
| </div> | |
| <div class="flex items-center"> | |
| <input type="checkbox" id="review-conversations" class="mr-2" checked> | |
| <label for="review-conversations">Review Past Conversations</label> | |
| </div> | |
| <button class="w-full py-2 bg-blue-600 text-white rounded-lg hover:bg-blue-700 flex items-center justify-center"> | |
| <i class="fas fa-upload mr-2"></i> Upload Conversation Samples | |
| </button> | |
| </div> | |
| </div> | |
| </div> | |
| </div> | |
| </div> | |
| <!-- Chat Area --> | |
| <div class="w-2/3 flex flex-col"> | |
| <!-- Chat Header --> | |
| <div class="p-3 border-b border-gray-200 flex items-center bg-gray-50"> | |
| <div class="w-10 h-10 rounded-full bg-purple-100 flex items-center justify-center mr-3"> | |
| <i class="fas fa-user text-purple-600"></i> | |
| </div> | |
| <div> | |
| <p class="font-medium">Alex Johnson</p> | |
| <p class="text-xs text-gray-500">last seen today at 2:45 PM</p> | |
| </div> | |
| <div class="ml-auto flex space-x-3"> | |
| <button class="text-gray-500 hover:text-gray-700"> | |
| <i class="fas fa-phone"></i> | |
| </button> | |
| <button class="text-gray-500 hover:text-gray-700"> | |
| <i class="fas fa-video"></i> | |
| </button> | |
| <button class="text-gray-500 hover:text-gray-700"> | |
| <i class="fas fa-search"></i> | |
| </button> | |
| </div> | |
| </div> | |
| <!-- Messages --> | |
| <div class="chat-container overflow-y-auto p-4 space-y-3"> | |
| <!-- Date --> | |
| <div class="text-center text-xs text-gray-500 my-2"> | |
| TODAY | |
| </div> | |
| <!-- Incoming Message --> | |
| <div class="flex items-start space-x-2"> | |
| <div class="w-8 h-8 rounded-full bg-purple-100 flex items-center justify-center mt-1"> | |
| <i class="fas fa-user text-purple-600 text-xs"></i> | |
| </div> | |
| <div class="message-in p-3 max-w-xs"> | |
| <p>Hey, are you available for a quick call?</p> | |
| <p class="text-xs text-gray-500 text-right mt-1">2:30 PM</p> | |
| </div> | |
| </div> | |
| <!-- Outgoing Message (Assistant) --> | |
| <div class="flex justify-end"> | |
| <div class="message-out p-3 max-w-xs"> | |
| <p>Hi Alex! I'm currently in a meeting but can talk in about 30 minutes. Will that work for you?</p> | |
| <p class="text-xs text-gray-500 text-right mt-1">2:32 PM</p> | |
| </div> | |
| </div> | |
| <!-- Incoming Message --> | |
| <div class="flex items-start space-x-2"> | |
| <div class="w-8 h-8 rounded-full bg-purple-100 flex items-center justify-center mt-1"> | |
| <i class="fas fa-user text-purple-600 text-xs"></i> | |
| </div> | |
| <div class="message-in p-3 max-w-xs"> | |
| <p>Sure, that works. Just wanted to discuss the project timeline.</p> | |
| <p class="text-xs text-gray-500 text-right mt-1">2:33 PM</p> | |
| </div> | |
| </div> | |
| <!-- Outgoing Voice Message (Assistant) --> | |
| <div class="flex justify-end"> | |
| <div class="message-out p-3 max-w-xs"> | |
| <div class="flex items-center space-x-2"> | |
| <div class="voice-wave"> | |
| <div class="wave-bar"></div> | |
| <div class="wave-bar"></div> | |
| <div class="wave-bar"></div> | |
| <div class="wave-bar"></div> | |
| <div class="wave-bar"></div> | |
| </div> | |
| <span class="text-sm">0:12</span> | |
| <button class="text-green-600"> | |
| <i class="fas fa-play"></i> | |
| </button> | |
| </div> | |
| <p class="text-xs text-gray-500 text-right mt-1">2:34 PM</p> | |
| </div> | |
| </div> | |
| <!-- Info Message --> | |
| <div class="text-center text-xs text-gray-500 my-2"> | |
| Assistant is typing... | |
| </div> | |
| </div> | |
| <!-- Message Input --> | |
| <div class="p-3 border-t border-gray-200 bg-gray-50 relative"> | |
| <!-- Attachment Menu --> | |
| <div class="attachment-menu"> | |
| <div class="space-y-2"> | |
| <button class="w-full text-left p-2 hover:bg-gray-100 rounded flex items-center"> | |
| <i class="fas fa-image text-green-600 mr-2"></i> Photo & Video | |
| </button> | |
| <button class="w-full text-left p-2 hover:bg-gray-100 rounded flex items-center"> | |
| <i class="fas fa-file text-blue-600 mr-2"></i> Document | |
| </button> | |
| <button class="w-full text-left p-2 hover:bg-gray-100 rounded flex items-center"> | |
| <i class="fas fa-map-marker-alt text-red-600 mr-2"></i> Location | |
| </button> | |
| <button class="w-full text-left p-2 hover:bg-gray-100 rounded flex items-center"> | |
| <i class="fas fa-user text-purple-600 mr-2"></i> Contact | |
| </button> | |
| </div> | |
| </div> | |
| <!-- Emoji Picker --> | |
| <div class="emoji-picker"> | |
| <div class="flex justify-between mb-2"> | |
| <span class="font-medium">Emojis</span> | |
| <button onclick="toggleEmojiPicker()" class="text-gray-500"> | |
| <i class="fas fa-times"></i> | |
| </button> | |
| </div> | |
| <div class="grid grid-cols-8 gap-2"> | |
| <!-- Sample emojis --> | |
| <span class="text-2xl cursor-pointer hover:bg-gray-100 p-1 rounded">😀</span> | |
| <span class="text-2xl cursor-pointer hover:bg-gray-100 p-1 rounded">😂</span> | |
| <span class="text-2xl cursor-pointer hover:bg-gray-100 p-1 rounded">😍</span> | |
| <span class="text-2xl cursor-pointer hover:bg-gray-100 p-1 rounded">😎</span> | |
| <span class="text-2xl cursor-pointer hover:bg-gray-100 p-1 rounded">🤔</span> | |
| <span class="text-2xl cursor-pointer hover:bg-gray-100 p-1 rounded">👍</span> | |
| <span class="text-2xl cursor-pointer hover:bg-gray-100 p-1 rounded">👋</span> | |
| <span class="text-2xl cursor-pointer hover:bg-gray-100 p-1 rounded">❤️</span> | |
| </div> | |
| </div> | |
| <!-- Send Options --> | |
| <div class="send-options"> | |
| <div class="space-y-2"> | |
| <button class="w-full text-left p-2 hover:bg-gray-100 rounded flex items-center"> | |
| <i class="fas fa-paper-plane text-green-600 mr-2"></i> Send Now | |
| </button> | |
| <button class="w-full text-left p-2 hover:bg-gray-100 rounded flex items-center"> | |
| <i class="fas fa-clock text-yellow-600 mr-2"></i> Schedule Message | |
| </button> | |
| <button class="w-full text-left p-2 hover:bg-gray-100 rounded flex items-center"> | |
| <i class="fas fa-eye-slash text-gray-600 mr-2"></i> Send Discreetly | |
| </button> | |
| </div> | |
| </div> | |
| <div class="flex items-center space-x-2"> | |
| <button onclick="toggleAttachmentMenu()" class="text-gray-500 hover:text-gray-700"> | |
| <i class="fas fa-paperclip"></i> | |
| </button> | |
| <div class="flex-1 relative"> | |
| <input type="text" placeholder="Type a message" class="w-full p-2 pl-4 pr-10 rounded-full border border-gray-300 focus:outline-none focus:ring-2 focus:ring-green-500 focus:border-transparent"> | |
| <button onclick="toggleEmojiPicker()" class="absolute right-3 top-2 text-gray-500 hover:text-gray-700"> | |
| <i class="far fa-smile"></i> | |
| </button> | |
| </div> | |
| <!-- Audio Recording UI --> | |
| <div id="audio-recording-ui" class="hidden items-center"> | |
| <div class="audio-visualizer mr-2" id="visualizer"> | |
| <div class="audio-bar"></div> | |
| <div class="audio-bar"></div> | |
| <div class="audio-bar"></div> | |
| <div class="audio-bar"></div> | |
| <div class="audio-bar"></div> | |
| <div class="audio-bar"></div> | |
| <div class="audio-bar"></div> | |
| <div class="audio-bar"></div> | |
| </div> | |
| <span class="text-sm mr-2" id="recording-time">0:00</span> | |
| <button id="stop-recording" class="text-red-600"> | |
| <i class="fas fa-stop"></i> | |
| </button> | |
| </div> | |
| <button id="mic-button" class="text-gray-500 hover:text-gray-700"> | |
| <i class="fas fa-microphone"></i> | |
| </button> | |
| <button onclick="toggleSendOptions()" class="bg-green-600 text-white p-2 rounded-full hover:bg-green-700 relative"> | |
| <i class="fas fa-paper-plane"></i> | |
| <span class="absolute -top-1 -right-1 w-4 h-4 bg-white rounded-full flex items-center justify-center"> | |
| <span class="w-3 h-3 bg-green-600 rounded-full"></span> | |
| </span> | |
| </button> | |
| </div> | |
| </div> | |
| </div> | |
| </div> | |
| </div> | |
| <!-- Status Bar --> | |
| <div class="text-center text-xs text-gray-500 mt-2"> | |
| <p>Assistant Status: <span class="text-green-600">Active</span> • Last Updated: Just now • <span id="connection-status">Connection: Excellent</span></p> | |
| </div> | |
| </div> | |
| <script> | |
| // Tab switching | |
| function openTab(tabId) { | |
| // Hide all tab contents | |
| document.querySelectorAll('.tab-content').forEach(tab => { | |
| tab.classList.remove('active'); | |
| }); | |
| // Remove active class from all buttons | |
| document.querySelectorAll('.tab-button').forEach(button => { | |
| button.classList.remove('active'); | |
| }); | |
| // Show the selected tab and mark button as active | |
| document.getElementById(tabId).classList.add('active'); | |
| event.currentTarget.classList.add('active'); | |
| } | |
| // Toggle emoji picker | |
| function toggleEmojiPicker() { | |
| const picker = document.querySelector('.emoji-picker'); | |
| picker.classList.toggle('active'); | |
| } | |
| // Toggle attachment menu | |
| function toggleAttachmentMenu() { | |
| const menu = document.querySelector('.attachment-menu'); | |
| menu.classList.toggle('active'); | |
| // Close other menus | |
| document.querySelector('.emoji-picker').classList.remove('active'); | |
| document.querySelector('.send-options').classList.remove('active'); | |
| } | |
| // Toggle send options | |
| function toggleSendOptions() { | |
| const options = document.querySelector('.send-options'); | |
| options.classList.toggle('active'); | |
| // Close other menus | |
| document.querySelector('.emoji-picker').classList.remove('active'); | |
| document.querySelector('.attachment-menu').classList.remove('active'); | |
| } | |
| // Close menus when clicking outside | |
| document.addEventListener('click', function(e) { | |
| if (!e.target.closest('.emoji-picker') && !e.target.closest('.far.fa-smile')) { | |
| document.querySelector('.emoji-picker').classList.remove('active'); | |
| } | |
| if (!e.target.closest('.attachment-menu') && !e.target.closest('.fa-paperclip')) { | |
| document.querySelector('.attachment-menu').classList.remove('active'); | |
| } | |
| if (!e.target.closest('.send-options') && !e.target.closest('.fa-paper-plane')) { | |
| document.querySelector('.send-options').classList.remove('active'); | |
| } | |
| }); | |
| // Audio recording functionality | |
| const micButton = document.getElementById('mic-button'); | |
| const audioRecordingUI = document.getElementById('audio-recording-ui'); | |
| const stopRecordingButton = document.getElementById('stop-recording'); | |
| const recordingTime = document.getElementById('recording-time'); | |
| const visualizer = document.getElementById('visualizer'); | |
| const audioBars = visualizer.querySelectorAll('.audio-bar'); | |
| let recordingInterval; | |
| let seconds = 0; | |
| micButton.addEventListener('click', function() { | |
| // Start recording simulation | |
| audioRecordingUI.classList.remove('hidden'); | |
| micButton.classList.add('hidden'); | |
| // Start timer | |
| seconds = 0; | |
| recordingInterval = setInterval(() => { | |
| seconds++; | |
| const mins = Math.floor(seconds / 60); | |
| const secs = seconds % 60; | |
| recordingTime.textContent = `${mins}:${secs < 10 ? '0' + secs : secs}`; | |
| }, 1000); | |
| // Animate audio bars | |
| animateAudioBars(); | |
| }); | |
| stopRecordingButton.addEventListener('click', function() { | |
| // Stop recording simulation | |
| clearInterval(recordingInterval); | |
| audioRecordingUI.classList.add('hidden'); | |
| micButton.classList.remove('hidden'); | |
| // Stop audio bar animation | |
| clearInterval(audioBarInterval); | |
| // Add the recorded voice message to chat | |
| addVoiceMessage(seconds); | |
| }); | |
| let audioBarInterval; | |
| function animateAudioBars() { | |
| audioBarInterval = setInterval(() => { | |
| audioBars.forEach(bar => { | |
| const randomHeight = Math.floor(Math.random() * 30) + 5; | |
| bar.style.height = `${randomHeight}px`; | |
| }); | |
| }, 100); | |
| } | |
| function addVoiceMessage(duration) { | |
| const messagesContainer = document.querySelector('.chat-container'); | |
| const typingIndicator = messagesContainer.lastElementChild; | |
| if (typingIndicator && typingIndicator.textContent.includes('typing')) { | |
| messagesContainer.removeChild(typingIndicator); | |
| } | |
| const mins = Math.floor(duration / 60); | |
| const secs = duration % 60; | |
| const timeString = `${mins}:${secs < 10 ? '0' + secs : secs}`; | |
| const newMessage = document.createElement('div'); | |
| newMessage.className = 'flex justify-end'; | |
| newMessage.innerHTML = ` | |
| <div class="message-out p-3 max-w-xs"> | |
| <div class="flex items-center space-x-2"> | |
| <div class="voice-wave"> | |
| <div class="wave-bar"></div> | |
| <div class="wave-bar"></div> | |
| <div class="wave-bar"></div> | |
| <div class="wave-bar"></div> | |
| <div class="wave-bar"></div> | |
| </div> | |
| <span class="text-sm">${timeString}</span> | |
| <button class="text-green-600"> | |
| <i class="fas fa-play"></i> | |
| </button> | |
| </div> | |
| <p class="text-xs text-gray-500 text-right mt-1">${new Date().toLocaleTimeString([], {hour: '2-digit', minute:'2-digit'})}</p> | |
| </div> | |
| `; | |
| messagesContainer.appendChild(newMessage); | |
| messagesContainer.scrollTop = messagesContainer.scrollHeight; | |
| } | |
| // Simulate assistant typing | |
| setInterval(() => { | |
| const typingIndicator = document.querySelector('.chat-container').lastElementChild; | |
| if (typingIndicator && typingIndicator.textContent.includes('typing')) { | |
| // Simulate message after typing | |
| setTimeout(() => { | |
| const messagesContainer = document.querySelector('.chat-container'); | |
| // Create new message | |
| const newMessage = document.createElement('div'); | |
| newMessage.className = 'flex justify-end'; | |
| newMessage.innerHTML = ` | |
| <div class="message-out p-3 max-w-xs"> | |
| <p>Great! I'll send you a calendar invite for 3:00 PM with the Zoom link. Looking forward to our chat!</p> | |
| <p class="text-xs text-gray-500 text-right mt-1">${new Date().toLocaleTimeString([], {hour: '2-digit', minute:'2-digit'})}</p> | |
| </div> | |
| `; | |
| // Remove typing indicator and add new message | |
| messagesContainer.removeChild(typingIndicator); | |
| messagesContainer.appendChild(newMessage); | |
| messagesContainer.scrollTop = messagesContainer.scrollHeight; | |
| }, 2000); | |
| } | |
| }, 5000); | |
| // Voice message play button | |
| document.addEventListener('click', function(e) { | |
| if (e.target.closest('.fa-play')) { | |
| const voiceMessage = e.target.closest('.message-out'); | |
| const waveBars = voiceMessage.querySelectorAll('.wave-bar'); | |
| // Animate voice wave during playback | |
| waveBars.forEach(bar => { | |
| bar.style.animationPlayState = 'running'; | |
| }); | |
| // Change play button to pause | |
| const playButton = e.target.closest('button'); | |
| playButton.innerHTML = '<i class="fas fa-pause"></i>'; | |
| // Simulate playback ending | |
| setTimeout(() => { | |
| waveBars.forEach(bar => { | |
| bar.style.animationPlayState = 'paused'; | |
| }); | |
| playButton.innerHTML = '<i class="fas fa-play"></i>'; | |
| }, 1200); | |
| } | |
| }); | |
| // Simulate connection status changes | |
| const statuses = ['Excellent', 'Good', 'Fair', 'Poor', 'Disconnected']; | |
| setInterval(() => { | |
| const randomStatus = statuses[Math.floor(Math.random() * statuses.length)]; | |
| const statusElement = document.getElementById('connection-status'); | |
| statusElement.textContent = `Connection: ${randomStatus}`; | |
| if (randomStatus === 'Excellent') { | |
| statusElement.className = 'text-green-600'; | |
| } else if (randomStatus === 'Good') { | |
| statusElement.className = 'text-blue-600'; | |
| } else if (randomStatus === 'Fair') { | |
| statusElement.className = 'text-yellow-600'; | |
| } else if (randomStatus === 'Poor') { | |
| statusElement.className = 'text-orange-600'; | |
| } else { | |
| statusElement.className = 'text-red-600'; | |
| } | |
| }, 10000); | |
| </script> | |
| <p style="border-radius: 8px; text-align: center; font-size: 12px; color: #fff; margin-top: 16px;position: fixed; left: 8px; bottom: 8px; z-index: 10; background: rgba(0, 0, 0, 0.8); padding: 4px 8px;">Made with <img src="https://enzostvs-deepsite.hf.space/logo.svg" alt="DeepSite Logo" style="width: 16px; height: 16px; vertical-align: middle;display:inline-block;margin-right:3px;filter:brightness(0) invert(1);"><a href="https://enzostvs-deepsite.hf.space" style="color: #fff;text-decoration: underline;" target="_blank" >DeepSite</a> - 🧬 <a href="https://enzostvs-deepsite.hf.space?remix=guiarantes98/whats" style="color: #fff;text-decoration: underline;" target="_blank" >Remix</a></p></body> | |
| </html> |