From 87f7374876a93f4ae2e8b2ed160216704c654f02 Mon Sep 17 00:00:00 2001 From: nanhaoluo <3075912108@qq.com> Date: Thu, 22 Jan 2026 18:28:33 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=20functions.php=20?= =?UTF-8?q?=E8=AF=AD=E6=B3=95=E9=94=99=E8=AF=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 删除第 7513-7544 行重复的代码片段 - 修复 Unmatched '}' 错误 - 该重复代码导致函数外出现孤立的代码块 --- functions.php | 33 --------------------------------- 1 file changed, 33 deletions(-) diff --git a/functions.php b/functions.php index 37c6caf..19ce684 100644 --- a/functions.php +++ b/functions.php @@ -7509,39 +7509,6 @@ function argon_call_ai_api_for_spam_detection($provider, $api_key, $model, $prom return $result; } - $ai_response = ''; - if ($provider === 'anthropic') { - if (isset($response_body['content'][0]['text'])) { - $ai_response = $response_body['content'][0]['text']; - } - } else { - if (isset($response_body['choices'][0]['message']['content'])) { - $ai_response = $response_body['choices'][0]['message']['content']; - } - } - - if (empty($ai_response)) { - return false; - } - - // 解析 JSON 响应 - $result = json_decode($ai_response, true); - if (!$result || !isset($result['is_spam'])) { - // 尝试从文本中提取 JSON - if (preg_match('/\{[^}]*"is_spam"[^}]*\}/s', $ai_response, $matches)) { - $result = json_decode($matches[0], true); - } - } - - if ($result && isset($result['is_spam'])) { - return [ - 'is_spam' => (bool)$result['is_spam'], - 'reason' => isset($result['reason']) ? mb_substr($result['reason'], 0, 25) : '未知原因' - ]; - } - - return false; -} /** * 新评论发布时自动检测