From db08bfd4cc611f77a6ef125da23a19c67e2cf657 Mon Sep 17 00:00:00 2001 From: Vsevolod Stakhov Date: Fri, 28 Jun 2024 15:11:42 +0100 Subject: [PATCH] [Minor] Apply review suggestion --- src/plugins/lua/gpt.lua | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/src/plugins/lua/gpt.lua b/src/plugins/lua/gpt.lua index ca39794c5..79f8882ce 100644 --- a/src/plugins/lua/gpt.lua +++ b/src/plugins/lua/gpt.lua @@ -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() -- 2.39.5