mirror of
https://github.com/1Panel-dev/MaxKB.git
synced 2025-12-26 01:33:05 +00:00
fix: 分段错误,会话模板修改
This commit is contained in:
parent
6288edf02a
commit
edbc8561c7
|
|
@ -33,7 +33,7 @@ class MessageManagement:
|
|||
return HumanMessage(content=message)
|
||||
return HumanMessage(content=(
|
||||
f'已知信息:{title}:{content} '
|
||||
'根据上述已知信息,简洁和专业的来回答用户的问题。如果无法从已知信息中得到答案,请说 “根据已知信息无法回答该问题” 或 “没有提供足够的相关信息”,不允许在答案中添加编造成分,答案请使用中文。 '
|
||||
'根据上述已知信息,请简洁和专业的来回答用户的问题。已知信息中的图片、链接地址和脚本语言请直接返回。如果无法从已知信息中得到答案,请说 “没有在知识库中查找到相关信息,建议咨询相关技术支持或参考官方文档进行操作” 或 “根据已知信息无法回答该问题,建议联系官方技术支持人员”,不允许在答案中添加编造成分,答案请使用中文。'
|
||||
f'问题是:{message}'))
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -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('(?<!#)## (?!#).*'), re.compile("(?<!#)### (?!#).*"),
|
||||
'md': [re.compile('(?<!#)# (?!#).*'), re.compile('(?<!#)## (?!#).*'), re.compile("(?<!#)### (?!#).*"),
|
||||
re.compile("(?<!#)####(?!#).*"), re.compile("(?<!#)#####(?!#).*"),
|
||||
re.compile("(?<!#)######(?!#).*")],
|
||||
'default': [re.compile("(?<!\n)\n\n.+")]
|
||||
|
|
|
|||
Loading…
Reference in New Issue