Wanderlust Dev commited on
Commit
b8eee7a
·
1 Parent(s): 0b4ab15

Round update: fix password double-encoding, chatbot missing_location intent, i18n keys for chatbot (ja/en/vi)

Browse files
app/api/routes.py CHANGED
@@ -276,6 +276,15 @@ async def predict(request: PredictRequest):
276
  'data': {'restaurants': recs}
277
  }
278
 
 
 
 
 
 
 
 
 
 
279
  # 8. Generate response (LLM or template-based)
280
  llm_gen = _get_llm_generator()
281
  generation_method = "template"
 
276
  'data': {'restaurants': recs}
277
  }
278
 
279
+ # 7.5 If intent requires a location but none was found, override to missing_location
280
+ _location_required_intents = {
281
+ 'weather_info', 'budget_advice', 'activity_suggest', 'food_recommend',
282
+ 'transport_info', 'plan_trip', 'find_hotel', 'optimize_budget',
283
+ 'dietary_cuisine',
284
+ }
285
+ if intent in _location_required_intents and destination is None:
286
+ intent = 'missing_location'
287
+
288
  # 8. Generate response (LLM or template-based)
289
  llm_gen = _get_llm_generator()
290
  generation_method = "template"
app/models/response_generator/generator.py CHANGED
@@ -367,6 +367,7 @@ class ResponseGenerator:
367
  'multi_destination_trip': ['Tối ưu ngân sách', 'Tìm chỗ ở', 'Tìm vé bay', 'Ăn gì?'],
368
  'dietary_cuisine': ['Lên kế hoạch', 'Hoạt động?', 'Tìm chỗ ở', 'Chi phí?'],
369
  'fallback': ['Lên kế hoạch du lịch', 'Tìm khách sạn', 'Gợi ý điểm đến', 'Tư vấn ngân sách'],
 
370
  'thank': ['Lên kế hoạch mới', 'Tìm điểm đến khác', 'Tìm khách sạn', 'Tìm vé bay'],
371
  },
372
  'en': {
@@ -387,6 +388,7 @@ class ResponseGenerator:
387
  'multi_destination_trip': ['Optimize budget', 'Find hotels', 'Find flights', 'Food?'],
388
  'dietary_cuisine': ['Plan trip', 'Activities?', 'Find hotels', 'Budget?'],
389
  'fallback': ['Plan a trip', 'Find hotels', 'Suggest destinations', 'Budget advice'],
 
390
  'thank': ['New plan', 'Other destinations', 'Find hotels', 'Find flights'],
391
  }
392
  }
 
367
  'multi_destination_trip': ['Tối ưu ngân sách', 'Tìm chỗ ở', 'Tìm vé bay', 'Ăn gì?'],
368
  'dietary_cuisine': ['Lên kế hoạch', 'Hoạt động?', 'Tìm chỗ ở', 'Chi phí?'],
369
  'fallback': ['Lên kế hoạch du lịch', 'Tìm khách sạn', 'Gợi ý điểm đến', 'Tư vấn ngân sách'],
370
+ 'missing_location': ['Đà Nẵng', 'Phú Quốc', 'Sapa', 'Hội An'],
371
  'thank': ['Lên kế hoạch mới', 'Tìm điểm đến khác', 'Tìm khách sạn', 'Tìm vé bay'],
372
  },
373
  'en': {
 
388
  'multi_destination_trip': ['Optimize budget', 'Find hotels', 'Find flights', 'Food?'],
389
  'dietary_cuisine': ['Plan trip', 'Activities?', 'Find hotels', 'Budget?'],
390
  'fallback': ['Plan a trip', 'Find hotels', 'Suggest destinations', 'Budget advice'],
391
+ 'missing_location': ['Da Nang', 'Phu Quoc', 'Sapa', 'Hoi An'],
392
  'thank': ['New plan', 'Other destinations', 'Find hotels', 'Find flights'],
393
  }
394
  }