Spaces:
Running
Running
Update query.py
Browse files
query.py
CHANGED
@@ -43,9 +43,10 @@ class CitationNormalizer():
|
|
43 |
doc_num = self.responses[response_num-1]['documentIndex']
|
44 |
metadata = {item['name']: item['value'] for item in self.docs[doc_num]['metadata']}
|
45 |
text = extract_between_tags(self.responses[response_num-1]['text'], start_tag, end_tag)
|
46 |
-
url
|
47 |
-
|
48 |
-
|
|
|
49 |
|
50 |
return summary
|
51 |
|
|
|
43 |
doc_num = self.responses[response_num-1]['documentIndex']
|
44 |
metadata = {item['name']: item['value'] for item in self.docs[doc_num]['metadata']}
|
45 |
text = extract_between_tags(self.responses[response_num-1]['text'], start_tag, end_tag)
|
46 |
+
if 'url' in metadata.keys():
|
47 |
+
url = f"{metadata['url']}#:~:text={quote(text)}"
|
48 |
+
citation_inx = refs_dict[url]
|
49 |
+
summary = summary[:start] + f'[\[{citation_inx}\]]({url})' + summary[end:]
|
50 |
|
51 |
return summary
|
52 |
|