]> git.ipfire.org Git - thirdparty/rspamd.git/commitdiff
[Fix] Use versioned key for manual training in symbols-only mode
authorVsevolod Stakhov <vsevolod@rspamd.com>
Thu, 22 Jan 2026 18:36:26 +0000 (18:36 +0000)
committerVsevolod Stakhov <vsevolod@rspamd.com>
Thu, 22 Jan 2026 18:36:26 +0000 (18:36 +0000)
Manual training via ANN-Train header now writes to versioned key when
no LLM provider is configured. The pending key is only used with LLM
providers where embedding dimensions may vary between versions.

src/plugins/lua/neural.lua

index f54ea1a5e6efbb0f79ab2572b001f02d64bb111b..85c74af68fb89dc0806b51afb1684dfb495e7501 100644 (file)
@@ -364,9 +364,10 @@ local function ann_push_task_result(rule, task, verdict, score, set)
             end
 
             local str = rspamd_util.zstd_compress(table.concat(vec, ';'))
-            -- For manual training, use stable pending key to avoid version mismatch
+            -- For manual training with LLM providers, use stable pending key to avoid version mismatch
+            -- For symbols-only mode, use versioned key directly (dimension is stable)
             local target_key
-            if manual_train then
+            if manual_train and has_llm_provider then
               target_key = neural_common.pending_train_key(rule, set) .. '_' .. learn_type .. '_set'
             else
               target_key = set.ann.redis_key .. '_' .. learn_type .. '_set'