yetone / avante.nvim

Use your Neovim like using Cursor AI IDE!
Apache License 2.0
4.98k stars 164 forks source link

Has issue loading `tiktoken_core` unless it modify the code to load the absolute path #16

Closed atlas-comstock closed 4 weeks ago

atlas-comstock commented 4 weeks ago

local ok, core = pcall(require, "tiktoken_core")

https://github.com/yetone/avante.nvim/blob/26748729455cfc95704c204ec0d6cb548d99f493/lua/avante/tiktoken.lua#L53

The load is failed, and shown tiktoken_core is not found!!!!

I modified it to

  local dylib_path = "/Users/myname/.vim/plugged/avante.nvim/build/tiktoken_core.dylib"
  local ok, core = pcall(package.loadlib, dylib_path, "luaopen_tiktoken_core")

then it works.

atlas-comstock commented 4 weeks ago

After setup, have this error

   Error  12:15:44 msg_show.lua_error Error executing luv callback:
...guser/.vim/plugged/avante.nvim/lua/avante/tiktoken.lua:69: attempt to index upvalue 'core' (a function value)
stack traceback:
    ...guser/.vim/plugged/avante.nvim/lua/avante/tiktoken.lua:69: in function 'done'
    ...guser/.vim/plugged/avante.nvim/lua/avante/tiktoken.lua:42: in function <...guser/.vim/plugged/avante.nvim/lua/avante/tiktoken.lua:31>
atlas-comstock commented 4 weeks ago

I am using LuaJIT, make luajit to build the tiktoken_core

aarnphm commented 4 weeks ago

can you pull from the latest change on main? It should already patch cpath with the dylib path

atlas-comstock commented 4 weeks ago

@aarnphm same issue using latest master, commit id 78be877a3ec69ada3b3826bc57336a5b4bdc7a05

kohane27 commented 4 weeks ago

Not OP but I have the same problem:

return {
  "yetone/avante.nvim",
  event = "VeryLazy",
  build = "make",
  dependencies = {
    "nvim-tree/nvim-web-devicons",
    "grapp-dev/nui-components.nvim",
    "MunifTanjim/nui.nvim",
    "nvim-lua/plenary.nvim",
    "MeanderingProgrammer/render-markdown.nvim",
  },
  opts = {
    provider = "claude",
  },
}

Tried on the latest commit (ce5d421c982452739b0e94083d36c54daeb364ea) but to no avail. Any help is much appreciated. Thank you!