SamiKoen commited on
Commit
c4aebe0
·
1 Parent(s): f8487bc

Add comprehensive debug logging for MADONE SL 6 search

Browse files

- Log what products are being searched
- Show if target products exist before GPT call
- Better error logging for API responses
- Track exact indices being searched

__pycache__/smart_warehouse_complete.cpython-312.pyc CHANGED
Binary files a/__pycache__/smart_warehouse_complete.cpython-312.pyc and b/__pycache__/smart_warehouse_complete.cpython-312.pyc differ
 
smart_warehouse_complete.py CHANGED
@@ -169,6 +169,22 @@ def get_warehouse_stock_smart_complete(user_message):
169
  if asked_warehouse:
170
  warehouse_filter = f"\nIMPORTANT: User is asking specifically about {asked_warehouse} warehouse. Only return products available in that warehouse."
171
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
172
  # GPT-5 prompt with enhanced instructions
173
  smart_prompt = f"""User is asking: "{user_message}"
174
 
@@ -226,13 +242,6 @@ Examples of correct responses:
226
  print(f"DEBUG - Query was: '{user_message}'")
227
  print(f"DEBUG - Products sent to GPT: {len(products_summary)} items")
228
 
229
- # Debug: Check if MADONE SL 6 is in the list
230
- madone_found = [p for p in products_summary if "MADONE SL 6" in p.get("name", "")]
231
- if madone_found:
232
- print(f"DEBUG - MADONE SL 6 products in list: {len(madone_found)}")
233
- for m in madone_found[:2]:
234
- print(f" - Index {m['index']}: {m['name']} ({m.get('variant', '')})")
235
-
236
  # Handle empty response
237
  if not indices_str or indices_str == "-1":
238
  return ["Ürün bulunamadı"]
@@ -355,6 +364,7 @@ Examples of correct responses:
355
  return None
356
  else:
357
  print(f"GPT API error: {response.status_code}")
 
358
  return None
359
 
360
  except Exception as e:
 
169
  if asked_warehouse:
170
  warehouse_filter = f"\nIMPORTANT: User is asking specifically about {asked_warehouse} warehouse. Only return products available in that warehouse."
171
 
172
+ # Log what we're searching for
173
+ print(f"DEBUG - Searching for: '{user_message}'")
174
+ print(f"DEBUG - Total products to search: {len(products_summary)}")
175
+
176
+ # Check if the target product exists
177
+ search_term = user_message.upper()
178
+ matching_products = []
179
+ for p in products_summary:
180
+ if search_term in p['name'].upper():
181
+ matching_products.append(p)
182
+
183
+ if matching_products:
184
+ print(f"DEBUG - Found {len(matching_products)} products containing '{user_message}':")
185
+ for p in matching_products[:3]:
186
+ print(f" - Index {p['index']}: {p['name']} ({p['variant']})")
187
+
188
  # GPT-5 prompt with enhanced instructions
189
  smart_prompt = f"""User is asking: "{user_message}"
190
 
 
242
  print(f"DEBUG - Query was: '{user_message}'")
243
  print(f"DEBUG - Products sent to GPT: {len(products_summary)} items")
244
 
 
 
 
 
 
 
 
245
  # Handle empty response
246
  if not indices_str or indices_str == "-1":
247
  return ["Ürün bulunamadı"]
 
364
  return None
365
  else:
366
  print(f"GPT API error: {response.status_code}")
367
+ print(f"Response: {response.text[:500]}")
368
  return None
369
 
370
  except Exception as e: