Spaces:
Runtime error
Runtime error
Deleted bard drafted section and added a try else
Browse files
query.py
CHANGED
@@ -88,25 +88,11 @@ class VectaraQuery():
|
|
88 |
# return 'Sorry, chat turns exceeds plan limit.'
|
89 |
# return 'Sorry, something went wrong in my brain. Please try again later.'
|
90 |
|
91 |
-
|
92 |
-
|
93 |
-
|
94 |
-
|
95 |
-
|
96 |
-
if 'chat' in first_summary:
|
97 |
-
self.conv_id = res['responseSet'][0]['summary'][0]['chat']['conversationId']
|
98 |
-
else:
|
99 |
-
# Handle the case where 'chat' is None
|
100 |
-
print("Chat data not found in response summary")
|
101 |
-
else:
|
102 |
-
# Handle the case where 'summary' is missing or empty
|
103 |
-
print("Response summary missing or empty")
|
104 |
-
else:
|
105 |
-
# Handle the case where 'responseSet' is missing, empty, or 'res' is None
|
106 |
-
print("Response data unavailable")
|
107 |
-
|
108 |
-
#end of bard fix for none value error
|
109 |
-
|
110 |
pattern = r'\[\d{1,2}\]'
|
111 |
matches = [match.span() for match in re.finditer(pattern, summary)]
|
112 |
|
|
|
88 |
# return 'Sorry, chat turns exceeds plan limit.'
|
89 |
# return 'Sorry, something went wrong in my brain. Please try again later.'
|
90 |
|
91 |
+
try:
|
92 |
+
self.conv_id = res['responseSet'][0]['summary'][0]['chat']['conversationId']
|
93 |
+
except error:
|
94 |
+
return 'Sorry, something went wrong. Please try again later.'
|
95 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
96 |
pattern = r'\[\d{1,2}\]'
|
97 |
matches = [match.span() for match in re.finditer(pattern, summary)]
|
98 |
|