Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -115,7 +115,7 @@ def query(category, text):
|
|
115 |
2. Generate a response
|
116 |
"""
|
117 |
|
118 |
-
category = Category[category]
|
119 |
|
120 |
chain = categories.category_modules[category].chain
|
121 |
formatted_prompt = chain.prompt.format_prompt(
|
@@ -147,9 +147,7 @@ def parse(category, chatbot):
|
|
147 |
"""Takes the chatbot prompt and response and updates the extracted information"""
|
148 |
global PARSING_REGEXP
|
149 |
|
150 |
-
|
151 |
-
# Handle the case when an invalid category is provided
|
152 |
-
return {"error": "Invalid category provided"}
|
153 |
|
154 |
if chatbot:
|
155 |
if len(chatbot) > 0:
|
@@ -158,8 +156,12 @@ def parse(category, chatbot):
|
|
158 |
answer = ""
|
159 |
else:
|
160 |
answer = ""
|
|
|
|
|
|
|
|
|
161 |
|
162 |
-
category = Category[category]
|
163 |
chain = categories.category_modules[category].chain
|
164 |
yield {"status": "Parsing response..."}
|
165 |
try:
|
|
|
115 |
2. Generate a response
|
116 |
"""
|
117 |
|
118 |
+
#category = Category[category]
|
119 |
|
120 |
chain = categories.category_modules[category].chain
|
121 |
formatted_prompt = chain.prompt.format_prompt(
|
|
|
147 |
"""Takes the chatbot prompt and response and updates the extracted information"""
|
148 |
global PARSING_REGEXP
|
149 |
|
150 |
+
|
|
|
|
|
151 |
|
152 |
if chatbot:
|
153 |
if len(chatbot) > 0:
|
|
|
156 |
answer = ""
|
157 |
else:
|
158 |
answer = ""
|
159 |
+
|
160 |
+
if category not in Category.__members__:
|
161 |
+
# Handle the case when an invalid category is provided
|
162 |
+
answer="test"
|
163 |
|
164 |
+
#category = Category[category]
|
165 |
chain = categories.category_modules[category].chain
|
166 |
yield {"status": "Parsing response..."}
|
167 |
try:
|