feat: add original_content for history message
This commit is contained in:
@@ -5,7 +5,7 @@ local M = {}
|
||||
M.__index = M
|
||||
|
||||
---@param message AvanteLLMMessage
|
||||
---@param opts? {is_user_submission?: boolean, visible?: boolean, displayed_content?: string, state?: avante.HistoryMessageState, uuid?: string, selected_filepaths?: string[], selected_code?: AvanteSelectedCode, just_for_display?: boolean, is_dummy?: boolean, turn_id?: string, is_calling?: boolean}
|
||||
---@param opts? {is_user_submission?: boolean, visible?: boolean, displayed_content?: string, state?: avante.HistoryMessageState, uuid?: string, selected_filepaths?: string[], selected_code?: AvanteSelectedCode, just_for_display?: boolean, is_dummy?: boolean, turn_id?: string, is_calling?: boolean, original_content?: AvanteLLMMessageContent}
|
||||
---@return avante.HistoryMessage
|
||||
function M:new(message, opts)
|
||||
opts = opts or {}
|
||||
@@ -25,6 +25,7 @@ function M:new(message, opts)
|
||||
if opts.is_dummy ~= nil then obj.is_dummy = opts.is_dummy end
|
||||
if opts.turn_id ~= nil then obj.turn_id = opts.turn_id end
|
||||
if opts.is_calling ~= nil then obj.is_calling = opts.is_calling end
|
||||
if opts.original_content ~= nil then obj.original_content = opts.original_content end
|
||||
return obj
|
||||
end
|
||||
|
||||
|
||||
@@ -237,6 +237,7 @@ function M:add_text_message(ctx, text, state, opts)
|
||||
}, {
|
||||
state = state,
|
||||
uuid = ctx.content_uuid,
|
||||
original_content = ctx.content,
|
||||
})
|
||||
ctx.content_uuid = msg.uuid
|
||||
local msgs = { msg }
|
||||
@@ -332,7 +333,7 @@ function M:add_text_message(ctx, text, state, opts)
|
||||
end
|
||||
::continue::
|
||||
end
|
||||
msg.displayed_content = table.concat(new_content_list, "\n")
|
||||
msg.message.content = table.concat(new_content_list, "\n")
|
||||
end
|
||||
if opts.on_messages_add then opts.on_messages_add(msgs) end
|
||||
if has_tool_use and state == "generating" then opts.on_stop({ reason = "tool_use", streaming_tool_use = true }) end
|
||||
|
||||
@@ -114,6 +114,7 @@ vim.g.avante_login = vim.g.avante_login
|
||||
---@field is_deleted boolean | nil
|
||||
---@field turn_id string | nil
|
||||
---@field is_calling boolean | nil
|
||||
---@field original_content AvanteLLMMessageContent | nil
|
||||
---
|
||||
---@class AvanteLLMToolResult
|
||||
---@field tool_name string
|
||||
|
||||
Reference in New Issue
Block a user