Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -33,8 +33,26 @@ base_conocimiento = [
|
|
| 33 |
"respuesta": "🌐 En la página oficial...\n👉 [Visitar biblioteca UTB](https://www.utb.edu.co/biblioteca-utb/)"
|
| 34 |
},
|
| 35 |
{
|
| 36 |
-
"claves": ["prestamo", "préstamo", "prestar
|
| 37 |
-
"respuesta": "📚
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 38 |
}
|
| 39 |
|
| 40 |
]
|
|
@@ -92,6 +110,14 @@ def responder(mensaje, historial):
|
|
| 92 |
# 👋 Detectar saludo
|
| 93 |
if any(s in mensaje for s in saludos):
|
| 94 |
saludo = "¡Hola! 😊\n\n"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 95 |
|
| 96 |
# 🎓 CAPACITACIONES
|
| 97 |
if any(p in mensaje for p in ["capacitacion", "capacitaciones", "asesoria", "asesorias", "capacitación", "asesoría"]):
|
|
@@ -134,7 +160,24 @@ def responder(mensaje, historial):
|
|
| 134 |
texto_libros += f"📚 **{c.capitalize()}**\n👉 [Ver en PRIMO]({link})\n\n"
|
| 135 |
|
| 136 |
respuestas.append(texto_libros)
|
| 137 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 138 |
# 📚 BASE DE CONOCIMIENTO (otros)
|
| 139 |
for item in base_conocimiento:
|
| 140 |
if any(p in mensaje for p in item["claves"]):
|
|
|
|
| 33 |
"respuesta": "🌐 En la página oficial...\n👉 [Visitar biblioteca UTB](https://www.utb.edu.co/biblioteca-utb/)"
|
| 34 |
},
|
| 35 |
{
|
| 36 |
+
"claves": ["prestamo", "préstamo", "prestar", "libros prestar", "cuantos libros", "cuantos dias", "tiempo prestamo"],
|
| 37 |
+
"respuesta": """📚 Según el reglamento de préstamos:
|
| 38 |
+
|
| 39 |
+
👩🎓 Estudiantes:
|
| 40 |
+
• General: 3 libros por 7 días
|
| 41 |
+
• Literatura/Arte: 2 libros por 15 días
|
| 42 |
+
• Tesis: 2 libros por 5 días
|
| 43 |
+
• Reserva: Hasta el siguiente día hábil
|
| 44 |
+
• Audiovisual: 5 días
|
| 45 |
+
• Hemeroteca: 2 días
|
| 46 |
+
• Referencia: Solo consulta en sala
|
| 47 |
+
|
| 48 |
+
👨🏫 Profesores:
|
| 49 |
+
• General: Hasta 10 libros por 7 días
|
| 50 |
+
|
| 51 |
+
💸 Multas:
|
| 52 |
+
• $1.000 por día (general)
|
| 53 |
+
• $2.000 por día (material especial)
|
| 54 |
+
|
| 55 |
+
👉 Si quieres dime tu tipo de usuario y te doy detalles más específicos 😊"""
|
| 56 |
}
|
| 57 |
|
| 58 |
]
|
|
|
|
| 110 |
# 👋 Detectar saludo
|
| 111 |
if any(s in mensaje for s in saludos):
|
| 112 |
saludo = "¡Hola! 😊\n\n"
|
| 113 |
+
# 👋 SOLO SALUDO (sin más intención)
|
| 114 |
+
|
| 115 |
+
if any(s in mensaje for s in saludos) and len(mensaje.strip()) < 10:
|
| 116 |
+
return random.choice([
|
| 117 |
+
"¡Hola! 😊 Soy tu asistente de la biblioteca UTB 📚\n\n¿En qué puedo ayudarte?",
|
| 118 |
+
"¡Hola! 👋 Estoy aquí para ayudarte con la biblioteca 📚",
|
| 119 |
+
"¡Hola! 😄 Puedes preguntarme sobre libros, horarios o servicios"
|
| 120 |
+
])
|
| 121 |
|
| 122 |
# 🎓 CAPACITACIONES
|
| 123 |
if any(p in mensaje for p in ["capacitacion", "capacitaciones", "asesoria", "asesorias", "capacitación", "asesoría"]):
|
|
|
|
| 160 |
texto_libros += f"📚 **{c.capitalize()}**\n👉 [Ver en PRIMO]({link})\n\n"
|
| 161 |
|
| 162 |
respuestas.append(texto_libros)
|
| 163 |
+
|
| 164 |
+
# 📚 DETALLE PRÉSTAMOS POR USUARIO
|
| 165 |
+
if "estudiante" in mensaje and "prestamo" in mensaje:
|
| 166 |
+
return """👩🎓 Como estudiante puedes:
|
| 167 |
+
|
| 168 |
+
• 3 libros por 7 días
|
| 169 |
+
• 2 libros por 15 días (literatura, arte)
|
| 170 |
+
• 2 libros por 5 días (tesis)
|
| 171 |
+
|
| 172 |
+
¿Quieres saber sobre multas o renovaciones? 😊"""
|
| 173 |
+
|
| 174 |
+
if "profesor" in mensaje and "prestamo" in mensaje:
|
| 175 |
+
return """👨🏫 Como profesor puedes:
|
| 176 |
+
|
| 177 |
+
• Hasta 10 libros por 7 días
|
| 178 |
+
|
| 179 |
+
También tienes acceso a otros materiales especiales 📚"""
|
| 180 |
+
|
| 181 |
# 📚 BASE DE CONOCIMIENTO (otros)
|
| 182 |
for item in base_conocimiento:
|
| 183 |
if any(p in mensaje for p in item["claves"]):
|