refactor(history): change HistoryMessage:new() to accept role and item

Change the constructor to accept role and a single content item instead
of raw AvanteLLMMessage instance. This will help when we will start
changing message.content from being a string or a list of tables to just
a string or a single table.
This commit is contained in:
Dmitry Torokhov
2025-07-18 15:08:19 -07:00
committed by yetone
parent 2d9f8fd252
commit aa606b6147
9 changed files with 171 additions and 252 deletions

View File

@@ -231,7 +231,10 @@ L5: pass
},
}
local history_messages = vim.iter(llm_messages):map(function(msg) return HistoryMessage:new(msg) end):totable()
local history_messages = vim
.iter(llm_messages)
:map(function(msg) return HistoryMessage:new(msg.role, msg.content) end)
:totable()
local diagnostics = Utils.lsp.get_diagnostics(bufnr)