avante.nvim icon indicating copy to clipboard operation
avante.nvim copied to clipboard

bug: rag does not seem to work when specifying a directory

Open gabrielrinaldi opened this issue 7 months ago • 1 comments

Describe the bug

When setting up the rag service to read ~/Code as my path, it seems to get a 404 on every add resource request.

To reproduce

To reproduce setup RAG with the following config:

      rag_service = {
        enabled = true,
        host_mount = os.getenv("HOME") .. "/Code",
        provider = "ollama",
        llm_model = "mistral",
        endpoint = "http://100.100.1.50:11434",
      },

Expected behavior

Avante RAG should map the path correctly to the path given

Installation method

Use lazy.nvim:

return {
  -- Setup Avante as AI option
  {
    "yetone/avante.nvim",
    lazy = true,
    event = "VeryLazy",
    version = false,
    build = "make",
    dependencies = {
      "nvim-treesitter/nvim-treesitter",
      "stevearc/dressing.nvim",
      "nvim-lua/plenary.nvim",
      "MunifTanjim/nui.nvim",
      "ravitemer/mcphub.nvim",
      {
        -- support for image pasting
        "HakonHarnes/img-clip.nvim",
        event = "VeryLazy",
        opts = {
          default = {
            embed_image_as_base64 = false,
            prompt_for_file_name = false,
            drag_and_drop = {
              insert_mode = true,
            },
          },
        },
      },
      {
        "MeanderingProgrammer/render-markdown.nvim",
        optional = true,
        ft = function(_, ft)
          vim.list_extend(ft, { "Avante" })
        end,
        opts = function(_, opts)
          opts.file_types = vim.list_extend(opts.file_types or {}, { "Avante" })
        end,
      },
    },
    opts = {
      provider = "claude",
      cursor_applying_provider = "claude",
      memory_summary_provider = "claude",
      behaviour = {
        support_paste_from_clipboard = true,
        enable_cursor_planning_mode = true,
        enable_claude_text_editor_tool_mode = true,
      },
      system_prompt = function()
        local hub = require("mcphub").get_hub_instance()
        if hub == nil then
          return nil
        else
          return hub:get_active_servers_prompt()
        end
      end,
      custom_tools = function()
        return {
          require("mcphub.extensions.avante").mcp_tool(),
        }
      end,
      hints = { enabled = true },
      file_selector = {
        provider = "snacks",
        provider_opts = {},
      },
      rag_service = {
        enabled = true,
        host_mount = os.getenv("HOME"),
        provider = "ollama",
        llm_model = "mistral",
        endpoint = "http://100.100.1.50:11434",
      },
      vendors = {
        ["kenobi-coder"] = {
          __inherited_from = "openai",
          api_key_name = "",
          endpoint = "http://100.100.1.50:11434/v1",
          model = "qwen2.5-coder:32b",
          max_tokens = 8192,
        },
        ["kenobi-llama"] = {
          __inherited_from = "openai",
          api_key_name = "ollama",
          endpoint = "http://100.100.1.50:11434/v1",
          model = "llama3.2",
          max_tokens = 8192,
        },
        ["kenobi-mistral"] = {
          __inherited_from = "openai",
          api_key_name = "ollama",
          endpoint = "http://100.100.1.50:11434/v1",
          model = "mistral",
          max_tokens = 8192,
        },
        ["kenobi-qwq"] = {
          __inherited_from = "openai",
          api_key_name = "",
          endpoint = "http://100.100.1.50:11434/v1",
          model = "qwq",
          max_tokens = 8192,
        },
      },
    },
  },
  {
    "stevearc/dressing.nvim",
    lazy = true,
    opts = {
      input = { enabled = false },
      select = { enabled = false },
    },
  },
  {
    "saghen/blink.compat",
    lazy = true,
    opts = {},
    config = function()
      require("cmp").ConfirmBehavior = {
        Insert = "insert",
        Replace = "replace",
      }
    end,
  },
  {
    "saghen/blink.cmp",
    lazy = true,
    opts = {
      sources = {
        default = { "avante_commands", "avante_mentions", "avante_files" },
        providers = {
          avante_commands = {
            name = "avante_commands",
            module = "blink.compat.source",
            score_offset = 90,
            opts = {},
          },
          avante_files = {
            name = "avante_files",
            module = "blink.compat.source",
            score_offset = 100,
            opts = {},
          },
          avante_mentions = {
            name = "avante_mentions",
            module = "blink.compat.source",
            score_offset = 1000,
            opts = {},
          },
        },
      },
    },
  },
}

Environment

neovim: v0.11.0-dev-2068+g5187be81c2 docker: colima os: macOS 15.3.2

Repro

See Avante configuration above

gabrielrinaldi avatar Mar 30 '25 17:03 gabrielrinaldi

Using just os.getenv("HOME") as in the documentation example does work, but it tries to index the .git causing a lot of errors.

gabrielrinaldi avatar Mar 30 '25 17:03 gabrielrinaldi

This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 5 days.

github-actions[bot] avatar Apr 30 '25 02:04 github-actions[bot]

This issue was closed because it has been stalled for 5 days with no activity.

github-actions[bot] avatar May 06 '25 02:05 github-actions[bot]