ai-dial
ai-dial copied to clipboard
DIAL inside Neovim (avante.nvim aka Cursor AI IDE) 🎉
What do you see on the screenshot
- Neovim (https://www.lazyvim.org setup)
- avante.nvim - Neovim plugin designed to emulate the behaviour of the Cursor AI IDE.
- The custom provider that configures DIAL as a backend for avante.nvim.
Full plugin config (avante.lua):
return {
"yetone/avante.nvim",
event = "VeryLazy",
lazy = false,
version = false, -- set this if you want to always pull the latest change
opts = {
-- add any opts here
-- provider = "copilot",
provider = "dial",
vendors = {
dial = {
endpoint = "https://<domain>/openai/deployments/{deployment}/chat/completions",
model = "anthropic.claude-v3-5-sonnet",
api_key_name = "DIAL_API_KEY",
parse_curl_args = function(opts, code_opts)
return {
url = opts.endpoint:gsub("{deployment}", opts.model),
headers = {
["Accept"] = "application/json",
["Content-Type"] = "application/json",
["Api-Key"] = os.getenv(opts.api_key_name),
},
body = {
model = opts.model,
messages = { -- you can make your own message, but this is very advanced
{ role = "system", content = code_opts.system_prompt },
{ role = "user", content = require("avante.providers.openai").get_user_message(code_opts) },
},
temperature = 0,
max_tokens = 8000,
stream = true, -- this will be set by default.
},
}
end,
parse_response_data = function(data_stream, event_state, opts)
require("avante.providers").openai.parse_response(data_stream, event_state, opts)
end,
},
},
},
-- if you want to build from source then do `make BUILD_FROM_SOURCE=true`
build = "make",
-- build = "powershell -ExecutionPolicy Bypass -File Build.ps1 -BuildFromSource false" -- for windows
dependencies = {
"nvim-treesitter/nvim-treesitter",
"stevearc/dressing.nvim",
"nvim-lua/plenary.nvim",
"MunifTanjim/nui.nvim",
--- The below dependencies are optional,
"nvim-tree/nvim-web-devicons", -- or echasnovski/mini.icons
"zbirenbaum/copilot.lua", -- for providers='copilot'
{
-- support for image pasting
"HakonHarnes/img-clip.nvim",
event = "VeryLazy",
opts = {
-- recommended settings
default = {
embed_image_as_base64 = false,
prompt_for_file_name = false,
drag_and_drop = {
insert_mode = true,
},
-- required for Windows users
use_absolute_path = true,
},
},
},
{
-- Make sure to set this up properly if you have lazy=true
"MeanderingProgrammer/render-markdown.nvim",
opts = {
file_types = { "markdown", "Avante" },
},
ft = { "markdown", "Avante" },
},
},
}
and it works like a charm