Spaces:
Running
Running
Update query.py
Browse files
query.py
CHANGED
@@ -102,9 +102,10 @@ class VectaraQuery():
|
|
102 |
doc_num = responses[response_num-1]['documentIndex']
|
103 |
metadata = {item['name']: item['value'] for item in docs[doc_num]['metadata']}
|
104 |
text = extract_between_tags(responses[response_num-1]['text'], start_tag, end_tag)
|
105 |
-
url
|
106 |
-
|
107 |
-
refs
|
|
|
108 |
|
109 |
# replace references with markdown links
|
110 |
refs_dict = {url:(inx+1) for inx,url in enumerate(refs)}
|
|
|
102 |
doc_num = responses[response_num-1]['documentIndex']
|
103 |
metadata = {item['name']: item['value'] for item in docs[doc_num]['metadata']}
|
104 |
text = extract_between_tags(responses[response_num-1]['text'], start_tag, end_tag)
|
105 |
+
if 'url' in metadata.keys():
|
106 |
+
url = f"{metadata['url']}#:~:text={quote(text)}"
|
107 |
+
if url not in refs:
|
108 |
+
refs.append(url)
|
109 |
|
110 |
# replace references with markdown links
|
111 |
refs_dict = {url:(inx+1) for inx,url in enumerate(refs)}
|