Spaces:
Sleeping
Sleeping
Update query.py
Browse files
query.py
CHANGED
@@ -76,13 +76,15 @@ class VectaraQuery():
|
|
76 |
print(f"DEBUG request body = {body}")
|
77 |
print(f"DEBUG response summary = {res['responseSet'][0]['summary']}")
|
78 |
|
79 |
-
|
80 |
-
if
|
81 |
-
|
82 |
-
if
|
83 |
-
|
84 |
-
|
85 |
-
|
|
|
|
|
86 |
|
87 |
|
88 |
top_k = 10
|
|
|
76 |
print(f"DEBUG request body = {body}")
|
77 |
print(f"DEBUG response summary = {res['responseSet'][0]['summary']}")
|
78 |
|
79 |
+
st = res['responseSet'][0]['status']
|
80 |
+
if len(st)>0:
|
81 |
+
ecode = st[0].get('code','')
|
82 |
+
if ecode != '':
|
83 |
+
print(f"Chat query failed with code {ecode}")
|
84 |
+
if ecode == 'RESOURCE_EXHAUSTED':
|
85 |
+
self.conv_id = None
|
86 |
+
return 'Sorry, Vectara chat turns exceeds plan limit.'
|
87 |
+
return 'Sorry, something went wrong in my brain. Please try again later.'
|
88 |
|
89 |
|
90 |
top_k = 10
|