Spaces:
Running
Running
je veux que ma deuxieme colonne soit un chat IA
Browse files- index.html +82 -32
- style.css +15 -5
index.html
CHANGED
|
@@ -91,30 +91,29 @@
|
|
| 91 |
<span class="text-xs px-3 py-1 rounded-full bg-gray-800 border border-gray-700 text-gray-400">Projet</span>
|
| 92 |
<span class="text-xs px-3 py-1 rounded-full bg-gray-800 border border-gray-700 text-gray-400">/</span>
|
| 93 |
</div>
|
| 94 |
-
<div class="flex-1 flex flex-col
|
| 95 |
-
<
|
| 96 |
-
|
| 97 |
-
|
| 98 |
-
|
| 99 |
-
<button class="p-2 rounded-lg hover:bg-gray-700 text-gray-400 hover:text-gray-200">
|
| 100 |
-
<i data-feather="plus" class="w-5 h-5"></i>
|
| 101 |
-
</button>
|
| 102 |
-
<button class="p-2 rounded-lg hover:bg-gray-700 text-gray-400 hover:text-gray-200">
|
| 103 |
-
<i data-feather="paperclip" class="w-5 h-5"></i>
|
| 104 |
-
</button>
|
| 105 |
-
|
| 106 |
-
<input type="text" placeholder="Rechercher / écrire..."
|
| 107 |
-
class="flex-1 bg-transparent px-3 py-2 focus:outline-none text-sm">
|
| 108 |
-
|
| 109 |
-
<button class="p-2 rounded-lg hover:bg-gray-700 text-gray-400 hover:text-gray-200">
|
| 110 |
-
<i data-feather="mic" class="w-5 h-5"></i>
|
| 111 |
-
</button>
|
| 112 |
-
<button class="p-2 rounded-lg bg-blue-600 hover:bg-blue-500 text-white disabled:opacity-50" disabled>
|
| 113 |
-
<i data-feather="send" class="w-5 h-5"></i>
|
| 114 |
-
</button>
|
| 115 |
</div>
|
| 116 |
-
|
| 117 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 118 |
|
| 119 |
<!-- Preview Panel -->
|
| 120 |
<aside class="w-96 bg-gray-800 border-l border-gray-700 flex flex-col">
|
|
@@ -154,18 +153,9 @@
|
|
| 154 |
</div>
|
| 155 |
</aside>
|
| 156 |
</div>
|
| 157 |
-
|
| 158 |
<script>
|
| 159 |
feather.replace();
|
| 160 |
|
| 161 |
-
// Simple interaction for the message input
|
| 162 |
-
const messageInput = document.querySelector('main input');
|
| 163 |
-
const sendButton = document.querySelector('main button:disabled');
|
| 164 |
-
|
| 165 |
-
messageInput.addEventListener('input', () => {
|
| 166 |
-
sendButton.disabled = messageInput.value.trim() === '';
|
| 167 |
-
});
|
| 168 |
-
|
| 169 |
// Navigation items active state
|
| 170 |
const navItems = document.querySelectorAll('nav a');
|
| 171 |
navItems.forEach(item => {
|
|
@@ -174,6 +164,66 @@
|
|
| 174 |
item.classList.add('bg-blue-900/30', 'border-blue-800/50', 'text-blue-200');
|
| 175 |
});
|
| 176 |
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 177 |
</script>
|
| 178 |
<script src="https://huggingface.co/deepsite/deepsite-badge.js"></script>
|
| 179 |
</body>
|
|
|
|
| 91 |
<span class="text-xs px-3 py-1 rounded-full bg-gray-800 border border-gray-700 text-gray-400">Projet</span>
|
| 92 |
<span class="text-xs px-3 py-1 rounded-full bg-gray-800 border border-gray-700 text-gray-400">/</span>
|
| 93 |
</div>
|
| 94 |
+
<div class="flex-1 flex flex-col p-4 overflow-y-auto" id="chatContainer">
|
| 95 |
+
<div class="flex-1 overflow-y-auto p-2 flex flex-col gap-3" id="chatMessages">
|
| 96 |
+
<div class="msg bg-gray-700/50 border border-gray-700 p-3 rounded-xl max-w-[80%]">
|
| 97 |
+
Bonjour 👋 Je suis votre assistant IA. Comment puis-je vous aider avec votre projet aujourd'hui ?
|
| 98 |
+
</div>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 99 |
</div>
|
| 100 |
+
<div class="p-3 border-t border-gray-700 bg-gray-850">
|
| 101 |
+
<div class="flex items-center gap-2 p-2 rounded-xl bg-gray-800 border border-gray-700">
|
| 102 |
+
<button id="chatMicBtn" class="p-2 rounded-lg hover:bg-gray-700 text-gray-400 hover:text-gray-200">
|
| 103 |
+
<i data-feather="mic" class="w-5 h-5"></i>
|
| 104 |
+
</button>
|
| 105 |
+
<input id="chatInput" placeholder="Écrivez votre message..."
|
| 106 |
+
class="flex-1 bg-transparent px-3 py-2 focus:outline-none text-sm">
|
| 107 |
+
<button id="chatSendBtn" class="p-2 rounded-lg bg-blue-600 hover:bg-blue-500 text-white">
|
| 108 |
+
<i data-feather="send" class="w-5 h-5"></i>
|
| 109 |
+
</button>
|
| 110 |
+
</div>
|
| 111 |
+
<div class="text-xs text-gray-500 mt-2 flex justify-between">
|
| 112 |
+
<span id="chatStatus">Prêt</span>
|
| 113 |
+
<span>Assistant IA v1.0</span>
|
| 114 |
+
</div>
|
| 115 |
+
</div>
|
| 116 |
+
</main>
|
| 117 |
|
| 118 |
<!-- Preview Panel -->
|
| 119 |
<aside class="w-96 bg-gray-800 border-l border-gray-700 flex flex-col">
|
|
|
|
| 153 |
</div>
|
| 154 |
</aside>
|
| 155 |
</div>
|
|
|
|
| 156 |
<script>
|
| 157 |
feather.replace();
|
| 158 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 159 |
// Navigation items active state
|
| 160 |
const navItems = document.querySelectorAll('nav a');
|
| 161 |
navItems.forEach(item => {
|
|
|
|
| 164 |
item.classList.add('bg-blue-900/30', 'border-blue-800/50', 'text-blue-200');
|
| 165 |
});
|
| 166 |
});
|
| 167 |
+
|
| 168 |
+
// Chat functionality
|
| 169 |
+
const chatMessages = document.getElementById('chatMessages');
|
| 170 |
+
const chatInput = document.getElementById('chatInput');
|
| 171 |
+
const chatSendBtn = document.getElementById('chatSendBtn');
|
| 172 |
+
const chatMicBtn = document.getElementById('chatMicBtn');
|
| 173 |
+
const chatStatus = document.getElementById('chatStatus');
|
| 174 |
+
|
| 175 |
+
function addChatMessage(text, isUser = false) {
|
| 176 |
+
const msgDiv = document.createElement('div');
|
| 177 |
+
msgDiv.className = `msg ${isUser ?
|
| 178 |
+
'ml-auto bg-blue-900/10 border-blue-800/50' :
|
| 179 |
+
'bg-gray-700/50 border-gray-700'} p-3 rounded-xl max-w-[80%]`;
|
| 180 |
+
msgDiv.textContent = text;
|
| 181 |
+
chatMessages.appendChild(msgDiv);
|
| 182 |
+
chatMessages.scrollTop = chatMessages.scrollHeight;
|
| 183 |
+
}
|
| 184 |
+
|
| 185 |
+
function getAIResponse(userText) {
|
| 186 |
+
const t = userText.toLowerCase();
|
| 187 |
+
if (t.includes('bonjour') || t.includes('salut')) {
|
| 188 |
+
return "Bonjour ! Comment puis-je vous aider avec votre projet de codage aujourd'hui ?";
|
| 189 |
+
}
|
| 190 |
+
if (t.includes('projet') || t.includes('commencer')) {
|
| 191 |
+
return "Pour commencer un nouveau projet, vous pouvez :\n1. Cliquer sur le bouton '+' dans la barre latérale\n2. Choisir un type de projet\n3. Donner un nom à votre projet";
|
| 192 |
+
}
|
| 193 |
+
if (t.includes('aide') || t.includes('problème')) {
|
| 194 |
+
return "Je peux vous aider à résoudre des problèmes de code. Décrivez-moi l'erreur ou ce que vous essayez d'accomplir.";
|
| 195 |
+
}
|
| 196 |
+
if (t.includes('image') || t.includes('baleine')) {
|
| 197 |
+
return "Pour générer des images, vous pouvez utiliser La Baleine IA disponible dans le menu de gauche.";
|
| 198 |
+
}
|
| 199 |
+
return "Je peux vous aider avec :\n- Projets de codage\n- Génération d'images\n- Résolution de problèmes\n- Conseils techniques\nDites-moi plus précisément ce dont vous avez besoin !";
|
| 200 |
+
}
|
| 201 |
+
|
| 202 |
+
function handleChatSend() {
|
| 203 |
+
const message = chatInput.value.trim();
|
| 204 |
+
if (!message) return;
|
| 205 |
+
|
| 206 |
+
addChatMessage(message, true);
|
| 207 |
+
chatInput.value = '';
|
| 208 |
+
|
| 209 |
+
setTimeout(() => {
|
| 210 |
+
const response = getAIResponse(message);
|
| 211 |
+
addChatMessage(response);
|
| 212 |
+
}, 800);
|
| 213 |
+
}
|
| 214 |
+
|
| 215 |
+
chatSendBtn.addEventListener('click', handleChatSend);
|
| 216 |
+
chatInput.addEventListener('keydown', (e) => {
|
| 217 |
+
if (e.key === 'Enter') handleChatSend();
|
| 218 |
+
});
|
| 219 |
+
|
| 220 |
+
// Microphone functionality (simplified)
|
| 221 |
+
chatMicBtn.addEventListener('click', () => {
|
| 222 |
+
chatStatus.textContent = 'Micro: non implémenté';
|
| 223 |
+
setTimeout(() => {
|
| 224 |
+
chatStatus.textContent = 'Prêt';
|
| 225 |
+
}, 2000);
|
| 226 |
+
});
|
| 227 |
</script>
|
| 228 |
<script src="https://huggingface.co/deepsite/deepsite-badge.js"></script>
|
| 229 |
</body>
|
style.css
CHANGED
|
@@ -83,19 +83,29 @@ input:focus, button:focus {
|
|
| 83 |
font-size: 0.875rem;
|
| 84 |
}
|
| 85 |
/* Chat message styles */
|
| 86 |
-
|
| 87 |
-
|
|
|
|
| 88 |
padding: 1rem;
|
| 89 |
-
|
|
|
|
|
|
|
| 90 |
}
|
| 91 |
|
| 92 |
-
.
|
|
|
|
|
|
|
| 93 |
padding: 0.75rem 1rem;
|
| 94 |
border-radius: 0.75rem;
|
| 95 |
max-width: 80%;
|
| 96 |
-
|
| 97 |
}
|
| 98 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 99 |
/* Microphone animation */
|
| 100 |
@keyframes pulse {
|
| 101 |
0%, 100% {
|
|
|
|
| 83 |
font-size: 0.875rem;
|
| 84 |
}
|
| 85 |
/* Chat message styles */
|
| 86 |
+
#chatMessages {
|
| 87 |
+
flex: 1;
|
| 88 |
+
overflow-y: auto;
|
| 89 |
padding: 1rem;
|
| 90 |
+
display: flex;
|
| 91 |
+
flex-direction: column;
|
| 92 |
+
gap: 0.75rem;
|
| 93 |
}
|
| 94 |
|
| 95 |
+
.msg {
|
| 96 |
+
word-break: break-word;
|
| 97 |
+
white-space: pre-wrap;
|
| 98 |
padding: 0.75rem 1rem;
|
| 99 |
border-radius: 0.75rem;
|
| 100 |
max-width: 80%;
|
| 101 |
+
border: 1px solid;
|
| 102 |
}
|
| 103 |
|
| 104 |
+
#chatContainer {
|
| 105 |
+
display: flex;
|
| 106 |
+
flex-direction: column;
|
| 107 |
+
height: 100%;
|
| 108 |
+
}
|
| 109 |
/* Microphone animation */
|
| 110 |
@keyframes pulse {
|
| 111 |
0%, 100% {
|