Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DIAL inside Neovim (avante.nvim aka Cursor AI IDE) 🎉 #201

Open
sergey-tihon opened this issue Sep 25, 2024 · 0 comments
Open

DIAL inside Neovim (avante.nvim aka Cursor AI IDE) 🎉 #201

sergey-tihon opened this issue Sep 25, 2024 · 0 comments

Comments

@sergey-tihon
Copy link

sergey-tihon commented Sep 25, 2024

What do you see on the screenshot

dial-avante-nvim-public

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

dial-avante-code-fix
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: No status
Development

No branches or pull requests

1 participant