优化标签去除,解决搜索的grok标签问题
This commit is contained in:
@@ -13,3 +13,12 @@ def remove_trailing_content(text, delimiter='---'):
|
||||
if index != -1:
|
||||
return text[:index].strip()
|
||||
return text
|
||||
|
||||
import re
|
||||
|
||||
def remove_grok_render_tags(text: str) -> str:
|
||||
if not text:
|
||||
return text
|
||||
cleaned = re.sub(r'<\s*grok:[^>]+?>[\s\S]*?<\s*/\s*grok:[^>]+?>', '', text, flags=re.IGNORECASE)
|
||||
cleaned = re.sub(r'<\s*grok:[^>]+?/?>', '', cleaned, flags=re.IGNORECASE)
|
||||
return cleaned
|
||||
|
||||
Reference in New Issue
Block a user