refactor(history): move message rendering into history module

Move code related to converting history messages into UI representation
from utils into history/render.lua for better code organization and
clean up the implementation.
This commit is contained in:
Dmitry Torokhov
2025-07-15 14:30:00 -07:00
committed by yetone
parent 06d9d8cec3
commit 966eef743b
4 changed files with 177 additions and 153 deletions

View File

@@ -46,9 +46,10 @@ function M.summarize_memory(prev_memory, history_messages, cb)
cb(nil)
return
end
local Render = require("avante.history.render")
local conversation_items = vim
.iter(history_messages)
:map(function(msg) return msg.message.role .. ": " .. Utils.message_to_text(msg, history_messages) end)
:map(function(msg) return msg.message.role .. ": " .. Render.message_to_text(msg, history_messages) end)
:totable()
local conversation_text = table.concat(conversation_items, "\n")
local user_prompt = "Here is the conversation so far:\n"