fix(ci): lua style (#948)
This commit is contained in:
parent
4d1447b62f
commit
9e0b5bf8f1
@ -180,15 +180,11 @@ P.repo_map = RepoMap
|
|||||||
|
|
||||||
---@return AvanteTemplates|nil
|
---@return AvanteTemplates|nil
|
||||||
P._init_templates_lib = function()
|
P._init_templates_lib = function()
|
||||||
if templates ~= nil then
|
if templates ~= nil then return templates end
|
||||||
return templates
|
|
||||||
end
|
|
||||||
local ok, module = pcall(require, "avante_templates")
|
local ok, module = pcall(require, "avante_templates")
|
||||||
---@cast module AvanteTemplates
|
---@cast module AvanteTemplates
|
||||||
---@cast ok boolean
|
---@cast ok boolean
|
||||||
if not ok then
|
if not ok then return nil end
|
||||||
return nil
|
|
||||||
end
|
|
||||||
templates = module
|
templates = module
|
||||||
|
|
||||||
return templates
|
return templates
|
||||||
|
@ -17,22 +17,16 @@ local RepoMap = {}
|
|||||||
|
|
||||||
---@return AvanteRepoMap|nil
|
---@return AvanteRepoMap|nil
|
||||||
function RepoMap._init_repo_map_lib()
|
function RepoMap._init_repo_map_lib()
|
||||||
if repo_map_lib ~= nil then
|
if repo_map_lib ~= nil then return repo_map_lib end
|
||||||
return repo_map_lib
|
|
||||||
end
|
|
||||||
|
|
||||||
local ok, core = pcall(require, "avante_repo_map")
|
local ok, core = pcall(require, "avante_repo_map")
|
||||||
if not ok then
|
if not ok then return nil end
|
||||||
return nil
|
|
||||||
end
|
|
||||||
|
|
||||||
repo_map_lib = core
|
repo_map_lib = core
|
||||||
return repo_map_lib
|
return repo_map_lib
|
||||||
end
|
end
|
||||||
|
|
||||||
function RepoMap.setup()
|
function RepoMap.setup() vim.defer_fn(RepoMap._init_repo_map_lib, 1000) end
|
||||||
vim.defer_fn(RepoMap._init_repo_map_lib, 1000)
|
|
||||||
end
|
|
||||||
|
|
||||||
function RepoMap.get_ts_lang(filepath)
|
function RepoMap.get_ts_lang(filepath)
|
||||||
local filetype = RepoMap.get_filetype(filepath)
|
local filetype = RepoMap.get_filetype(filepath)
|
||||||
|
@ -13,14 +13,10 @@ local M = {}
|
|||||||
---@param model "gpt-4o" | string
|
---@param model "gpt-4o" | string
|
||||||
---@return AvanteTokenizer|nil
|
---@return AvanteTokenizer|nil
|
||||||
M._init_tokenizers_lib = function(model)
|
M._init_tokenizers_lib = function(model)
|
||||||
if tokenizers ~= nil then
|
if tokenizers ~= nil then return tokenizers end
|
||||||
return tokenizers
|
|
||||||
end
|
|
||||||
|
|
||||||
local ok, core = pcall(require, "avante_tokenizers")
|
local ok, core = pcall(require, "avante_tokenizers")
|
||||||
if not ok then
|
if not ok then return nil end
|
||||||
return nil
|
|
||||||
end
|
|
||||||
|
|
||||||
---@cast core AvanteTokenizer
|
---@cast core AvanteTokenizer
|
||||||
tokenizers = core
|
tokenizers = core
|
||||||
@ -35,9 +31,7 @@ end
|
|||||||
M.setup = function(model, warning)
|
M.setup = function(model, warning)
|
||||||
current_model = model
|
current_model = model
|
||||||
warning = warning or true
|
warning = warning or true
|
||||||
vim.defer_fn(function()
|
vim.defer_fn(function() M._init_tokenizers_lib(model) end, 1000)
|
||||||
M._init_tokenizers_lib(model)
|
|
||||||
end, 1000)
|
|
||||||
|
|
||||||
if warning then
|
if warning then
|
||||||
local HF_TOKEN = os.getenv("HF_TOKEN")
|
local HF_TOKEN = os.getenv("HF_TOKEN")
|
||||||
|
Loading…
x
Reference in New Issue
Block a user