Browse Source

标题优化

zhangyong 9 months ago
parent
commit
532c52ee14
1 changed files with 4 additions and 3 deletions
  1. 4 3
      common/gpt4o_help.py

+ 4 - 3
common/gpt4o_help.py

@@ -76,9 +76,10 @@ class GPT4o():
                 else:
                     content = response['data']['choices'][0]['message']['content']
                     if content:
-                        match = re.search(r'"新标题":\s*"([^"]+)"', content)
-                        if match:
-                            return match.group(1)
+                        data = json.loads(content)
+                        title = data["title"]
+                        if title:
+                            return title
                         else:
                             return content
                     elif attempt == max_retries - 1: