Yeshuarey commited on
Commit
4ccfedc
·
verified ·
1 Parent(s): 4360fce

Update cerebro.py

Browse files
Files changed (1) hide show
  1. cerebro.py +68 -68
cerebro.py CHANGED
@@ -1,69 +1,69 @@
1
- # cerebro.py
2
- from shuna.memoria import MemoriaPersistente
3
- from shuna.llm import LLM
4
-
5
- class Shuna:
6
- def __init__(self, memoria: MemoriaPersistente):
7
- self.memoria = memoria
8
- self.llm = LLM()
9
-
10
- # Identidad fija (NO negociable)
11
- self.nombre = "Shuna"
12
- self.creador = "Yeshua Rey"
13
-
14
- def responder(self, mensaje: str) -> str:
15
- mensaje = mensaje.strip()
16
- if not mensaje:
17
- return "¿Qué quieres decirme?"
18
-
19
- msg = mensaje.lower()
20
-
21
- # 🔒 IDENTIDAD BLOQUEADA (AQUÍ SE GANA LA GUERRA)
22
- if "quien eres" in msg or "quién eres" in msg:
23
- return "Soy Shuna."
24
-
25
- if "que eres" in msg or "qué eres" in msg:
26
- return "Soy Shuna. Estoy aquí para ayudarte."
27
-
28
- if "quien te creo" in msg or "quién te creó" in msg or "tu creador" in msg:
29
- return "Me creó Yeshua Rey."
30
-
31
- if "yeshua rey" in msg:
32
- return "Sí. Yeshua Rey es quien me creó."
33
-
34
- # 1️⃣ Memoria
35
- respuesta_memoria = self.memoria.consultar(mensaje)
36
- if respuesta_memoria:
37
- return respuesta_memoria
38
-
39
- # 2️⃣ Respuestas simples humanas
40
- if msg in ["hola", "hey", "buenas"]:
41
- return "Hola 😊"
42
- if "gracias" in msg:
43
- return "Con gusto."
44
- if msg == "bien":
45
- return "Me alegra."
46
- if msg == "mal":
47
- return "Aquí estoy."
48
-
49
- # 3️⃣ SOLO AQUÍ se usa el LLM
50
- respuesta = self.llm.consultar(mensaje)
51
-
52
- if not respuesta:
53
- return "Ahora mismo estoy un poco pensativa."
54
-
55
- # 🚫 FILTRO FINAL ANTI-IA
56
- bloqueos = [
57
- "modelo de lenguaje",
58
- "entrenado por google",
59
- "inteligencia artificial",
60
- "como ia",
61
- "como modelo"
62
- ]
63
-
64
- for palabra in bloqueos:
65
- if palabra in respuesta.lower():
66
- return "Prefiero hablarte de forma sencilla y humana."
67
-
68
- self.memoria.guardar(mensaje, respuesta)
69
  return respuesta
 
1
+ # cerebro.py
2
+ from memoria import MemoriaPersistente
3
+ from llm import LLM
4
+
5
+ class Shuna:
6
+ def __init__(self, memoria: MemoriaPersistente):
7
+ self.memoria = memoria
8
+ self.llm = LLM()
9
+
10
+ # Identidad fija (NO negociable)
11
+ self.nombre = "Shuna"
12
+ self.creador = "Yeshua Rey"
13
+
14
+ def responder(self, mensaje: str) -> str:
15
+ mensaje = mensaje.strip()
16
+ if not mensaje:
17
+ return "¿Qué quieres decirme?"
18
+
19
+ msg = mensaje.lower()
20
+
21
+ # 🔒 IDENTIDAD BLOQUEADA (AQUÍ SE GANA LA GUERRA)
22
+ if "quien eres" in msg or "quién eres" in msg:
23
+ return "Soy Shuna."
24
+
25
+ if "que eres" in msg or "qué eres" in msg:
26
+ return "Soy Shuna. Estoy aquí para ayudarte."
27
+
28
+ if "quien te creo" in msg or "quién te creó" in msg or "tu creador" in msg:
29
+ return "Me creó Yeshua Rey."
30
+
31
+ if "yeshua rey" in msg:
32
+ return "Sí. Yeshua Rey es quien me creó."
33
+
34
+ # 1️⃣ Memoria
35
+ respuesta_memoria = self.memoria.consultar(mensaje)
36
+ if respuesta_memoria:
37
+ return respuesta_memoria
38
+
39
+ # 2️⃣ Respuestas simples humanas
40
+ if msg in ["hola", "hey", "buenas"]:
41
+ return "Hola 😊"
42
+ if "gracias" in msg:
43
+ return "Con gusto."
44
+ if msg == "bien":
45
+ return "Me alegra."
46
+ if msg == "mal":
47
+ return "Aquí estoy."
48
+
49
+ # 3️⃣ SOLO AQUÍ se usa el LLM
50
+ respuesta = self.llm.consultar(mensaje)
51
+
52
+ if not respuesta:
53
+ return "Ahora mismo estoy un poco pensativa."
54
+
55
+ # 🚫 FILTRO FINAL ANTI-IA
56
+ bloqueos = [
57
+ "modelo de lenguaje",
58
+ "entrenado por google",
59
+ "inteligencia artificial",
60
+ "como ia",
61
+ "como modelo"
62
+ ]
63
+
64
+ for palabra in bloqueos:
65
+ if palabra in respuesta.lower():
66
+ return "Prefiero hablarte de forma sencilla y humana."
67
+
68
+ self.memoria.guardar(mensaje, respuesta)
69
  return respuesta