fix(compat): filter out non value and not user message (#818)
Co-authored-by: Aaron Pham <Aaronpham0103@gmail.com> Co-authored-by: Aaron Pham <contact@aarnphm.xyz>
This commit is contained in:
parent
ec9b00db8b
commit
ecaf850859
@ -42,11 +42,14 @@ M.role_map = {
|
|||||||
M.get_user_message = function(opts)
|
M.get_user_message = function(opts)
|
||||||
vim.deprecate("get_user_message", "parse_messages", "0.1.0", "avante.nvim")
|
vim.deprecate("get_user_message", "parse_messages", "0.1.0", "avante.nvim")
|
||||||
return table.concat(
|
return table.concat(
|
||||||
vim.iter(opts.messages):filter(function(_, value) return value.role == "user" end):fold({}, function(acc, value)
|
vim
|
||||||
acc = vim.list_extend({}, acc)
|
.iter(opts.messages)
|
||||||
acc = vim.list_extend(acc, { value.content })
|
:filter(function(_, value) return value == nil or value.role ~= "user" end)
|
||||||
return acc
|
:fold({}, function(acc, value)
|
||||||
end),
|
acc = vim.list_extend({}, acc)
|
||||||
|
acc = vim.list_extend(acc, { value.content })
|
||||||
|
return acc
|
||||||
|
end),
|
||||||
"\n"
|
"\n"
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
|
Loading…
x
Reference in New Issue
Block a user