Update query.py
Browse files
query.py
CHANGED
|
@@ -52,14 +52,13 @@ class VectaraQuery():
|
|
| 52 |
'chat': {
|
| 53 |
'store': True,
|
| 54 |
'conversationId': self.conv_id
|
| 55 |
-
}
|
|
|
|
| 56 |
}
|
| 57 |
]
|
| 58 |
}
|
| 59 |
]
|
| 60 |
}
|
| 61 |
-
|
| 62 |
-
print(body)
|
| 63 |
|
| 64 |
response = requests.post(endpoint, data=json.dumps(body), verify=True, headers=headers)
|
| 65 |
if response.status_code != 200:
|
|
@@ -67,11 +66,16 @@ class VectaraQuery():
|
|
| 67 |
return "Sorry, something went wrong in my brain. Please try again later."
|
| 68 |
|
| 69 |
res = response.json()
|
| 70 |
-
|
|
|
|
|
|
|
| 71 |
summary = res['responseSet'][0]['summary'][0]['text']
|
| 72 |
responses = res['responseSet'][0]['response']
|
| 73 |
docs = res['responseSet'][0]['document']
|
| 74 |
self.conv_id = res['responseSet'][0]['summary'][0]['chat']['conversationId']
|
|
|
|
|
|
|
|
|
|
| 75 |
pattern = r'\[\d{1,2}\]'
|
| 76 |
matches = [match.span() for match in re.finditer(pattern, summary)]
|
| 77 |
|
|
|
|
| 52 |
'chat': {
|
| 53 |
'store': True,
|
| 54 |
'conversationId': self.conv_id
|
| 55 |
+
},
|
| 56 |
+
'debug': True,
|
| 57 |
}
|
| 58 |
]
|
| 59 |
}
|
| 60 |
]
|
| 61 |
}
|
|
|
|
|
|
|
| 62 |
|
| 63 |
response = requests.post(endpoint, data=json.dumps(body), verify=True, headers=headers)
|
| 64 |
if response.status_code != 200:
|
|
|
|
| 66 |
return "Sorry, something went wrong in my brain. Please try again later."
|
| 67 |
|
| 68 |
res = response.json()
|
| 69 |
+
print(body)
|
| 70 |
+
print(res)
|
| 71 |
+
|
| 72 |
summary = res['responseSet'][0]['summary'][0]['text']
|
| 73 |
responses = res['responseSet'][0]['response']
|
| 74 |
docs = res['responseSet'][0]['document']
|
| 75 |
self.conv_id = res['responseSet'][0]['summary'][0]['chat']['conversationId']
|
| 76 |
+
|
| 77 |
+
|
| 78 |
+
|
| 79 |
pattern = r'\[\d{1,2}\]'
|
| 80 |
matches = [match.span() for match in re.finditer(pattern, summary)]
|
| 81 |
|