Update handler.py
Browse files- handler.py +5 -2
handler.py
CHANGED
@@ -29,9 +29,12 @@ class EndpointHandler():
|
|
29 |
|
30 |
def response(self, result, user_name):
|
31 |
result = result.rsplit("Alice Gate:", 1)[1].split(f"{user_name}:",1)[0].strip()
|
32 |
-
|
|
|
33 |
result = " ".join(result.split())
|
34 |
-
|
|
|
|
|
35 |
return {
|
36 |
"message": result
|
37 |
}
|
|
|
29 |
|
30 |
def response(self, result, user_name):
|
31 |
result = result.rsplit("Alice Gate:", 1)[1].split(f"{user_name}:",1)[0].strip()
|
32 |
+
parsed_result = re.sub('\*.*?\*', '', result).strip()
|
33 |
+
result = parsed_result if len(parsed_result) != 0 else result.replace("*","")
|
34 |
result = " ".join(result.split())
|
35 |
+
try:
|
36 |
+
result = result[:[m.start() for m in re.finditer(r'[.!?]', result)][-1]+1]
|
37 |
+
except Exception: pass
|
38 |
return {
|
39 |
"message": result
|
40 |
}
|