Ver código fonte

标题优化

zhangyong 10 meses atrás
pai
commit
532c52ee14
1 arquivos alterados com 4 adições e 3 exclusões
  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: