From edbc8561c7f1cde6410e16242a895bd3c0979ec6 Mon Sep 17 00:00:00 2001 From: shaohuzhang1 Date: Tue, 2 Jan 2024 15:34:19 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E5=88=86=E6=AE=B5=E9=94=99=E8=AF=AF,?= =?UTF-8?q?=E4=BC=9A=E8=AF=9D=E6=A8=A1=E6=9D=BF=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/application/serializers/chat_message_serializers.py | 2 +- apps/common/util/split_model.py | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/apps/application/serializers/chat_message_serializers.py b/apps/application/serializers/chat_message_serializers.py index 355647032..13eae7cb1 100644 --- a/apps/application/serializers/chat_message_serializers.py +++ b/apps/application/serializers/chat_message_serializers.py @@ -33,7 +33,7 @@ class MessageManagement: return HumanMessage(content=message) return HumanMessage(content=( f'已知信息:{title}:{content} ' - '根据上述已知信息,简洁和专业的来回答用户的问题。如果无法从已知信息中得到答案,请说 “根据已知信息无法回答该问题” 或 “没有提供足够的相关信息”,不允许在答案中添加编造成分,答案请使用中文。 ' + '根据上述已知信息,请简洁和专业的来回答用户的问题。已知信息中的图片、链接地址和脚本语言请直接返回。如果无法从已知信息中得到答案,请说 “没有在知识库中查找到相关信息,建议咨询相关技术支持或参考官方文档进行操作” 或 “根据已知信息无法回答该问题,建议联系官方技术支持人员”,不允许在答案中添加编造成分,答案请使用中文。' f'问题是:{message}')) diff --git a/apps/common/util/split_model.py b/apps/common/util/split_model.py index bc5f4df12..d9e06424e 100644 --- a/apps/common/util/split_model.py +++ b/apps/common/util/split_model.py @@ -331,11 +331,12 @@ class SplitModel: :return: 解析后数据 {content:段落数据,keywords:[‘段落关键词’],parent_chain:['段落父级链路']} """ result_tree = self.parse_to_tree(text.replace('\r', '\n'), 0) - return result_tree_to_paragraph(result_tree, [], []) + result = result_tree_to_paragraph(result_tree, [], []) + return [{**item, 'title': item.get('title').replace("#", '') if 'title' in item else ''} for item in result] default_split_pattern = { - 'md': [re.compile("^# .*"), re.compile('(?