feat(templates): avanterules filetype support (closes #254) (#466)

Signed-off-by: Aaron Pham <contact@aarnphm.xyz>
This commit is contained in:
Aaron Pham
2024-09-03 04:09:13 -04:00
committed by GitHub
parent 054695cc63
commit 4ad913435c
31 changed files with 962 additions and 265 deletions

View File

@@ -9,14 +9,19 @@ local M = {}
---@param model "gpt-4o" | string
M.setup = function(model)
local ok, core = pcall(require, "avante_tokenizers")
if not ok then
return
end
---@cast core AvanteTokenizer
if tokenizers == nil then
tokenizers = core
end
vim.defer_fn(function()
local ok, core = pcall(require, "avante_tokenizers")
if not ok then
return
end
---@cast core AvanteTokenizer
if tokenizers == nil then
tokenizers = core
end
core.from_pretrained(model)
end, 1000)
local HF_TOKEN = os.getenv("HF_TOKEN")
if HF_TOKEN == nil and model ~= "gpt-4o" then
@@ -26,9 +31,6 @@ M.setup = function(model)
)
end
vim.env.HF_HUB_DISABLE_PROGRESS_BARS = 1
---@cast core AvanteTokenizer
core.from_pretrained(model)
end
M.available = function()