更新视频文案过滤器
This commit is contained in:
parent
cd92c898df
commit
da04102e7e
@ -148,8 +148,11 @@ class ContentAnalysisAPI(APIView):
|
||||
"""过滤掉 <think>...</think> 及其内容, 只保留模型回复内容, 并解析出 Version1 和 Version2"""
|
||||
import re
|
||||
text = re.sub(r"<think>.*?</think>\s*", "", ai_response, flags=re.DOTALL)
|
||||
# 匹配 Version1 和 Version2,无需 ###
|
||||
match = re.search(r'Version1:?\s*([\s\S]*?)Version2:?\s*([\s\S]*)', text, re.IGNORECASE)
|
||||
# 更宽松地匹配 Version 1 和 Version 2
|
||||
match = re.search(
|
||||
r'(?:\*\*)?Version\s*1:?[\s\*:]*([\s\S]*?)(?:\*\*)?Version\s*2:?([\s\S]*)',
|
||||
text, re.IGNORECASE
|
||||
)
|
||||
if match:
|
||||
version1 = match.group(1).strip().strip('"')
|
||||
version2 = match.group(2).strip().strip('"')
|
||||
|
Loading…
Reference in New Issue
Block a user