improve: support to customize the spinners (#2397)

This commit is contained in:
guanghechen
2025-07-02 18:54:41 +08:00
committed by GitHub
parent 8fde103734
commit 7aec52ff3e
5 changed files with 55 additions and 43 deletions

View File

@@ -453,6 +453,11 @@ _See [config.lua#L9](./lua/avante/config.lua) for the full config_
align = "center", -- left, center, right for title align = "center", -- left, center, right for title
rounded = true, rounded = true,
}, },
spinner = {
editing = { "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "" },
generating = { "·", "", "", "", "", "" }, -- Spinner characters for the 'generating' state
thinking = { "🤯", "🙄" }, -- Spinner characters for the 'thinking' state
},
input = { input = {
prefix = "> ", prefix = "> ",
height = 8, -- Height of the input window in vertical layout height = 8, -- Height of the input window in vertical layout

View File

@@ -396,6 +396,11 @@ _请参见 [config.lua#L9](./lua/avante/config.lua) 以获取完整配置_
align = "center", -- left, center, right 用于标题 align = "center", -- left, center, right 用于标题
rounded = true, rounded = true,
}, },
spinner = {
editing = { "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "" },
generating = { "·", "", "", "", "", "" }, -- '生成中' 状态的旋转字符
thinking = { "🤯", "🙄" }, -- '思考中' 状态的旋转字符
},
input = { input = {
prefix = "> ", prefix = "> ",
height = 8, -- 垂直布局中输入窗口的高度 height = 8, -- 垂直布局中输入窗口的高度

View File

@@ -558,6 +558,48 @@ M._defaults = {
align = "center", -- left, center, right for title align = "center", -- left, center, right for title
rounded = true, rounded = true,
}, },
spinner = {
editing = {
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
},
generating = { "·", "", "", "", "", "" },
thinking = { "🤯", "🙄" },
},
input = { input = {
prefix = "> ", prefix = "> ",
height = 6, -- Height of the input window in vertical layout height = 6, -- Height of the input window in vertical layout

View File

@@ -89,8 +89,8 @@ function Sidebar:new(id)
chat_history = nil, chat_history = nil,
current_state = nil, current_state = nil,
state_timer = nil, state_timer = nil,
state_spinner_chars = { "·", "", "", "", "", "" }, state_spinner_chars = Config.windows.spinner.generating,
thinking_spinner_chars = { "🤯", "🙄" }, thinking_spinner_chars = Config.windows.spinner.thinking,
state_spinner_idx = 1, state_spinner_idx = 1,
state_extmark_id = nil, state_extmark_id = nil,
scroll = true, scroll = true,

View File

@@ -44,47 +44,7 @@ function PromptInput:new(opts)
obj.close_on_submit = opts.close_on_submit or false obj.close_on_submit = opts.close_on_submit or false
obj.win_opts = opts.win_opts obj.win_opts = opts.win_opts
obj.default_value = opts.default_value obj.default_value = opts.default_value
obj.spinner_chars = { obj.spinner_chars = Config.windows.spinner.editing
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
}
obj.spinner_index = 1 obj.spinner_index = 1
obj.spinner_timer = nil obj.spinner_timer = nil
obj.spinner_active = false obj.spinner_active = false