Spaces:
Sleeping
Sleeping
Commit
·
190ea81
1
Parent(s):
425f3ec
Upd img fallback
Browse files- api/chatbot.py +5 -0
api/chatbot.py
CHANGED
|
@@ -204,6 +204,7 @@ class CookingTutorChatbot:
|
|
| 204 |
if source_aggregation and 'images' in source_aggregation:
|
| 205 |
images = source_aggregation['images']
|
| 206 |
if images:
|
|
|
|
| 207 |
# Create enhanced image data with better frontend integration
|
| 208 |
enhanced_images = self._enhance_images_for_frontend(images[:3], user_query)
|
| 209 |
response_data['images'] = enhanced_images
|
|
@@ -214,6 +215,10 @@ class CookingTutorChatbot:
|
|
| 214 |
|
| 215 |
# Keep original text for backward compatibility
|
| 216 |
response_data['text'] = response.strip()
|
|
|
|
|
|
|
|
|
|
|
|
|
| 217 |
|
| 218 |
# Return structured response if we have media, otherwise just text
|
| 219 |
if len(response_data) > 1:
|
|
|
|
| 204 |
if source_aggregation and 'images' in source_aggregation:
|
| 205 |
images = source_aggregation['images']
|
| 206 |
if images:
|
| 207 |
+
logger.info(f"Found {len(images)} images from search")
|
| 208 |
# Create enhanced image data with better frontend integration
|
| 209 |
enhanced_images = self._enhance_images_for_frontend(images[:3], user_query)
|
| 210 |
response_data['images'] = enhanced_images
|
|
|
|
| 215 |
|
| 216 |
# Keep original text for backward compatibility
|
| 217 |
response_data['text'] = response.strip()
|
| 218 |
+
else:
|
| 219 |
+
logger.warning("No images found in source aggregation")
|
| 220 |
+
else:
|
| 221 |
+
logger.warning("No source aggregation or images in response")
|
| 222 |
|
| 223 |
# Return structured response if we have media, otherwise just text
|
| 224 |
if len(response_data) > 1:
|