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)