From 4b92161c37bc5756036ef4ea541924ad81ec027f Mon Sep 17 00:00:00 2001 From: gogoswift <48036113@qq.com> Date: Thu, 31 Oct 2024 11:52:06 +0800 Subject: [PATCH] Update operate.py MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 消除text_units_section_list源文件的换行,统一混合检索上下文合并时的转换 --- lightrag/operate.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lightrag/operate.py b/lightrag/operate.py index ef0d3398..3d7a752e 100644 --- a/lightrag/operate.py +++ b/lightrag/operate.py @@ -523,7 +523,7 @@ async def _build_local_query_context( text_units_section_list = [["id", "content"]] for i, t in enumerate(use_text_units): - text_units_section_list.append([i, t["content"]]) + text_units_section_list.append([i, t["content"].replace("\n", "").replace("\r", "")]) text_units_context = list_of_list_to_csv(text_units_section_list) return f""" -----Entities----- @@ -788,7 +788,7 @@ async def _build_global_query_context( text_units_section_list = [["id", "content"]] for i, t in enumerate(use_text_units): - text_units_section_list.append([i, t["content"]]) + text_units_section_list.append([i, t["content"].replace("\n", "").replace("\r", "")]) text_units_context = list_of_list_to_csv(text_units_section_list) return f"""