Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -1760,25 +1760,11 @@ async def process_incoming_message(from_number: str, msg: dict):
|
|
| 1760 |
current_menu='product_inquiry',
|
| 1761 |
current_menu_options=list(MENU_CONFIG['product_inquiry']['option_descriptions'].values())
|
| 1762 |
)
|
| 1763 |
-
|
| 1764 |
-
|
| 1765 |
-
|
| 1766 |
-
|
| 1767 |
-
|
| 1768 |
-
# Translate response if needed
|
| 1769 |
-
if reply_language == 'ur':
|
| 1770 |
-
try:
|
| 1771 |
-
translated_response = GoogleTranslator(source='auto', target='ur').translate(response)
|
| 1772 |
-
send_whatsjet_message(from_number, translated_response)
|
| 1773 |
-
except Exception as e:
|
| 1774 |
-
logger.error(f"[AI] Translation error: {e}")
|
| 1775 |
-
send_whatsjet_message(from_number, response)
|
| 1776 |
-
else:
|
| 1777 |
-
send_whatsjet_message(from_number, response)
|
| 1778 |
-
|
| 1779 |
-
# Add to conversation history
|
| 1780 |
-
context_manager.add_to_history(from_number, message_body, response)
|
| 1781 |
-
|
| 1782 |
else:
|
| 1783 |
# Enhanced "not found" response with veterinary suggestions
|
| 1784 |
message = (
|
|
|
|
| 1760 |
current_menu='product_inquiry',
|
| 1761 |
current_menu_options=list(MENU_CONFIG['product_inquiry']['option_descriptions'].values())
|
| 1762 |
)
|
| 1763 |
+
# Always send image+caption if possible, else text
|
| 1764 |
+
logger.info(f"[DEBUG] Calling send_product_image_with_caption for: {product_name}")
|
| 1765 |
+
await send_product_image_with_caption(from_number, selected_product, user_context)
|
| 1766 |
+
return
|
| 1767 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1768 |
else:
|
| 1769 |
# Enhanced "not found" response with veterinary suggestions
|
| 1770 |
message = (
|