waleedmohd commited on
Commit
77dc0f3
·
verified ·
1 Parent(s): cbe4b29

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -4
app.py CHANGED
@@ -47,7 +47,7 @@ def respond(message: str, history: list):
47
 
48
  # Check for "Back to Menu" keyword
49
  if "القائمة" in message or "menu" in message.lower():
50
- return "main_menu", history + [[message, "تم العودة إلى القائمة الرئيسية."]]
51
 
52
  # Classify the user's intent using NLP
53
  intent = classify_intent(message)
@@ -55,17 +55,17 @@ def respond(message: str, history: list):
55
  # If intent is recognized, return the corresponding response
56
  if intent != "unknown":
57
  response = ONB_GUIDELINES.get(intent, "عذرًا، لم يتم التعرف على الخيار المحدد.")
58
- return response, history + [[message, response]]
59
 
60
  # Fallback to keyword matching if NLP doesn't recognize the intent
61
  for keyword, key in INTENT_TO_RESPONSE.items():
62
  if keyword in message:
63
  response = ONB_GUIDELINES.get(key, "عذرًا، لم يتم التعرف على الخيار المحدد.")
64
- return response, history + [[message, response]]
65
 
66
  # Default response if no intent or keyword is matched
67
  response = "عذرًا، لم أفهم سؤالك. الرجاء إعادة الصياغة أو كتابة 'القائمة' للعودة إلى القائمة الرئيسية."
68
- return response, history + [[message, response]]
69
 
70
  # Main menu with submenus
71
  main_menu = {
 
47
 
48
  # Check for "Back to Menu" keyword
49
  if "القائمة" in message or "menu" in message.lower():
50
+ return history + [[message, "تم العودة إلى القائمة الرئيسية."]]
51
 
52
  # Classify the user's intent using NLP
53
  intent = classify_intent(message)
 
55
  # If intent is recognized, return the corresponding response
56
  if intent != "unknown":
57
  response = ONB_GUIDELINES.get(intent, "عذرًا، لم يتم التعرف على الخيار المحدد.")
58
+ return history + [[message, response]]
59
 
60
  # Fallback to keyword matching if NLP doesn't recognize the intent
61
  for keyword, key in INTENT_TO_RESPONSE.items():
62
  if keyword in message:
63
  response = ONB_GUIDELINES.get(key, "عذرًا، لم يتم التعرف على الخيار المحدد.")
64
+ return history + [[message, response]]
65
 
66
  # Default response if no intent or keyword is matched
67
  response = "عذرًا، لم أفهم سؤالك. الرجاء إعادة الصياغة أو كتابة 'القائمة' للعودة إلى القائمة الرئيسية."
68
+ return history + [[message, response]]
69
 
70
  # Main menu with submenus
71
  main_menu = {