ishaq101 commited on
Commit
06c7961
·
1 Parent(s): dba8f16

update chatbot

Browse files
Files changed (1) hide show
  1. 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
- sentences = [s.strip() for s in text.split(".") if s.strip()][:3]
 
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