]> source.dussan.org Git - rspamd.git/commitdiff
[Minor] Apply review suggestion
authorVsevolod Stakhov <vsevolod@rspamd.com>
Fri, 28 Jun 2024 14:11:42 +0000 (15:11 +0100)
committerVsevolod Stakhov <vsevolod@rspamd.com>
Fri, 28 Jun 2024 14:11:42 +0000 (15:11 +0100)
src/plugins/lua/gpt.lua

index ca39794c5734c9434996226278a115a122d4f436..79f8882ce7d1a1de58bc3de6c3edfbf6cf0ef52d 100644 (file)
@@ -138,11 +138,7 @@ local function default_condition(task)
     local words = sel_part:get_words('norm')
     nwords = #words
     if nwords > settings.max_tokens then
-      -- Trim something that does not fit
-      for i = nwords, settings.max_tokens, -1 do
-        rawset(words, i, nil)
-      end
-      return true, table.concat(words, ' ')
+      return true, table.concat(words, ' ', 1, settings.max_tokens)
     end
   end
   return true, sel_part:get_content_oneline()