We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent bb2045b commit 4b2e631Copy full SHA for 4b2e631
1 file changed
lua/CopilotChat/tiktoken.lua
@@ -19,18 +19,19 @@ end
19
20
--- Load tiktoken data from cache or download it
21
local function load_tiktoken_data(done)
22
- local cache_path = get_cache_path()
23
- if file_exists(cache_path) then
24
- done(cache_path)
25
- return
26
- end
+ local async
+ async = vim.loop.new_async(function()
+ local cache_path = get_cache_path()
+ if not file_exists(cache_path) then
+ curl.get('https://openaipublic.blob.core.windows.net/encodings/cl100k_base.tiktoken', {
27
+ output = cache_path,
28
+ })
29
+ end
30
- curl.get('https://openaipublic.blob.core.windows.net/encodings/cl100k_base.tiktoken', {
- output = cache_path,
- callback = function()
31
32
- end,
33
- })
+ done(cache_path)
+ async:close()
+ end)
34
+ async:send()
35
end
36
37
local M = {}
0 commit comments