]> git.ipfire.org Git - thirdparty/rspamd.git/commitdiff
[Minor] Allow autolearn
authorVsevolod Stakhov <vsevolod@rspamd.com>
Fri, 28 Jun 2024 14:14:54 +0000 (15:14 +0100)
committerVsevolod Stakhov <vsevolod@rspamd.com>
Fri, 28 Jun 2024 14:14:54 +0000 (15:14 +0100)
src/plugins/lua/gpt.lua

index 79f8882ce7d1a1de58bc3de6c3edfbf6cf0ef52d..e12bcf8071576eb98304eef3bb7b1b1597e9badc 100644 (file)
@@ -221,13 +221,18 @@ local function openai_gpt_check(task)
 
     if reply > 0.75 then
       task:insert_result('GPT_SPAM', (reply - 0.75) * 4, tostring(reply))
+      if settings.autolearn then
+        task:set_flag("learn_spam")
+      end
     elseif reply < 0.25 then
       task:insert_result('GPT_HAM', (0.25 - reply) * 4, tostring(reply))
+      if settings.autolearn then
+        task:set_flag("learn_ham")
+      end
     else
       lua_util.debugm(N, task, "uncertain result: %s", reply)
     end
 
-    -- TODO: add autolearn here
   end
 
   local body = {