Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -25,13 +25,13 @@ import re
|
|
25 |
|
26 |
def remove_think_tags(content):
|
27 |
"""刪除 <think>...</think> 標籤及其內容的正規表達式解法"""
|
28 |
-
|
29 |
-
|
30 |
|
31 |
-
# 刪除所有 <think> 標籤及其內容
|
32 |
-
cleaned_content = re.sub(r'<\s*think[^>]*>.*?<\s*/\s*think\s*>', '', content, flags=re.DOTALL)
|
33 |
-
# 清除殘留空行 (連續兩個以上換行符)
|
34 |
-
cleaned_content = re.sub(r'\n{3,}', '\n\n', cleaned_content)
|
35 |
|
36 |
return cleaned_content.strip()
|
37 |
|
|
|
25 |
|
26 |
def remove_think_tags(content):
|
27 |
"""刪除 <think>...</think> 標籤及其內容的正規表達式解法"""
|
28 |
+
pattern = r'<think>.*?</think>'
|
29 |
+
cleaned_content = re.sub(pattern, '', content, flags=re.DOTALL)
|
30 |
|
31 |
+
# # 刪除所有 <think> 標籤及其內容
|
32 |
+
# cleaned_content = re.sub(r'<\s*think[^>]*>.*?<\s*/\s*think\s*>', '', content, flags=re.DOTALL)
|
33 |
+
# # 清除殘留空行 (連續兩個以上換行符)
|
34 |
+
# cleaned_content = re.sub(r'\n{3,}', '\n\n', cleaned_content)
|
35 |
|
36 |
return cleaned_content.strip()
|
37 |
|