Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -13,17 +13,22 @@ def respond(message, history):
|
|
| 13 |
lower_msg = message.lower()
|
| 14 |
if any(word in lower_msg for word in ["unsafe", "toxic", "harmful", "not safe", "poison"]):
|
| 15 |
search_chunks = safe_chunks
|
|
|
|
| 16 |
elif any(word in lower_msg for word in ["nutrition", "diet", "nutrient", "protein", "calories", "feed"]):
|
| 17 |
search_chunks = nutrition_chunks
|
|
|
|
| 18 |
elif any(word in lower_msg for word in ["brand", "brands", "dog food brand"]):
|
| 19 |
search_chunks = brand_chunks
|
|
|
|
| 20 |
elif any(word in lower_msg for word in ["health risk", "disease", "illness"]):
|
| 21 |
search_chunks = health_chunks
|
|
|
|
| 22 |
else:
|
| 23 |
search_chunks = all_chunks
|
|
|
|
| 24 |
|
| 25 |
print("DEBUG: respond() called with:", message)
|
| 26 |
-
top_results = get_top_chunks(message,
|
| 27 |
print("These are top results", top_results)
|
| 28 |
|
| 29 |
urgent_keywords = [
|
|
|
|
| 13 |
lower_msg = message.lower()
|
| 14 |
if any(word in lower_msg for word in ["unsafe", "toxic", "harmful", "not safe", "poison"]):
|
| 15 |
search_chunks = safe_chunks
|
| 16 |
+
search_embeddings = safe_embeddings
|
| 17 |
elif any(word in lower_msg for word in ["nutrition", "diet", "nutrient", "protein", "calories", "feed"]):
|
| 18 |
search_chunks = nutrition_chunks
|
| 19 |
+
search_embeddings = nutrition_embeddings
|
| 20 |
elif any(word in lower_msg for word in ["brand", "brands", "dog food brand"]):
|
| 21 |
search_chunks = brand_chunks
|
| 22 |
+
search_embeddings = brand_embeddings
|
| 23 |
elif any(word in lower_msg for word in ["health risk", "disease", "illness"]):
|
| 24 |
search_chunks = health_chunks
|
| 25 |
+
search_embeddings = health_embeddings
|
| 26 |
else:
|
| 27 |
search_chunks = all_chunks
|
| 28 |
+
search_embeddings = all_embeddings
|
| 29 |
|
| 30 |
print("DEBUG: respond() called with:", message)
|
| 31 |
+
top_results = get_top_chunks(message, search_embeddings, search_chunks)
|
| 32 |
print("These are top results", top_results)
|
| 33 |
|
| 34 |
urgent_keywords = [
|