SamiKoen commited on
Commit ·
9469df5
1
Parent(s): 6a45d4b
Fix: Normalize + character for Fuel+ LX and other e-bike models
Browse files
smart_warehouse_with_price.py
CHANGED
|
@@ -194,10 +194,20 @@ def get_product_price_and_link(product_name, variant=None):
|
|
| 194 |
for tr, en in tr_map.items():
|
| 195 |
search_name_normalized = search_name_normalized.replace(tr, en)
|
| 196 |
search_variant_normalized = search_variant_normalized.replace(tr, en)
|
| 197 |
-
|
| 198 |
# Now lowercase
|
| 199 |
search_name = search_name_normalized.lower()
|
| 200 |
search_variant = search_variant_normalized.lower()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 201 |
|
| 202 |
best_match = None
|
| 203 |
best_score = 0
|
|
@@ -315,7 +325,16 @@ def get_warehouse_stock_smart_with_price(user_message, previous_result=None):
|
|
| 315 |
]
|
| 316 |
|
| 317 |
clean_message = user_message.lower().strip()
|
| 318 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 319 |
for phrase in live_support_phrases:
|
| 320 |
if phrase in clean_message:
|
| 321 |
return None # Ürün araması yapma, GPT'ye bırak
|
|
|
|
| 194 |
for tr, en in tr_map.items():
|
| 195 |
search_name_normalized = search_name_normalized.replace(tr, en)
|
| 196 |
search_variant_normalized = search_variant_normalized.replace(tr, en)
|
| 197 |
+
|
| 198 |
# Now lowercase
|
| 199 |
search_name = search_name_normalized.lower()
|
| 200 |
search_variant = search_variant_normalized.lower()
|
| 201 |
+
|
| 202 |
+
# KRITIK: "+" karakterini normalize et (fuel + lx -> fuel+ lx, fuel lx -> fuel+ lx)
|
| 203 |
+
# Kullanici "fuel + lx" veya "fuel lx" yazabilir, XML'de "FUEL+ LX" var
|
| 204 |
+
plus_models = ['fuel', 'domane', 'fx', 'ds', 'verve', 'townie', 'allant']
|
| 205 |
+
for model in plus_models:
|
| 206 |
+
# "fuel + lx" -> "fuel+ lx"
|
| 207 |
+
search_name = search_name.replace(f'{model} + ', f'{model}+ ')
|
| 208 |
+
# "fuel lx" -> "fuel+ lx" (sadece elektrikli model ise)
|
| 209 |
+
if f'{model} lx' in search_name or f'{model} 9' in search_name:
|
| 210 |
+
search_name = search_name.replace(f'{model} ', f'{model}+ ')
|
| 211 |
|
| 212 |
best_match = None
|
| 213 |
best_score = 0
|
|
|
|
| 325 |
]
|
| 326 |
|
| 327 |
clean_message = user_message.lower().strip()
|
| 328 |
+
|
| 329 |
+
# KRITIK: "+" karakterini normalize et (fuel + lx -> fuel+ lx, fuel lx -> fuel+ lx)
|
| 330 |
+
plus_models = ['fuel', 'domane', 'fx', 'ds', 'verve', 'townie', 'allant']
|
| 331 |
+
for model in plus_models:
|
| 332 |
+
# "fuel + lx" -> "fuel+ lx"
|
| 333 |
+
clean_message = clean_message.replace(f'{model} + ', f'{model}+ ')
|
| 334 |
+
# "fuel lx" -> "fuel+ lx" (elektrikli model)
|
| 335 |
+
if f'{model} lx' in clean_message:
|
| 336 |
+
clean_message = clean_message.replace(f'{model} lx', f'{model}+ lx')
|
| 337 |
+
|
| 338 |
for phrase in live_support_phrases:
|
| 339 |
if phrase in clean_message:
|
| 340 |
return None # Ürün araması yapma, GPT'ye bırak
|