From 3432d932d1c28dbc845992a54f7d4fea16ea338b Mon Sep 17 00:00:00 2001 From: Yuhong Sun Date: Sun, 1 Dec 2024 14:10:11 -0800 Subject: [PATCH] Citation code comments --- .../llm/answering/stream_processing/citation_processing.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/backend/danswer/llm/answering/stream_processing/citation_processing.py b/backend/danswer/llm/answering/stream_processing/citation_processing.py index 1333d211265..2acaa98f8e7 100644 --- a/backend/danswer/llm/answering/stream_processing/citation_processing.py +++ b/backend/danswer/llm/answering/stream_processing/citation_processing.py @@ -67,9 +67,9 @@ def process_token( if piece_that_comes_after == "\n" and in_code_block(self.llm_out): 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)) - possible_citation_pattern = r"(\[+\d*$)" + possible_citation_pattern = r"(\[+\d*$)" # [1, [, [[, [[2, etc. possible_citation_found = re.search( possible_citation_pattern, self.curr_segment )