浏览代码

片尾去掉英文文案

zhangyong 8 月之前
父节点
当前提交
3b6ecb3b66
共有 1 个文件被更改,包括 13 次插入4 次删除
  1. 13 4
      common/gpt4o_help.py

+ 13 - 4
common/gpt4o_help.py

@@ -154,10 +154,19 @@ class GPT4o():
                 match = pattern.search(content)
                 if match:
                     pw = match.group(1)
-                    return pw
+                    # 检查文本中是否包含英文字母
+                    if re.search(r'[a-zA-Z]', pw):
+                        cleaned_text = re.sub(r'[a-zA-Z]', '', pw)
+                    else:
+                        cleaned_text = pw
+                    return cleaned_text
                 else:
                     if content:
-                        return content
+                        if re.search(r'[a-zA-Z]', content):
+                            cleaned_text = re.sub(r'[a-zA-Z]', '', content)
+                        else:
+                            cleaned_text = content
+                        return cleaned_text
                     if attempt == max_retries - 1:
                         return None
             except Exception:
@@ -166,5 +175,5 @@ class GPT4o():
 
 
 if __name__ == '__main__':
-    title = '女子每天打卡喊雷军"老公"被禁言'
-    GPT4o.get_ai_title(title)
+    title = '劝自己少生气'
+    GPT4o.get_ai_pw(title)