Spaces:
Running
Running
Update query.py
Browse files
query.py
CHANGED
@@ -123,9 +123,9 @@ class VectaraQuery():
|
|
123 |
summary = res['responseSet'][0]['summary'][0]['text']
|
124 |
responses = res['responseSet'][0]['response'][:top_k]
|
125 |
docs = res['responseSet'][0]['document']
|
126 |
-
chat = res['responseSet'][0]['summary'][0]
|
127 |
|
128 |
-
if chat['status']
|
129 |
st_code = chat['status']
|
130 |
print(f"Chat query failed with code {st_code}")
|
131 |
if st_code == 'RESOURCE_EXHAUSTED':
|
@@ -133,8 +133,7 @@ class VectaraQuery():
|
|
133 |
return 'Sorry, Vectara chat turns exceeds plan limit.'
|
134 |
return 'Sorry, something went wrong in my brain. Please try again later.'
|
135 |
|
136 |
-
self.conv_id =
|
137 |
-
|
138 |
summary = CitationNormalizer().normalize_citations(summary, responses, docs)
|
139 |
return summary
|
140 |
|
|
|
123 |
summary = res['responseSet'][0]['summary'][0]['text']
|
124 |
responses = res['responseSet'][0]['response'][:top_k]
|
125 |
docs = res['responseSet'][0]['document']
|
126 |
+
chat = res['responseSet'][0]['summary'][0].get('chat', None)
|
127 |
|
128 |
+
if chat and chat['status'] is not None:
|
129 |
st_code = chat['status']
|
130 |
print(f"Chat query failed with code {st_code}")
|
131 |
if st_code == 'RESOURCE_EXHAUSTED':
|
|
|
133 |
return 'Sorry, Vectara chat turns exceeds plan limit.'
|
134 |
return 'Sorry, something went wrong in my brain. Please try again later.'
|
135 |
|
136 |
+
self.conv_id = chat['conversationId'] if chat else None
|
|
|
137 |
summary = CitationNormalizer().normalize_citations(summary, responses, docs)
|
138 |
return summary
|
139 |
|