feat: cursor planning mode enabled by default (#1316)

This commit is contained in:
yetone
2025-02-20 13:06:17 +08:00
committed by GitHub
parent 2991ca69a0
commit 5b006624e6
4 changed files with 12 additions and 7 deletions

View File

@@ -255,11 +255,12 @@ _See [config.lua#L9](./lua/avante/config.lua) for the full config_
```lua
{
---@alias Provider "claude" | "openai" | "azure" | "gemini" | "cohere" | "copilot" | string
provider = "claude", -- Recommend using Claude
provider = "claude", -- The provider used in Aider mode or in the planning phase of Cursor Planning Mode
-- WARNING: Since auto-suggestions are a high-frequency operation and therefore expensive,
-- currently designating it as `copilot` provider is dangerous because: https://github.com/yetone/avante.nvim/issues/1048
-- Of course, you can reduce the request frequency by increasing `suggestion.debounce`.
auto_suggestions_provider = "claude",
cursor_applying_provider = nil, -- The provider used in the applying phase of Cursor Planning Mode, defaults to nil, when nil uses Config.provider as the provider for the applying phase
claude = {
endpoint = "https://api.anthropic.com",
model = "claude-3-5-sonnet-20241022",
@@ -290,6 +291,7 @@ _See [config.lua#L9](./lua/avante/config.lua) for the full config_
support_paste_from_clipboard = false,
minimize_diff = true, -- Whether to remove unchanged lines when applying a code block
enable_token_counting = true, -- Whether to enable token counting. Default to true.
enable_cursor_planning_mode = true, -- Whether to enable Cursor Planning Mode. Default to true.
},
mappings = {
--- @class AvanteConflictMappings

View File

@@ -20,7 +20,7 @@ local M = {}
M._defaults = {
debug = false,
---@alias Provider "claude" | "openai" | "azure" | "gemini" | "vertex" | "cohere" | "copilot" | string
provider = "claude", -- Only recommend using Claude
provider = "claude",
-- WARNING: Since auto-suggestions are a high-frequency operation and therefore expensive,
-- currently designating it as `copilot` provider is dangerous because: https://github.com/yetone/avante.nvim/issues/1048
-- Of course, you can reduce the request frequency by increasing `suggestion.debounce`.
@@ -253,7 +253,7 @@ M._defaults = {
support_paste_from_clipboard = false,
minimize_diff = true,
enable_token_counting = true,
enable_cursor_planning_mode = false,
enable_cursor_planning_mode = true,
},
history = {
max_tokens = 4096,

View File

@@ -371,8 +371,9 @@ M.setup = function()
E.setup({ provider = auto_suggestions_provider })
end
if Config.cursor_applying_provider then
local cursor_applying_provider = M[Config.cursor_applying_provider]
if Config.behaviour.enable_cursor_planning_mode then
local cursor_applying_provider_name = Config.cursor_applying_provider or Config.provider
local cursor_applying_provider = M[cursor_applying_provider_name]
if cursor_applying_provider and cursor_applying_provider ~= provider then
E.setup({ provider = cursor_applying_provider })
end

View File

@@ -884,9 +884,11 @@ function Sidebar:apply(current_cursor)
local original_code = table.concat(original_code_lines, "\n")
local resp_content = ""
local filetype = Utils.get_filetype(filepath)
local cursor_applying_provider = Provider[Config.cursor_applying_provider]
local cursor_applying_provider_name = Config.cursor_applying_provider or Config.provider
Utils.debug(string.format("Use %s for cursor applying", cursor_applying_provider_name))
local cursor_applying_provider = Provider[cursor_applying_provider_name]
if not cursor_applying_provider then
Utils.error("Failed to find cursor_applying_provider provider: " .. Config.cursor_applying_provider, {
Utils.error("Failed to find cursor_applying_provider provider: " .. cursor_applying_provider_name, {
once = true,
title = "Avante",
})