igrisds commited on
Commit
dca8500
1 Parent(s): 2fade7b

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +15 -3
app.py CHANGED
@@ -100,25 +100,37 @@ def ask_ds(message, history):
100
  global division
101
  global authenticated
102
  global extractions
 
103
 
104
  if len(message) == 0:
105
  yield None
106
 
107
  if authenticated == False:
108
-
 
109
  if division == None:
110
- if message.lower().strip() in ['ime', 'peer disability', 'pas']:
111
  division = message.lower().strip().replace(' ', '_')
112
  yield "[1] CSR\n[2] QA"
 
 
 
113
  else:
114
  yield "Please select a valid choice."
115
  elif employee_type == None:
116
- if message.lower().strip() in ['csr', 'qa']:
 
117
  employee_type = message.lower().strip()
118
  authenticated = True
119
  EXTRACTIONS_PATH = EXTRACTIONS_PATH.replace('{employee_type}', employee_type).replace('{division}', division[:3])
120
  extractions = read_json_from_s3()
121
  yield "Welcome to Ask Dane Street! Whether you're new to the team or just looking for some quick information, I'm here to guide you through our company's literature and platform. Simply ask your question, and I'll provide you with the most relevant information I can."
 
 
 
 
 
 
122
  else:
123
  yield "Please select a valid choice."
124
  else:
 
100
  global division
101
  global authenticated
102
  global extractions
103
+ global EXTRACTIONS_PATH
104
 
105
  if len(message) == 0:
106
  yield None
107
 
108
  if authenticated == False:
109
+
110
+ divisions = {'1': 'ime', '2': 'pas', '3': 'peer disability'}
111
  if division == None:
112
+ if message.lower().strip() in list(divisions.values()):
113
  division = message.lower().strip().replace(' ', '_')
114
  yield "[1] CSR\n[2] QA"
115
+ elif message.lower().strip() in list(divisions.keys()):
116
+ division = divisions[message.lower().strip()].replace(' ', '_')
117
+ yield "[1] CSR\n[2] QA"
118
  else:
119
  yield "Please select a valid choice."
120
  elif employee_type == None:
121
+ employee_types = {'1': 'csr', '2': 'qa'}
122
+ if message.lower().strip() in list(employee_types.values()):
123
  employee_type = message.lower().strip()
124
  authenticated = True
125
  EXTRACTIONS_PATH = EXTRACTIONS_PATH.replace('{employee_type}', employee_type).replace('{division}', division[:3])
126
  extractions = read_json_from_s3()
127
  yield "Welcome to Ask Dane Street! Whether you're new to the team or just looking for some quick information, I'm here to guide you through our company's literature and platform. Simply ask your question, and I'll provide you with the most relevant information I can."
128
+ elif message.lower().strip() in list(employee_types.keys()) :
129
+ employee_type = employee_types[message.lower().strip()]
130
+ authenticated = True
131
+ EXTRACTIONS_PATH = EXTRACTIONS_PATH.replace('{employee_type}', employee_type).replace('{division}', division[:3])
132
+ extractions = read_json_from_s3()
133
+ yield "Welcome to Ask Dane Street! Whether you're new to the team or just looking for some quick information, I'm here to guide you through our company's literature and platform. Simply ask your question, and I'll provide you with the most relevant information I can."
134
  else:
135
  yield "Please select a valid choice."
136
  else: