Spaces:
Sleeping
Sleeping
Commit ·
cdda021
1
Parent(s): 72d44cd
end convo applied
Browse files- backend/graph.py +18 -1
backend/graph.py
CHANGED
|
@@ -909,6 +909,23 @@ ANYTHING_ELSE_NO_PATTERNS = [
|
|
| 909 |
r"^\s*not really\s*$", r"^\s*nothing else\s*$",
|
| 910 |
r"^\s*no\s+not\s+at\s+all\s*$", r"^\s*not\s+at\s+all\s*$",
|
| 911 |
r"^\s*bye\s*$", r"^\s*i'?m\s+good\s*$", r"^\s*that'?s\s+it\s*$",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 912 |
]
|
| 913 |
|
| 914 |
|
|
@@ -923,7 +940,7 @@ def _last_bot_asked_anything_else(messages: list[Message]) -> bool:
|
|
| 923 |
|
| 924 |
def _user_said_no_to_anything_else(user_message: str) -> bool:
|
| 925 |
"""True if user is saying no / nothing else."""
|
| 926 |
-
stripped = user_message.strip().lower()
|
| 927 |
return any(re.search(p, stripped, re.IGNORECASE) for p in ANYTHING_ELSE_NO_PATTERNS)
|
| 928 |
|
| 929 |
|
|
|
|
| 909 |
r"^\s*not really\s*$", r"^\s*nothing else\s*$",
|
| 910 |
r"^\s*no\s+not\s+at\s+all\s*$", r"^\s*not\s+at\s+all\s*$",
|
| 911 |
r"^\s*bye\s*$", r"^\s*i'?m\s+good\s*$", r"^\s*that'?s\s+it\s*$",
|
| 912 |
+
# "no thank you" / "no thank u" / "nope thanks" and variants
|
| 913 |
+
r"^\s*no\s+thank\s+you\s*$", r"^\s*no\s+thank\s+u\s*$",
|
| 914 |
+
r"^\s*no\s+thank\s+you\s+.*$", r"^\s*no\s+thank\s+u\s+.*$", # "no thank you very much" etc
|
| 915 |
+
r"^\s*nope\s*,?\s*thanks?\s*$", r"^\s*nope\s*,?\s*thank\s+you\s*$", r"^\s*nope\s*,?\s*thank\s+u\s*$",
|
| 916 |
+
r"^\s*that'?s\s+all\s*,?\s*thanks?\s*$", r"^\s*that'?s\s+all\s*,?\s*thank\s+you\s*$",
|
| 917 |
+
# From END_CONVO_PATTERNS (standalone thanks, ok, i'm good variants, nah, it's alright/good)
|
| 918 |
+
r"^\s*thanks?\s*$", r"^\s*thank\s+you\s*$", r"^\s*thank\s+you\s+.*$",
|
| 919 |
+
r"^\s*ok\s*$", r"^\s*okay\s*$",
|
| 920 |
+
r"^\s*i'?m\s+good\s+enough\s*$", r"^\s*i'?m\s+good\s+enough\s+with\s+that\s*$",
|
| 921 |
+
r"^\s*i'?m\s+good\s+with\s+that\s*$", r"^\s*i'?m\s+good\s+with\s+the\s+solution\s*$",
|
| 922 |
+
r"^\s*i'?m\s+good\s+with\s+the\s+approach\s*$", r"^\s*i'?m\s+good\s+with\s+the\s+recommendations\s*$",
|
| 923 |
+
r"^\s*i'?m\s+good\s+with\s+the\s+advice\s*$", r"^\s*i'?m\s+good\s+with\s+the\s+plan\s*$",
|
| 924 |
+
r"^\s*no\s+problem\s*$", r"^\s*nah\s*$", r"^\s*nah\s+.*$",
|
| 925 |
+
r"^\s*it'?s\s+alright\s*$", r"^\s*it'?s\s+all\s+good\s*$", r"^\s*it'?s\s+all\s+good\s+with\s+that\s*$",
|
| 926 |
+
r"^\s*it'?s\s+all\s+good\s+with\s+the\s+solution\s*$", r"^\s*it'?s\s+all\s+good\s+with\s+the\s+approach\s*$",
|
| 927 |
+
r"^\s*it'?s\s+all\s+good\s+with\s+the\s+recommendations\s*$", r"^\s*it'?s\s+all\s+good\s+with\s+the\s+advice\s*$",
|
| 928 |
+
r"^\s*it'?s\s+all\s+good\s+with\s+the\s+plan\s*$",
|
| 929 |
]
|
| 930 |
|
| 931 |
|
|
|
|
| 940 |
|
| 941 |
def _user_said_no_to_anything_else(user_message: str) -> bool:
|
| 942 |
"""True if user is saying no / nothing else."""
|
| 943 |
+
stripped = user_message.strip().lower().rstrip(".,!?")
|
| 944 |
return any(re.search(p, stripped, re.IGNORECASE) for p in ANYTHING_ELSE_NO_PATTERNS)
|
| 945 |
|
| 946 |
|