Solshine commited on
Commit
c612e11
1 Parent(s): 72c21fd

Url references removal clean up

Browse files

Removed + f'[\[{citation_inx}\]]({url})' from line 121
#'d out remaining references to url

Files changed (1) hide show
  1. query.py +5 -5
query.py CHANGED
@@ -105,11 +105,11 @@ class VectaraQuery():
105
  metadata = {item['name']: item['value'] for item in docs[doc_num]['metadata']}
106
  text = extract_between_tags(responses[response_num-1]['text'], start_tag, end_tag)
107
  # for source citing url = f"{metadata['url']}#:~:text={quote(text)}"
108
- if url not in refs:
109
- refs.append(url)
110
 
111
  # replace references with markdown links
112
- refs_dict = {url:(inx+1) for inx,url in enumerate(refs)}
113
  for match in reversed(matches):
114
  start, end = match
115
  response_num = int(summary[start+1:end-1])
@@ -117,7 +117,7 @@ class VectaraQuery():
117
  metadata = {item['name']: item['value'] for item in docs[doc_num]['metadata']}
118
  text = extract_between_tags(responses[response_num-1]['text'], start_tag, end_tag)
119
  # for source citing url = f"{metadata['url']}#:~:text={quote(text)}"
120
- citation_inx = refs_dict[url]
121
- summary = summary[:start] + f'[\[{citation_inx}\]]({url})' + summary[end:]
122
 
123
  return summary
 
105
  metadata = {item['name']: item['value'] for item in docs[doc_num]['metadata']}
106
  text = extract_between_tags(responses[response_num-1]['text'], start_tag, end_tag)
107
  # for source citing url = f"{metadata['url']}#:~:text={quote(text)}"
108
+ # if url not in refs:
109
+ # refs.append(url)
110
 
111
  # replace references with markdown links
112
+ # refs_dict = {url:(inx+1) for inx,url in enumerate(refs)}
113
  for match in reversed(matches):
114
  start, end = match
115
  response_num = int(summary[start+1:end-1])
 
117
  metadata = {item['name']: item['value'] for item in docs[doc_num]['metadata']}
118
  text = extract_between_tags(responses[response_num-1]['text'], start_tag, end_tag)
119
  # for source citing url = f"{metadata['url']}#:~:text={quote(text)}"
120
+ # citation_inx = refs_dict[url]
121
+ summary = summary[:start] + summary[end:]
122
 
123
  return summary