fix(utils): 修复正则表达式以正确提取包含中文的内容

This commit is contained in:
Windpicker-owo
2025-12-16 15:56:31 +08:00
parent 7a500d15a1
commit 9f41f49578

View File

@@ -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)