Spaces:
Running
Running
Update index.html
Browse files1234125 unmodified lines1301311321331341353 unmodified lines13914014114214314414514614714814915015115215315415512 unmodified lines1681691701711721731 unmodified line1751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062071 unmodified line20921021121221321421521621721821922022122222322422522622722822912 unmodified lines24224324424524624724854 unmodified lines303304305306307308309310311<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">125 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;3 unmodified lines<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"><div class="typing-indicator" id="typing-indicator"><span></span><span></span><span></span></div></div><div id="chat-input">12 unmodified lines</div></div><script>const chatMessages = document.getElementById('chat-messages');const userInput = document.getElementById('user-input');1 unmodified lineconst fileButton = document.getElementById('file-button');const fileInput = document.getElementById('file-input');const typingIndicator = document.getElementById('typing-indicator');// 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';}function addMessage(content, isUser, imageData = null) {const messageDiv = document.createElement('div');messageDiv.classList.add('message');messageDiv.classList.add(isUser ? 'user-message' : 'ai-message');if (imageData) {const img = document.createElement('img');1 unmodified lineimg.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);chatMessages.scrollTop = chatMessages.scrollHeight;}async function sendMessageToBackend(message, imageData = null) {try {showTypingIndicator();const formData = new FormData();// Encode le message avant l'envoiformData.append('message', encodeMessage(message));if (imageData) {formData.append('image', imageData);}12 unmodified linesif (data.response) {// Décode la réponse du serveuraddMessage(decodeMessage(data.response), false);}} catch (error) {console.error('Erreur:', error);54 unmodified lines}});// Initialisationwindow.onload = () => {addMessage("Bonjour ! 👋 Je suis votre assistant virtuel. Comment puis-je vous aider aujourd'hui ?", false);};</script></body></html>1234125 unmodified lines1301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621633 unmodified lines16716816917017117217317417517617717817918018118218318418518612 unmodified lines1992002012022032042052062072082091 unmodified line2112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642651 unmodified line26726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830912 unmodified lines32232332432532632732854 unmodified lines383384385386387388389390391392393394395396397398399400401402403404405406<!DOCTYPE html><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">125 unmodified linesmax-width: 600px;}}/* New styles for appointments and history */.appointment-card {background: #fff;border-radius: 10px;padding: 15px;margin: 10px 0;box-shadow: 0 2px 5px rgba(0,0,0,0.1);}.history-button {display: none; /* Hide the history button */}.history-panel {position: fixed;right: -300px; /* Keep it offscreen by default */top: 0;width: 300px;height: 100%;background: white;box-shadow: -2px 0 5px rgba(0,0,0,0.2);transition: right 0.3s ease;z-index: 1000;padding: 20px;display: none; /* Hide it completely */}.history-panel.active {right: 0;display: block; /* Show only when active */}/* 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;3 unmodified lines<body><div id="chat-container"><div id="chat-header"><img src="https://cdn-icons-png.flaticon.com/512/4712/4712109.png" alt="Logo zone - corporate stylized icon with square background" style="width: 40px; height: 40px; object-fit: cover; border-radius: 5px;"><h1>ASSISTANT AI +226 56888879<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; transform: translateY(-0.5mm);" title="Assistant IA Vérifié">✓</span></h1><button class="history-button" id="history-button"><svg width="24" height="24" viewBox="0 0 24 24" fill="white"><path d="M13 3c-4.97 0-9 4.03-9 9H1l3.89 3.89.07.14L9 12H6c0-3.87 3.13-7 7-7s7 3.13 7 7-3.13 7-7 7c-1.93 0-3.68-.79-4.94-2.06l-1.42 1.42C8.27 19.99 10.51 21 13 21c4.97 0 9-4.03 9-9s-4.03-9-9-9zm-1 5v5l4.25 2.52.77-1.28-3.52-2.09V8z"></path></svg></button></div><div id="chat-messages"><div class="typing-indicator" id="typing-indicator"><span></span><span></span><span></span></div></div><div id="chat-input">12 unmodified lines</div></div><div class="history-panel" id="history-panel"><h2>Historique des conversations</h2><div id="conversation-history"></div></div><script>const chatMessages = document.getElementById('chat-messages');const userInput = document.getElementById('user-input');1 unmodified lineconst fileButton = document.getElementById('file-button');const fileInput = document.getElementById('file-input');const typingIndicator = document.getElementById('typing-indicator');const historyButton = document.getElementById('history-button');const historyPanel = document.getElementById('history-panel');const BACKEND_URL = 'http://your-backend-url/api';// Store conversation historylet conversationHistory = [];// Welcome messagesconst welcomeMessages = ["Bonjour! 👋 Je suis votre assistant virtuel. Comment puis-je vous aider aujourd'hui?","Je peux vous aider à prendre des rendez-vous, répondre à vos questions, et plus encore!","N'hésitez pas à partager des images ou à me poser des questions."];function saveToHistory(message, isUser) {const timestamp = new Date().toISOString();conversationHistory.push({message,isUser,timestamp});localStorage.setItem('chatHistory', JSON.stringify(conversationHistory));updateHistoryPanel();}function updateHistoryPanel() {const historyContainer = document.getElementById('conversation-history');historyContainer.innerHTML = '';conversationHistory.forEach(item => {const messageDiv = document.createElement('div');messageDiv.classList.add('history-message');const date = new Date(item.timestamp).toLocaleString();messageDiv.innerHTML = `<small>${date}</small><br><strong>${item.isUser ? 'Vous' : 'Assistant'}</strong>: ${item.message}`;historyContainer.appendChild(messageDiv);});}historyButton.addEventListener('click', () => {historyPanel.classList.toggle('active');});function addMessage(content, isUser, imageData = null) {const messageDiv = document.createElement('div');messageDiv.classList.add('message', isUser ? 'user-message' : 'ai-message');if (imageData) {const img = document.createElement('img');1 unmodified lineimg.alt = 'Image envoyée';messageDiv.appendChild(img);} else {messageDiv.textContent = content;}chatMessages.appendChild(messageDiv);chatMessages.scrollTop = chatMessages.scrollHeight;// Save to historysaveToHistory(imageData ? '[Image]' : content, isUser);}// Load history from localStoragefunction loadHistory() {const savedHistory = localStorage.getItem('chatHistory');if (savedHistory) {conversationHistory = JSON.parse(savedHistory);updateHistoryPanel();}}// Initializewindow.onload = () => {loadHistory();// Display welcome messages with delaywelcomeMessages.forEach((message, index) => {setTimeout(() => {addMessage(message, false);}, index * 1000);});};async function sendMessageToBackend(message, imageData = null) {try {showTypingIndicator();const formData = new FormData();// Encode le message avant l'envoiformData.append('message', encodeURIComponent(message));if (imageData) {formData.append('image', imageData);}12 unmodified linesif (data.response) {// Décode la réponse du serveuraddMessage(decodeURIComponent(data.response), false);}} catch (error) {console.error('Erreur:', error);54 unmodified lines}});// 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';}</script></body></html>
index.html+128-33