askbyte commited on
Commit
2d74b8f
·
verified ·
1 Parent(s): 76e5973

Update index.html

Browse files
Files changed (1) hide show
  1. index.html +63 -99
index.html CHANGED
@@ -1,99 +1,63 @@
1
- /**
2
- * Ejemplo de código para integrar BITER en justbyte.es
3
- * Este archivo muestra cómo implementar la comunicación con la API de BITER
4
- * desde tu sitio web.
5
- */
6
-
7
- // URL de tu Hugging Face Space
8
- const BITER_API_URL = "https://tu-usuario-huggingface.hf.space/generate"
9
-
10
- // Elementos del DOM
11
- const chatForm = document.getElementById("chat-form")
12
- const userInput = document.getElementById("user-input")
13
- const chatMessages = document.getElementById("chat-messages")
14
- const loadingIndicator = document.getElementById("loading-indicator")
15
-
16
- // Manejar envío del formulario
17
- chatForm.addEventListener("submit", async (e) => {
18
- e.preventDefault()
19
-
20
- // Obtener mensaje del usuario
21
- const userMessage = userInput.value.trim()
22
- if (!userMessage) return
23
-
24
- // Limpiar input
25
- userInput.value = ""
26
-
27
- // Mostrar mensaje del usuario
28
- appendMessage("user", userMessage)
29
-
30
- // Mostrar indicador de carga
31
- loadingIndicator.style.display = "block"
32
-
33
- try {
34
- // Enviar solicitud a la API de BITER
35
- const response = await fetch(BITER_API_URL, {
36
- method: "POST",
37
- headers: {
38
- "Content-Type": "application/json",
39
- },
40
- body: JSON.stringify({
41
- message: userMessage,
42
- }),
43
- })
44
-
45
- // Verificar si la respuesta es exitosa
46
- if (!response.ok) {
47
- throw new Error("Error en la respuesta de la API")
48
- }
49
-
50
- // Obtener datos de la respuesta
51
- const data = await response.json()
52
-
53
- // Mostrar respuesta de BITER
54
- appendMessage("assistant", data.response)
55
- } catch (error) {
56
- console.error("Error:", error)
57
- appendMessage(
58
- "system",
59
- "Lo siento, ha ocurrido un error al conectar con BITER. Por favor, intenta de nuevo más tarde.",
60
- )
61
- } finally {
62
- // Ocultar indicador de carga
63
- loadingIndicator.style.display = "none"
64
- }
65
- })
66
-
67
- // Función para añadir mensajes al chat
68
- function appendMessage(role, content) {
69
- const messageDiv = document.createElement("div")
70
- messageDiv.className = `message ${role}-message`
71
-
72
- // Crear avatar
73
- const avatar = document.createElement("div")
74
- avatar.className = "avatar"
75
-
76
- // Icono según el rol
77
- if (role === "user") {
78
- avatar.innerHTML = "👤"
79
- } else if (role === "assistant") {
80
- avatar.innerHTML = "🤖"
81
- } else {
82
- avatar.innerHTML = "⚠️"
83
- }
84
-
85
- // Crear contenido del mensaje
86
- const messageContent = document.createElement("div")
87
- messageContent.className = "message-content"
88
- messageContent.textContent = content
89
-
90
- // Añadir elementos al mensaje
91
- messageDiv.appendChild(avatar)
92
- messageDiv.appendChild(messageContent)
93
-
94
- // Añadir mensaje al contenedor
95
- chatMessages.appendChild(messageDiv)
96
-
97
- // Scroll al último mensaje
98
- chatMessages.scrollTop = chatMessages.scrollHeight
99
- }
 
1
+ <!DOCTYPE html>
2
+ <html lang="es">
3
+ <head>
4
+ <meta charset="UTF-8">
5
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
+ <title>BITER - Tu Mentor de Negocios IA</title>
7
+ <style>
8
+ body {
9
+ font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
10
+ max-width: 800px;
11
+ margin: 0 auto;
12
+ padding: 20px;
13
+ line-height: 1.6;
14
+ color: #333;
15
+ background-color: #f9f9f9;
16
+ }
17
+ h1 {
18
+ color: #1a1a1a;
19
+ border-bottom: 2px solid #eee;
20
+ padding-bottom: 10px;
21
+ }
22
+ .card {
23
+ background: #fff;
24
+ border-radius: 8px;
25
+ padding: 20px;
26
+ margin: 20px 0;
27
+ box-shadow: 0 2px 4px rgba(0,0,0,0.1);
28
+ }
29
+ .info {
30
+ background-color: #e9f5ff;
31
+ border-left: 4px solid #0070f3;
32
+ padding: 15px;
33
+ margin: 20px 0;
34
+ border-radius: 0 8px 8px 0;
35
+ }
36
+ .loading {
37
+ text-align: center;
38
+ margin: 40px 0;
39
+ font-style: italic;
40
+ color: #666;
41
+ }
42
+ </style>
43
+ </head>
44
+ <body>
45
+ <h1>BITER - Tu Mentor en Tiempo Real</h1>
46
+
47
+ <div class="card">
48
+ <h2>Estado del Servicio</h2>
49
+ <p>✅ BITER está activo y funcionando</p>
50
+ <p>Modelo: Microsoft Phi-2 (2.7B parámetros)</p>
51
+ </div>
52
+
53
+ <div class="info">
54
+ <h3>Información Importante</h3>
55
+ <p>La primera consulta puede tardar hasta 1-2 minutos mientras se carga el modelo en memoria.</p>
56
+ <p>Este servicio está optimizado para funcionar en CPU con recursos limitados.</p>
57
+ </div>
58
+
59
+ <div class="loading">
60
+ <p>Para comenzar a usar BITER, simplemente haz clic en el botón "Abrir en una nueva pestaña" arriba.</p>
61
+ </div>
62
+ </body>
63
+ </html>