update chatbot
Browse files- src/agents/chatbot.py +3 -2
src/agents/chatbot.py
CHANGED
|
@@ -148,10 +148,11 @@ class ChatbotAgent:
|
|
| 148 |
text = result.content if hasattr(result, "content") else str(result)
|
| 149 |
text = text.replace("!", ".").replace("?", ".").replace(";", ".").replace("*", "")
|
| 150 |
|
| 151 |
-
|
|
|
|
| 152 |
|
| 153 |
def sanitize(sentence: str) -> str:
|
| 154 |
-
sentence = re.sub(r"[^A-Za-z0-9 .]", " ", sentence)
|
| 155 |
sentence = re.sub(r"\s+", " ", sentence).strip()
|
| 156 |
return sentence
|
| 157 |
|
|
|
|
| 148 |
text = result.content if hasattr(result, "content") else str(result)
|
| 149 |
text = text.replace("!", ".").replace("?", ".").replace(";", ".").replace("*", "")
|
| 150 |
|
| 151 |
+
# Split on sentence boundaries (period + space/newline), not decimal dots like "184.900"
|
| 152 |
+
sentences = [s.strip() for s in re.split(r'\.\s+', text) if s.strip()][:3]
|
| 153 |
|
| 154 |
def sanitize(sentence: str) -> str:
|
| 155 |
+
sentence = re.sub(r"[^A-Za-z0-9 .,]", " ", sentence)
|
| 156 |
sentence = re.sub(r"\s+", " ", sentence).strip()
|
| 157 |
return sentence
|
| 158 |
|