aicodingfun commited on
Commit
483cbac
·
verified ·
1 Parent(s): 12bfc9d

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -6
app.py CHANGED
@@ -25,13 +25,13 @@ import re
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
 
 
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