fix(openai): add backward compat for get_user_message
(#813)
Co-authored-by: ming.chen <ming.chen@shopee.com> Co-authored-by: Aaron Pham <Aaronpham0103@gmail.com>
This commit is contained in:
parent
b872ac9c12
commit
ec9b00db8b
@ -39,7 +39,17 @@ M.role_map = {
|
||||
}
|
||||
|
||||
---@param opts AvantePromptOptions
|
||||
M.get_user_message = function(opts) return table.concat(opts.messages, "\n") end
|
||||
M.get_user_message = function(opts)
|
||||
vim.deprecate("get_user_message", "parse_messages", "0.1.0", "avante.nvim")
|
||||
return table.concat(
|
||||
vim.iter(opts.messages):filter(function(_, value) return value.role == "user" end):fold({}, function(acc, value)
|
||||
acc = vim.list_extend({}, acc)
|
||||
acc = vim.list_extend(acc, { value.content })
|
||||
return acc
|
||||
end),
|
||||
"\n"
|
||||
)
|
||||
end
|
||||
|
||||
M.parse_messages = function(opts)
|
||||
local messages = {}
|
||||
|
Loading…
x
Reference in New Issue
Block a user