Spaces:
Runtime error
Runtime error
Commit
·
9cff658
1
Parent(s):
8a76f56
add: missing params error exception
Browse files
app.py
CHANGED
|
@@ -484,6 +484,26 @@ def create_chat_interface():
|
|
| 484 |
origin = request.query_params.get("origin", None)
|
| 485 |
ct = request.query_params.get("ct", None)
|
| 486 |
turl = request.query_params.get("turl", None)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 487 |
|
| 488 |
# if any param is missing, return error
|
| 489 |
if not cid or not rsid or not origin or not ct or not turl:
|
|
|
|
| 484 |
origin = request.query_params.get("origin", None)
|
| 485 |
ct = request.query_params.get("ct", None)
|
| 486 |
turl = request.query_params.get("turl", None)
|
| 487 |
+
required_params = ["cid", "rsid", "origin", "ct", "turl"]
|
| 488 |
+
missing_params = [
|
| 489 |
+
param
|
| 490 |
+
for param in required_params
|
| 491 |
+
if request.query_params.get(param) is None
|
| 492 |
+
]
|
| 493 |
+
if missing_params:
|
| 494 |
+
error_message = (
|
| 495 |
+
f"Missing required parameters: {', '.join(missing_params)}"
|
| 496 |
+
)
|
| 497 |
+
chatbot_value = [(None, error_message)]
|
| 498 |
+
return [
|
| 499 |
+
chatbot_value,
|
| 500 |
+
None,
|
| 501 |
+
None,
|
| 502 |
+
None,
|
| 503 |
+
None,
|
| 504 |
+
None,
|
| 505 |
+
None,
|
| 506 |
+
]
|
| 507 |
|
| 508 |
# if any param is missing, return error
|
| 509 |
if not cid or not rsid or not origin or not ct or not turl:
|