fix(utils): 修复正则表达式以正确提取包含中文的内容
This commit is contained in:
@@ -428,7 +428,7 @@ def process_llm_response(text: str, enable_splitter: bool = True, enable_chinese
|
||||
protected_text, special_blocks_mapping = protect_special_blocks(protected_text)
|
||||
|
||||
# 提取被 () 或 [] 或 ()包裹且包含中文的内容
|
||||
pattern = re.compile(r"[(\[(](?=.*[一-鿿]).*?[)\])]")
|
||||
pattern = re.compile(r"[(\[(](?=.*[一-鿿]).+?[)\])]")
|
||||
_extracted_contents = pattern.findall(protected_text)
|
||||
cleaned_text = pattern.sub("", protected_text)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user