问题:Avante插件永远不会响应生成的响应。它永远挂着。
怀疑: API密钥或其使用方式有问题。
问题:
设置:
我将标准的 avante 安装复制到
~/.config/nvim/lua/plugins/avante'
,如下所示。
我为克劳德付钱。我通过访问:https://console.anthropic.com/settings/keys 并创建一个新密钥来创建我的 anthropic api 密钥。
我尝试通过三种方式设置此键:
~/.config/fish/config.fish
中我添加了set -gx ANTHROPIC_API_KEY <MY-API-KEY>
。我验证了它是通过运行 source ~/.config/fish/config.fish
然后运行 echo $ANTHROPIC_API_KEY
来设置的。<leader>aa
。 Avante 提示我输入 ANTHROPIC_API_KEY
,然后我输入我的真实 api 密钥。<leader>aa
。 Avante 提示我输入 ANTHROPIC_API_KEY
,然后我随机输入一些内容,例如:asdfasdfjkl
。然后我
nvim index.js
和<leader>aa
打开Avante。我输入一个提示,例如。 Write a Javascript function that takes in two arguments and returns their sum.
,然后按 Ctrl-S,我就会永远看到 Generating response ...
。
它从不输出任何内容。它永远挂在这里:
---
- Datetime: 2024-12-03 09:43:21
- Model: claude/claude-3-5-sonnet-20241022
- Selected file: index.js
> Write a Javascript function that takes in two arguments and returns their sum.
**Generating response ...**
这三个都产生相同的结果。我的 API 密钥似乎不正确,因为它的行为与我为 API 密钥提供随机值时的行为相同。
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
},
-- 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 = {
"stevearc/dressing.nvim",
"nvim-lua/plenary.nvim",
"MunifTanjim/nui.nvim",
--- The below dependencies are optional,
"hrsh7th/nvim-cmp", -- autocompletion for avante commands and mentions
"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" },
},
}
}
问题是我没有给人类添加学分。我认为既然我是用 Claude.ai 支付“专业”帐户费用,那么这会起作用。事实并非如此。
解决方案:我向 Anthropic 添加了积分,然后取消了我的 Claude.ai 订阅。