summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@rspamd.com>2024-06-28 15:06:05 +0100
committerVsevolod Stakhov <vsevolod@rspamd.com>2024-06-28 15:06:05 +0100
commit0c6780d66e5f208bc4806ab227990d15af400776 (patch)
tree186b5a064e6747953f742941af659fac9ef76f41 /src
parent943c3f2d2aef8329e6882f2bd66e6c30669730b8 (diff)
downloadrspamd-0c6780d66e5f208bc4806ab227990d15af400776.tar.gz
rspamd-0c6780d66e5f208bc4806ab227990d15af400776.zip
[Minor] Make except symbols configurable
Diffstat (limited to 'src')
-rw-r--r--src/plugins/lua/gpt.lua21
1 files changed, 11 insertions, 10 deletions
diff --git a/src/plugins/lua/gpt.lua b/src/plugins/lua/gpt.lua
index 3e3a6737d..ca39794c5 100644
--- a/src/plugins/lua/gpt.lua
+++ b/src/plugins/lua/gpt.lua
@@ -55,6 +55,15 @@ local rspamd_http = require "rspamd_http"
local rspamd_logger = require "rspamd_logger"
local ucl = require "ucl"
+-- Exclude checks if one of those is found
+local default_symbols_to_except = {
+ 'BAYES_SPAM', -- We already know that it is a spam, so we can safely skip it, but no same logic for HAM!
+ 'WHITELIST_SPF',
+ 'WHITELIST_DKIM',
+ 'WHITELIST_DMARC',
+ 'FUZZY_DENIED',
+}
+
local settings = {
type = 'openai',
api_key = nil,
@@ -67,15 +76,7 @@ local settings = {
condition = nil,
autolearn = false,
url = 'https://api.openai.com/v1/chat/completions',
-}
-
--- Exclude checks if one of those is found
-local symbols_to_except = {
- 'BAYES_SPAM', -- We already know that it is a spam, so we can safely skip it, but no same logic for HAM!
- 'WHITELIST_SPF',
- 'WHITELIST_DKIM',
- 'WHITELIST_DMARC',
- 'FUZZY_DENIED',
+ symbols_to_except = default_symbols_to_except,
}
local function default_condition(task)
@@ -100,7 +101,7 @@ local function default_condition(task)
end
end
-- We also exclude some symbols
- for _, s in ipairs(symbols_to_except) do
+ for _, s in ipairs(settings.symbols_to_except) do
if task:has_symbol(s) then
return false, 'skip as "' .. s .. '" is found'
end