mirror of
https://github.com/danswer-ai/danswer.git
synced 2025-06-02 11:09:20 +02:00
fix single quote block in llm answer (#3139)
This commit is contained in:
parent
cbbf10f450
commit
788b3015bc
@ -65,7 +65,7 @@ class CitationProcessor:
|
|||||||
# Handle code blocks without language tags
|
# Handle code blocks without language tags
|
||||||
if "`" in self.curr_segment:
|
if "`" in self.curr_segment:
|
||||||
if self.curr_segment.endswith("`"):
|
if self.curr_segment.endswith("`"):
|
||||||
return
|
pass
|
||||||
elif "```" in self.curr_segment:
|
elif "```" in self.curr_segment:
|
||||||
piece_that_comes_after = self.curr_segment.split("```")[1][0]
|
piece_that_comes_after = self.curr_segment.split("```")[1][0]
|
||||||
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):
|
||||||
|
@ -376,6 +376,26 @@ def process_text(
|
|||||||
"The code demonstrates variable assignment.",
|
"The code demonstrates variable assignment.",
|
||||||
[],
|
[],
|
||||||
),
|
),
|
||||||
|
(
|
||||||
|
"Long JSON string in code block",
|
||||||
|
[
|
||||||
|
"```json\n{",
|
||||||
|
'"name": "John Doe",',
|
||||||
|
'"age": 30,',
|
||||||
|
'"city": "New York",',
|
||||||
|
'"hobbies": ["reading", "swimming", "cycling"],',
|
||||||
|
'"education": {',
|
||||||
|
' "degree": "Bachelor\'s",',
|
||||||
|
' "major": "Computer Science",',
|
||||||
|
' "university": "Example University"',
|
||||||
|
"}",
|
||||||
|
"}\n```",
|
||||||
|
],
|
||||||
|
'```json\n{"name": "John Doe","age": 30,"city": "New York","hobbies": '
|
||||||
|
'["reading", "swimming", "cycling"],"education": { '
|
||||||
|
'"degree": "Bachelor\'s", "major": "Computer Science", "university": "Example University"}}\n```',
|
||||||
|
[],
|
||||||
|
),
|
||||||
(
|
(
|
||||||
"Citation as a single token",
|
"Citation as a single token",
|
||||||
[
|
[
|
||||||
|
Loading…
x
Reference in New Issue
Block a user