From e195e53a2fd60c6b18037a9151ee78fd81cc0bc9 Mon Sep 17 00:00:00 2001 From: gptlang Date: Tue, 23 Jul 2024 00:19:26 +0800 Subject: [PATCH] fix #261: initiallize tiktoken from scheduled thread if not downloaded (during first use only) --- lua/CopilotChat/tiktoken.lua | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lua/CopilotChat/tiktoken.lua b/lua/CopilotChat/tiktoken.lua index f751cc00..f7639548 100644 --- a/lua/CopilotChat/tiktoken.lua +++ b/lua/CopilotChat/tiktoken.lua @@ -34,10 +34,11 @@ local function load_tiktoken_data(done, model) curl.get(tiktoken_url, { output = cache_path, }) + done(cache_path) end) + else + done(cache_path) end - - done(cache_path) async:close() end) async:send()