From: Vsevolod Stakhov Date: Tue, 10 Dec 2024 14:22:22 +0000 (+0000) Subject: [Minor] GPT: add `allow_passthrough` and `allow_ham` settings X-Git-Tag: 3.11.0~9 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=7d3200169892d35ac3f9ec4234a71828041bf521;p=thirdparty%2Frspamd.git [Minor] GPT: add `allow_passthrough` and `allow_ham` settings --- diff --git a/src/plugins/lua/gpt.lua b/src/plugins/lua/gpt.lua index 823dbd0452..014f47d72f 100644 --- a/src/plugins/lua/gpt.lua +++ b/src/plugins/lua/gpt.lua @@ -44,6 +44,10 @@ gpt { reply_conversion = "xxx"; # URL for the API url = "https://api.openai.com/v1/chat/completions"; + # Check messages with passthrough result + allow_passthrough = false; + # Check messages that are apparent ham (no action and negative score) + allow_ham = false; } ]]) return @@ -78,6 +82,8 @@ local settings = { autolearn = false, url = 'https://api.openai.com/v1/chat/completions', symbols_to_except = default_symbols_to_except, + allow_passthrough = false, + allow_ham = false, } local function default_condition(task) @@ -87,7 +93,7 @@ local function default_condition(task) -- 3) Skip already decided as ham local result = task:get_metric_result() if result then - if result.passthrough then + if result.passthrough and not settings.allow_passthrough then return false, 'passthrough' end local score = result.score @@ -97,7 +103,7 @@ local function default_condition(task) return false, 'already decided as spam' end - if action == 'no action' and score < 0 then + if (action == 'no action' and score < 0) and not settings.allow_ham then return false, 'negative score, already decided as ham' end end