refactor(history): start moving history-related code into avante/history

The utils module has grown too big and contains unrelated functionality.
Start moving code related to managing history messages comprising chat
history into lua/avante/history module to keep the code more manageable.
This commit is contained in:
Dmitry Torokhov
2025-07-08 15:57:05 -07:00
committed by yetone
parent 85a9fcef95
commit 34907fc1cd
14 changed files with 448 additions and 421 deletions

View File

@@ -1,3 +1,4 @@
local History = require("avante.history")
local Utils = require("avante.utils")
local Path = require("avante.path")
local Config = require("avante.config")
@@ -9,7 +10,7 @@ local M = {}
---@param history avante.ChatHistory
---@return table?
local function to_selector_item(history)
local messages = Utils.get_history_messages(history)
local messages = History.get_history_messages(history)
local timestamp = #messages > 0 and messages[#messages].timestamp or history.timestamp
local name = history.title .. " - " .. timestamp .. " (" .. #messages .. ")"
name = name:gsub("\n", "\\n")