feat: manual compact instead of automatic compact (#1996)

This commit is contained in:
yetone
2025-05-06 20:57:58 +08:00
committed by GitHub
parent 89d420ccec
commit 2d6527197d
4 changed files with 35 additions and 2 deletions

View File

@@ -1312,6 +1312,7 @@ function M.get_commands()
{ description = "Show help message", name = "help" },
{ description = "Clear chat history", name = "clear" },
{ description = "New chat", name = "new" },
{ description = "Compact history messages to save tokens", name = "compact" },
{
shorthelp = "Ask a question about specific lines",
description = "/lines <start>-<end> <question>",
@@ -1329,6 +1330,7 @@ function M.get_commands()
end,
clear = function(sidebar, args, cb) sidebar:clear_history(args, cb) end,
new = function(sidebar, args, cb) sidebar:new_chat(args, cb) end,
compact = function(sidebar, args, cb) sidebar:compact_history_messages(args, cb) end,
lines = function(_, args, cb)
if cb then cb(args) end
end,