Spaces:
Sleeping
Sleeping
Rajan Sharma
commited on
Update app.py
Browse files
app.py
CHANGED
|
@@ -100,11 +100,16 @@ def is_identity_query(message, history):
|
|
| 100 |
r"\bdescribe\s+yourself\b", r"\band\s+you\s*\?\b", r"\byour\s+name\b",
|
| 101 |
r"\bwho\s+am\s+i\s+chatting\s+with\b",
|
| 102 |
]
|
| 103 |
-
|
| 104 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 105 |
if history:
|
| 106 |
last_user = history[-1][0] if isinstance(history[-1], (list, tuple)) else None
|
| 107 |
-
if match(last_user):
|
|
|
|
| 108 |
return False
|
| 109 |
|
| 110 |
def _iter_user_assistant(history):
|
|
|
|
| 100 |
r"\bdescribe\s+yourself\b", r"\band\s+you\s*\?\b", r"\byour\s+name\b",
|
| 101 |
r"\bwho\s+am\s+i\s+chatting\s+with\b",
|
| 102 |
]
|
| 103 |
+
|
| 104 |
+
def match(t):
|
| 105 |
+
return any(re.search(p, (t or "").strip().lower()) for p in patterns)
|
| 106 |
+
|
| 107 |
+
if match(message):
|
| 108 |
+
return True
|
| 109 |
if history:
|
| 110 |
last_user = history[-1][0] if isinstance(history[-1], (list, tuple)) else None
|
| 111 |
+
if match(last_user):
|
| 112 |
+
return True
|
| 113 |
return False
|
| 114 |
|
| 115 |
def _iter_user_assistant(history):
|