Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -12,6 +12,17 @@ def respond(message, history):
|
|
| 12 |
top_results = get_top_chunks(message, chunk_embeddings, brand_chunks)
|
| 13 |
print(top_results)
|
| 14 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 15 |
# ✅ Format context for LLM
|
| 16 |
if top_results:
|
| 17 |
formatted_info = "\n".join(f"- {chunk}" for chunk in top_results)
|
|
|
|
| 12 |
top_results = get_top_chunks(message, chunk_embeddings, brand_chunks)
|
| 13 |
print(top_results)
|
| 14 |
|
| 15 |
+
urgent_keywords = [
|
| 16 |
+
"puke", "vomit", "throw up", "seizure", "bleeding", "choking",
|
| 17 |
+
"can't breathe", "emergency", "poison", "collapsed", "trauma", "injury"
|
| 18 |
+
]
|
| 19 |
+
if any(word in message.lower() for word in urgent_keywords):
|
| 20 |
+
return (
|
| 21 |
+
"This sounds like a possible medical emergency. "
|
| 22 |
+
"Please contact your veterinarian or an emergency animal hospital immediately. "
|
| 23 |
+
"Do not rely solely on online advice."
|
| 24 |
+
)
|
| 25 |
+
|
| 26 |
# ✅ Format context for LLM
|
| 27 |
if top_results:
|
| 28 |
formatted_info = "\n".join(f"- {chunk}" for chunk in top_results)
|