Spaces:
Running
Running
axeronis commited on
Commit ·
f496bdd
1
Parent(s): b6a8f90
fix: only check CLIENT images for payment detection, not AI QR codes
Browse files
backend/app/services/ai_core/lead_analyzer.py
CHANGED
|
@@ -338,9 +338,10 @@ async def detect_payment_or_order(
|
|
| 338 |
for msg in recent_messages
|
| 339 |
])
|
| 340 |
|
| 341 |
-
# Check if
|
|
|
|
| 342 |
has_media = any(
|
| 343 |
-
msg.media_type and 'image' in (msg.media_type or '').lower()
|
| 344 |
for msg in recent_messages[-3:] # Only last 3 messages
|
| 345 |
)
|
| 346 |
|
|
|
|
| 338 |
for msg in recent_messages
|
| 339 |
])
|
| 340 |
|
| 341 |
+
# Check if CLIENT (not AI) sent an image recently (could be payment screenshot)
|
| 342 |
+
# IMPORTANT: Exclude AI messages to prevent false positives when AI sends QR codes
|
| 343 |
has_media = any(
|
| 344 |
+
msg.sender_type == 'user' and msg.media_type and 'image' in (msg.media_type or '').lower()
|
| 345 |
for msg in recent_messages[-3:] # Only last 3 messages
|
| 346 |
)
|
| 347 |
|