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

bug: file is already in the context! why are you

Open nemanja-mudrinic-marbelztech opened this issue 8 months ago • 2 comments

Describe the bug

Beside issue that is showing up, when ever i do ask avante - screenshot below, Its a bit slow maybe i have also some wrong configuration, or there is a need to clean up between new requests

Since after first execution, i had issue that i tried to load some deleted file which was not inside Selected Files, anyhow on each of those exectuion Im always getting "warning/error" but after few minutes I get result

Image

To reproduce

return {
  {
    'yetone/avante.nvim',
    event = 'VeryLazy',
    lazy = false,
    version = false,
    build = function()
      local plugin_dir = vim.fn.stdpath('data') .. '/lazy/avante.nvim'
      vim.fn.system('cd ' .. plugin_dir .. ' && LUA_VERSION=luajit bash ./build.sh')
    end,
    opts = {
      provider = 'claude',
      claude = {
        endpoint = 'https://api.anthropic.com',
        model = 'claude-3-7-sonnet-20250219',
        temperature = 0,
        max_tokens = 8000,
        timeout = 30000,
        api_key_name = 'ANTHROPIC_API_KEY',
        ['local'] = false,
      },
      mappings = {
        diff = {
          ours = 'co',
          theirs = 'ct',
          all_theirs = 'ca',
          both = 'cb',
          cursor = 'cc',
          next = ']x',
          prev = '[x',
        },
      },
      windows = {
        position = 'right',
        wrap = true,
        width = 60,
        sidebar_header = {
          align = 'center',
          rounded = true,
        },
      },
    },
    dependencies = {
      'nvim-treesitter/nvim-treesitter',
      'stevearc/dressing.nvim',
      'nvim-lua/plenary.nvim',
      'MunifTanjim/nui.nvim',
      'nvim-tree/nvim-web-devicons',
      'zbirenbaum/copilot.lua',
      {
        'HakonHarnes/img-clip.nvim',
        event = 'VeryLazy',
        opts = {
          default = {
            embed_image_as_base64 = false,
            prompt_for_file_name = false,
            drag_and_drop = {
              insert_mode = true,
            },
            use_absolute_path = true,
          },
        },
      },
      {
        'MeanderingProgrammer/render-markdown.nvim',
        opts = {
          file_types = { 'markdown', 'Avante' },
        },
        ft = { 'markdown', 'Avante' },
      },
    },
  },
}

Expected behavior

No response

Installation method

Use lazy.nvim:

{
  "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
  },
  -- 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",
  },
}

Environment

neovim version: NVIM v0.10.4 Build type: Release LuaJIT 2.1.1736781742 platform: macos m4 chip

Repro

vim.env.LAZY_STDPATH = ".repro"
load(vim.fn.system("curl -s https://raw.githubusercontent.com/folke/lazy.nvim/main/bootstrap.lua"))()

require("lazy.minit").repro({
  spec = {
    -- add any other plugins here
  },
})

same here

YuCao16 avatar Apr 01 '25 13:04 YuCao16

Same

BenceBakos avatar Apr 01 '25 20:04 BenceBakos

Same

mr-scrpt avatar Apr 15 '25 12:04 mr-scrpt

‌‌‌‌‌‌‌This is not a bug, nor an error report. It is an issue where the large model insists on accessing a file that is already in context, and this is merely to prevent wasting too many tokens.

yetone avatar Apr 15 '25 12:04 yetone

‌‌‌‌‌‌‌This is not a bug, nor an error report. It is an issue where the large model insists on accessing a file that is already in context, and this is merely to prevent wasting too many tokens.

I got this message when I clicked "aa" in a newly created file and it was alone in the list of added files Tried pre-calling the AvanteClear command still I see this message

mr-scrpt avatar Apr 15 '25 13:04 mr-scrpt