mirror of
https://github.com/danswer-ai/danswer.git
synced 2025-05-22 17:50:21 +02:00
Citation code comments
This commit is contained in:
parent
9bd0cb9eb5
commit
3432d932d1
@ -67,9 +67,9 @@ class CitationProcessor:
|
|||||||
if piece_that_comes_after == "\n" and in_code_block(self.llm_out):
|
if piece_that_comes_after == "\n" and in_code_block(self.llm_out):
|
||||||
self.curr_segment = self.curr_segment.replace("```", "```plaintext")
|
self.curr_segment = self.curr_segment.replace("```", "```plaintext")
|
||||||
|
|
||||||
citation_pattern = r"\[(\d+)\]|\[\[(\d+)\]\]"
|
citation_pattern = r"\[(\d+)\]|\[\[(\d+)\]\]" # [1], [[1]], etc.
|
||||||
citations_found = list(re.finditer(citation_pattern, self.curr_segment))
|
citations_found = list(re.finditer(citation_pattern, self.curr_segment))
|
||||||
possible_citation_pattern = r"(\[+\d*$)"
|
possible_citation_pattern = r"(\[+\d*$)" # [1, [, [[, [[2, etc.
|
||||||
possible_citation_found = re.search(
|
possible_citation_found = re.search(
|
||||||
possible_citation_pattern, self.curr_segment
|
possible_citation_pattern, self.curr_segment
|
||||||
)
|
)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user