6 Commits

Author SHA1 Message Date
Dmitry Torokhov
aa606b6147 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.
2025-07-22 17:49:28 +08:00
Dmitry Torokhov
394e4d79eb refactor(message): add helper to update contents of simple text message
Add update_content() helper so code outside of history module does not
need to know details of the message structure.
2025-07-22 17:49:28 +08:00
Dmitry Torokhov
663433a5ed refactor(message): use vim.tbl_extend() in Message:new() to apply options
It is unwieldy to handle fields in opt table one by one. Luckily there
is vim.bl_extend("force", ...) that can help us here.

Also move annotation for opts from parameter to a separate class to make
it easier to work with.
2025-07-22 17:49:28 +08:00
yetone
a08a2e3579 feat: add original_content for history message 2025-07-17 15:45:23 +08:00
Dmitry Torokhov
06cc3b3f21 refactor(history): add helpers to generate synthetic history messages
Add helpers such as HistoryMessage:new_assistant_synthetic() and
HistoryMessage:new_user_syntheric() to make callers more compact and
understandable.
2025-07-16 12:49:15 +08:00
Dmitry Torokhov
34907fc1cd 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.
2025-07-16 12:49:15 +08:00