Spaces:
Running
Running
The message bubbles should be uniform in size - Initial Deployment
Browse filesFiles changed (2)
- README.md+7-5
- index.html+363-18
12345678910---title: Codebuddy Interfaceemoji: 💻colorFrom: indigocolorTo: purplesdk: staticpinned: false---Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference123456789101112---title: codebuddy-interfaceemoji: 🐳colorFrom: bluecolorTo: yellowsdk: staticpinned: falsetags:- deepsite---Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
12345678910111213141516171819<!doctype html><html><head><meta charset="utf-8" /><meta name="viewport" content="width=device-width" /><title>My static Space</title><link rel="stylesheet" href="style.css" /></head><body><div class="card"><h1>Welcome to your static Space!</h1><p>You can modify this app directly by editing <i>index.html</i> in the Files and versions tab.</p><p>Also don't forget to check the<a href="https://huggingface.co/docs/hub/spaces" target="_blank">Spaces documentation</a>.</p></div></body></html>123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364<!DOCTYPE html><html lang="pt-br"><head><meta charset="UTF-8" /><meta name="viewport" content="width=device-width, initial-scale=1" /><title>CodeBuddy - Seu Brother Programador</title><link href="https://fonts.googleapis.com/css2?family=Poppins:wght@400;600;700&display=swap" rel="stylesheet" /><link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0/css/all.min.css" /><style>body {font-family: 'Poppins', sans-serif;background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);padding: 0;max-width: 100%;margin: auto;color: #212529;display: flex;flex-direction: column;height: 100vh;}header {background: white;padding: 0.1rem 0.5rem;box-shadow: 0 1px 3px rgba(0,0,0,0.1);position: sticky;top: 0;z-index: 100;}.header-content {display: flex;align-items: center;justify-content: space-between;}.profile-section {display: flex;gap: 0.8rem;}.profile-btn, .settings-btn {background: #4361ee;color: white;border: none;width: 30px;height: 30px;border-radius: 50%;display: flex;align-items: center;justify-content: center;cursor: pointer;transition: all 0.3s ease;font-size: 0.8rem;}.profile-btn:hover, .settings-btn:hover {background: #3f37c9;transform: scale(1.1);}.title-section {text-align: center;flex-grow: 1;}h1 {font-size: 1.5rem;font-weight: 700;background: linear-gradient(to right, #4361ee, #f72585);-webkit-background-clip: text;background-clip: text;color: transparent;margin: 0;}#chat {flex: 1;overflow-y: auto;background: #fff;padding: 0.5rem 1rem;margin: 0;height: calc(100vh - 150px);transition: all 0.3s ease;margin-bottom: 80px; /* Space for input box */}#chat:hover {box-shadow: 0 8px 25px rgba(0,0,0,0.15);}.message {max-width: 80%;padding: 0.8rem 1rem;margin-bottom: 0.8rem;border-radius: 1.15rem;line-height: 1.4;word-wrap: break-word;white-space: pre-wrap;opacity: 0;transform: translateY(10px);animation: fadeIn 0.3s ease forwards;position: relative;min-width: 0;width: fit-content;}@keyframes fadeIn {to {opacity: 1;transform: translateY(0);}}.message:hover {box-shadow: 0 2px 5px rgba(0,0,0,0.1);}.user {background: #4361ee;color: white;margin-left: auto;margin-right: 1rem;border-radius: 1.15rem 1.15rem 0 1.15rem;box-shadow: 0 1px 1px rgba(0,0,0,0.1);}.assistant {background: #f1f1f1;color: #212529;margin-right: auto;margin-left: 1rem;border-radius: 1.15rem 1.15rem 1.15rem 0;box-shadow: 0 1px 1px rgba(0,0,0,0.05);}textarea {flex: 1;min-height: 50px;max-height: 10px;padding: 0.5rem 1rem;border-radius: 25px;border: 1px solid #ccc;resize: none;font-size: 0.9rem;margin-right: 0.5rem;box-sizing: border-box;font-family: inherit;background-color: rgba(255, 255, 255, 0.7);backdrop-filter: blur(5px);}button#send {width: 50px;height: 50px;padding: 0;background: #4361ee;color: white;border: none;border-radius: 50%;cursor: pointer;transition: background 0.3s ease;display: flex;align-items: center;justify-content: center;}button:hover {background: #3f37c9;}.input-container {position: fixed;bottom: 0;left: 0;right: 0;padding: 1rem;background: white;display: flex;align-items: center;box-shadow: 0 -2px 10px rgba(0,0,0,0.1);}#loading {font-style: italic;margin-bottom: 0.5rem;text-align: center;display: none;color: #212529;}pre {position: relative;background: #2d2d2d;color: #f8f8f2;padding: 1rem;border-radius: 10px;overflow-x: auto;white-space: pre-wrap;margin: 0.4rem 0;font-family: monospace, monospace;}pre button.copy-btn {position: absolute;top: 5px;right: 5px;padding: 0.3rem 0.6rem;font-size: 0.75rem;cursor: pointer;border: none;border-radius: 5px;background: #4361ee;color: white;transition: background 0.3s ease;}pre button.copy-btn:hover {background: #3f37c9;}</style></head><body><header><div class="header-content"><div class="profile-section"><button class="profile-btn"><i class="fas fa-user"></i></button><button class="settings-btn"><i class="fas fa-cog"></i></button></div><div class="title-section"><h1>CodeBuddy AI</h1></div></div></header><div id="chat"><div class="message assistant">E aí, brother! Bora aprender uns códigos juntos? Manda sua dúvida aí embaixo! 👆</div></div><div class="input-container"><textarea id="input" placeholder="Digite sua dúvida de programação aqui..."></textarea><button id="send"><i class="fas fa-paper-plane"></i></button></div><div id="loading">CodeBuddy tá pensando... 🤔</div><script>const chat = document.getElementById('chat');const input = document.getElementById('input');const send = document.getElementById('send');const loading = document.getElementById('loading');let mensagens = [{role: "assistant",content: "E aí, brother! Bora aprender uns códigos juntos? Manda sua dúvida aí embaixo! 👆"}];function criarBlocoCodigo(codeContent) {const pre = document.createElement('pre');pre.textContent = codeContent;const btnCopy = document.createElement('button');btnCopy.classList.add('copy-btn');btnCopy.textContent = 'Copiar código';btnCopy.addEventListener('click', () => {navigator.clipboard.writeText(codeContent);btnCopy.textContent = 'Copiado!';setTimeout(() => btnCopy.textContent = 'Copiar código', 2000);});pre.appendChild(btnCopy);return pre;}function adicionarMensagem(role, texto) {const div = document.createElement('div');div.classList.add('message', role);if (role === 'assistant') {// For assistant messages, show typing animationlet i = 0;div.textContent = '';chat.appendChild(div);const typeWriter = () => {if (i < texto.length) {div.textContent += texto.charAt(i);i++;chat.scrollTop = chat.scrollHeight;setTimeout(typeWriter, 20); // Adjust typing speed here}};typeWriter();} else {// User messages appear instantlyconst codeRegex = /```([\s\S]*?)```/g;if (codeRegex.test(texto)) {let lastIndex = 0;const fragment = document.createDocumentFragment();texto.replace(codeRegex, (match, codeContent, offset) => {const beforeText = texto.substring(lastIndex, offset);if (beforeText.trim()) {const p = document.createElement('p');p.textContent = beforeText;fragment.appendChild(p);}const blocoCodigo = criarBlocoCodigo(codeContent.trim());fragment.appendChild(blocoCodigo);lastIndex = offset + match.length;});const afterText = texto.substring(lastIndex);if (afterText.trim()) {const p = document.createElement('p');p.textContent = afterText;fragment.appendChild(p);}div.appendChild(fragment);} else {div.textContent = texto;}chat.appendChild(div);chat.scrollTop = chat.scrollHeight;}}async function enviar() {const pergunta = input.value.trim();if (!pergunta) return;adicionarMensagem('user', pergunta);mensagens.push({ role: 'user', content: pergunta });input.value = '';loading.style.display = 'block';try {const res = await fetch('/perguntar', {method: 'POST',headers: { 'Content-Type': 'application/json' },body: JSON.stringify({ mensagens })});const data = await res.json();loading.style.display = 'none';adicionarMensagem('assistant', data.resposta);mensagens.push({ role: 'assistant', content: data.resposta });} catch (error) {loading.style.display = 'none';adicionarMensagem('assistant', 'Deu ruim aqui, tenta de novo mais tarde! 😓');console.error('Erro:', error);}}send.addEventListener('click', enviar);input.addEventListener('keypress', (e) => {if (e.key === 'Enter' && !e.shiftKey) {e.preventDefault();enviar();}});</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=manoperna/codebuddy-interface" style="color: #fff;text-decoration: underline;" target="_blank" >Remix</a></p></body></html>
README.md+7-5
index.html+363-18