Spaces:
Running
Running
Update index.html
Browse files12345678910111213141537 unmodified lines53545556575815 unmodified lines74757677787946 unmodified lines1261271281291301311321331341351361371381391401411421431441451461471481491504 unmodified lines15515615715815916016116216316416516616716812 unmodified lines1811821831841851861871881891901911921936 unmodified lines2002012022032042052062072082095 unmodified lines2152162172182192202214 unmodified lines22622722822923023123223323423523623723823924024124224324422 unmodified lines26726826927027127227321 unmodified lines295296297298299300301302<html><head><base href="https://WhatsApp/ai.com"><title>AI-Powered WhatsApp Chat with Image Upload</title><meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no"><meta name="theme-color" content="#075e54"><meta name="apple-mobile-web-app-capable" content="yes"><meta name="apple-mobile-web-app-status-bar-style" content="black-translucent"><style>/* Styles restent identiques */body, html {margin: 0;padding: 0;font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;background-color: #e5ddd5;height: 100%;overflow: hidden;37 unmodified linespadding: 8px 12px;border-radius: 7.5px;position: relative;}.user-message {background-color: #dcf8c6;15 unmodified linespadding: 10px;border-radius: 20px;margin-right: 10px;}#send-button, #file-button {background-color: #075e54;46 unmodified linesmax-width: 600px;}}</style><script>window.CONFIG = {companyName: 'Guy+22656888879',apiUrl: 'https://huggyguyjo01-testbakend.hf.space',dashboardUrl: 'https://huggyguyjo01-testdashbord.static.hf.space',chatUrl: 'https://huggyguyjo01-testchat.static.hf.space'};</script></head><body><div id="chat-container"><div id="chat-header"><img src="https://cdn-icons-png.flaticon.com/512/4712/4712109.png" alt="Clipart of a customer assistant with headset"><h1>AI Assistant<span style="display: inline-block; margin-left: 5px; background-color: #0099ff; color: white; font-size: 0.6em; padding: 2px 5px; border-radius: 50%; vertical-align: middle;" title="Verified AI Assistant">✓</span></h1></div><div id="chat-messages">4 unmodified lines</div></div><div id="chat-input"><input type="text" id="user-input" placeholder="Type a message"><button id="file-button"><svg viewBox="0 0 24 24"><path d="M16.5 6v11.5c0 2.21-1.79 4-4 4s-4-1.79-4-4V5a2.5 2.5 0 0 1 5 0v10.5c0 .55-.45 1-1 1s-1-.45-1-1V6H10v9.5a2.5 2.5 0 0 0 5 0V5c0-2.21-1.79-4-4-4S7 2.79 7 5v12.5c0 3.04 2.46 5.5 5.5 5.5s5.5-2.46 5.5-5.5V6h-1.5z"></path></svg></button><input type="file" id="file-input" accept="image/*"><button id="send-button"><svg viewBox="0 0 24 24"><path d="M1.101 21.757 23.8 12.028 1.101 2.3l.011 7.912 13.623 1.816-13.623 1.817-.011 7.912z"></path></svg>12 unmodified lines// URL du backend Pythonconst BACKEND_URL = 'http://your-backend-url/api';// Fonction pour afficher l'indicateur de frappefunction showTypingIndicator() {typingIndicator.style.display = 'block';chatMessages.scrollTop = chatMessages.scrollHeight;}// Fonction pour masquer l'indicateur de frappefunction hideTypingIndicator() {typingIndicator.style.display = 'none';}6 unmodified linesif (imageData) {const img = document.createElement('img');img.src = imageData;img.alt = 'Uploaded image';messageDiv.appendChild(img);} else {messageDiv.textContent = content;}chatMessages.appendChild(messageDiv);5 unmodified linesshowTypingIndicator();const formData = new FormData();formData.append('message', message);if (imageData) {formData.append('image', imageData);}4 unmodified lines});if (!response.ok) {throw new Error('Network response was not ok');}const data = await response.json();hideTypingIndicator();if (data.response) {addMessage(data.response, false);}} catch (error) {console.error('Error:', error);hideTypingIndicator();addMessage("Je suis désolé, une erreur s'est produite. Veuillez réessayer.", false);}}22 unmodified linessendButton.addEventListener('click', sendMessage);userInput.addEventListener('keypress', (e) => {if (e.key === 'Enter') {sendMessage();}});21 unmodified lines// Initialisationwindow.onload = () => {// Vous pouvez ajouter ici un message de bienvenue initial si nécessaireaddMessage("Bonjour ! Je suis votre assistant virtuel. Comment puis-je vous aider aujourd'hui ?", false);};</script></body></html>1234567891011121314151637 unmodified lines545556575859606115 unmodified lines7778798081828346 unmodified lines1301311321331341351361371381391401411421431441451461471484 unmodified lines15315415515615715815916016116216316416516612 unmodified lines1791801811821831841851861871881891901911921931941951961971981996 unmodified lines2062072082092102112122132142152165 unmodified lines2222232242252262272282294 unmodified lines23423523623723823924024124224324424524624724824925025125225322 unmodified lines27627727827928028128228321 unmodified lines305306307308309310311<html><head><base href="https://WhatsApp/ai.com"><meta charset="UTF-8"><title>AI-Powered WhatsApp Chat with Image Upload</title><meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no"><meta name="theme-color" content="#075e54"><meta name="apple-mobile-web-app-capable" content="yes"><meta name="apple-mobile-web-app-status-bar-style" content="black-translucent"><style>/* Les styles restent identiques */body, html {margin: 0;padding: 0;font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;background-color: #e5ddd5;height: 100%;overflow: hidden;37 unmodified linespadding: 8px 12px;border-radius: 7.5px;position: relative;word-wrap: break-word;overflow-wrap: break-word;}.user-message {background-color: #dcf8c6;15 unmodified linespadding: 10px;border-radius: 20px;margin-right: 10px;font-size: 14px;}#send-button, #file-button {background-color: #075e54;46 unmodified linesmax-width: 600px;}}/* Ajout de styles pour le support des emojis */.emoji {font-family: "Segoe UI Emoji", "Noto Color Emoji", "Apple Color Emoji", "Segoe UI Symbol", sans-serif;}</style></head><body><div id="chat-container"><div id="chat-header"><img src="https://cdn-icons-png.flaticon.com/512/4712/4712109.png" alt="Clipart of a customer assistant with headset"><h1>AI Assistant<span style="display: inline-block; margin-left: 5px; background-color: #0099ff; color: white; font-size: 0.6em; padding: 2px 5px; border-radius: 50%; vertical-align: middle;" title="Assistant IA Vérifié">✓</span></h1></div><div id="chat-messages">4 unmodified lines</div></div><div id="chat-input"><input type="text" id="user-input" placeholder="Écrivez votre message"><button id="file-button" title="Joindre une image"><svg viewBox="0 0 24 24"><path d="M16.5 6v11.5c0 2.21-1.79 4-4 4s-4-1.79-4-4V5a2.5 2.5 0 0 1 5 0v10.5c0 .55-.45 1-1 1s-1-.45-1-1V6H10v9.5a2.5 2.5 0 0 0 5 0V5c0-2.21-1.79-4-4-4S7 2.79 7 5v12.5c0 3.04 2.46 5.5 5.5 5.5s5.5-2.46 5.5-5.5V6h-1.5z"></path></svg></button><input type="file" id="file-input" accept="image/*"><button id="send-button" title="Envoyer"><svg viewBox="0 0 24 24"><path d="M1.101 21.757 23.8 12.028 1.101 2.3l.011 7.912 13.623 1.816-13.623 1.817-.011 7.912z"></path></svg>12 unmodified lines// URL du backend Pythonconst BACKEND_URL = 'http://your-backend-url/api';// Fonction pour encoder correctement les caractères spéciauxfunction encodeMessage(message) {return encodeURIComponent(message);}// Fonction pour décoder les caractères spéciauxfunction decodeMessage(message) {return decodeURIComponent(message);}function showTypingIndicator() {typingIndicator.style.display = 'block';chatMessages.scrollTop = chatMessages.scrollHeight;}function hideTypingIndicator() {typingIndicator.style.display = 'none';}6 unmodified linesif (imageData) {const img = document.createElement('img');img.src = imageData;img.alt = 'Image envoyée';messageDiv.appendChild(img);} else {// Décode le contenu pour afficher correctement les caractères spéciauxmessageDiv.textContent = decodeMessage(content);}chatMessages.appendChild(messageDiv);5 unmodified linesshowTypingIndicator();const formData = new FormData();// Encode le message avant l'envoiformData.append('message', encodeMessage(message));if (imageData) {formData.append('image', imageData);}4 unmodified lines});if (!response.ok) {throw new Error('Erreur réseau');}const data = await response.json();hideTypingIndicator();if (data.response) {// Décode la réponse du serveuraddMessage(decodeMessage(data.response), false);}} catch (error) {console.error('Erreur:', error);hideTypingIndicator();addMessage("Désolé, une erreur s'est produite. Veuillez réessayer.", false);}}22 unmodified linessendButton.addEventListener('click', sendMessage);userInput.addEventListener('keypress', (e) => {if (e.key === 'Enter' && !e.shiftKey) {e.preventDefault();sendMessage();}});21 unmodified lines// Initialisationwindow.onload = () => {addMessage("Bonjour ! 👋 Je suis votre assistant virtuel. Comment puis-je vous aider aujourd'hui ?", false);};</script></body></html>
index.html+39-30