Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -148,17 +148,28 @@ def parse(category, chatbot):
|
|
148 |
global PARSING_REGEXP
|
149 |
|
150 |
|
151 |
-
|
152 |
-
|
153 |
-
|
154 |
-
|
155 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
156 |
|
157 |
if category not in Category.__members__:
|
158 |
# Handle the case when an invalid category is provided
|
159 |
answer="test"
|
160 |
|
161 |
#category = Category[category]
|
|
|
162 |
chain = categories.category_modules[category].chain
|
163 |
yield {"status": "Parsing response..."}
|
164 |
try:
|
|
|
148 |
global PARSING_REGEXP
|
149 |
|
150 |
|
151 |
+
chatbot_responses = []
|
152 |
+
|
153 |
+
for response in chatbot:
|
154 |
+
chatbot_responses.append(response[1])
|
155 |
+
|
156 |
+
if not chatbot_responses:
|
157 |
+
# Handle the case when there are no chatbot responses
|
158 |
+
return {"status": "No responses available"}
|
159 |
+
|
160 |
+
answer = chatbot_responses[-1]
|
161 |
+
|
162 |
+
# try:
|
163 |
+
# answer = next(chatbot)[1]
|
164 |
+
# except StopIteration:
|
165 |
+
# answer = ""
|
166 |
|
167 |
if category not in Category.__members__:
|
168 |
# Handle the case when an invalid category is provided
|
169 |
answer="test"
|
170 |
|
171 |
#category = Category[category]
|
172 |
+
|
173 |
chain = categories.category_modules[category].chain
|
174 |
yield {"status": "Parsing response..."}
|
175 |
try:
|