Skip to content

Commit

Permalink
Move cache path and IO outside of vim.loop
Browse files Browse the repository at this point in the history
Signed-off-by: Tomas Slusny <[email protected]>
  • Loading branch information
deathbeam committed Oct 30, 2024
1 parent e172d73 commit 44fc8c4
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions lua/CopilotChat/tiktoken.lua
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,11 @@ local function load_tiktoken_data(done, model)
if model ~= nil and vim.startswith(model, 'gpt-4o') then
tiktoken_url = 'https://openaipublic.blob.core.windows.net/encodings/o200k_base.tiktoken'
end
-- Take filename after the last slash of the url
local cache_path = get_cache_path(tiktoken_url:match('.+/(.+)'))

local async
async = vim.loop.new_async(function()
-- Take filename after the last slash of the url
local cache_path = get_cache_path(tiktoken_url:match('.+/(.+)'))
if not file_exists(cache_path) then
vim.schedule(function()
curl.get(tiktoken_url, {
Expand Down

0 comments on commit 44fc8c4

Please sign in to comment.