ofermend commited on
Commit
98ec67f
1 Parent(s): 1388aa0

Update query.py

Browse files
Files changed (1) hide show
  1. query.py +4 -3
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 = f"{metadata['url']}#:~:text={quote(text)}"
106
- if url not in refs:
107
- refs.append(url)
 
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)}