diff --git a/after/plugin/avante.lua b/after/plugin/avante.lua index de09320..927de75 100644 --- a/after/plugin/avante.lua +++ b/after/plugin/avante.lua @@ -3,7 +3,7 @@ local Clipboard = require("avante.clipboard") local Config = require("avante.config") -if Config.support_paste_image() then +if Config.support_paste_image(true) then vim.paste = (function(overriden) ---@param lines string[] ---@param phase -1|1|2|3 diff --git a/lua/avante/config.lua b/lua/avante/config.lua index 86875ce..4f57fbc 100644 --- a/lua/avante/config.lua +++ b/lua/avante/config.lua @@ -12,6 +12,12 @@ M.defaults = { debug = false, ---@alias Provider "claude" | "openai" | "azure" | "gemini" | "cohere" | "copilot" | string provider = "claude", -- Only recommend using Claude + ---@alias Tokenizer "tiktoken" | "hf" + -- Used for counting tokens and encoding text. + -- By default, we will use tiktoken. + -- For most providers that we support we will determine this automatically. + -- If you wish to use a given implementation, then you can override it here. + tokenizer = "tiktoken", ---@type AvanteSupportedProvider openai = { endpoint = "https://api.openai.com/v1", @@ -231,7 +237,13 @@ M = setmetatable(M, { end, }) -M.support_paste_image = function() +---@param skip_warning? boolean +M.support_paste_image = function(skip_warning) + skip_warning = skip_warning or M.silent_warning + if skip_warning then + return + end + local supported = Utils.has("img-clip.nvim") or Utils.has("img-clip") if not supported then Utils.warn("img-clip.nvim is not installed. Pasting image will be disabled.", { once = true })