feat: add original_content for history message
This commit is contained in:
@@ -5,7 +5,7 @@ local M = {}
|
|||||||
M.__index = M
|
M.__index = M
|
||||||
|
|
||||||
---@param message AvanteLLMMessage
|
---@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
|
---@return avante.HistoryMessage
|
||||||
function M:new(message, opts)
|
function M:new(message, opts)
|
||||||
opts = opts or {}
|
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.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.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.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
|
return obj
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -237,6 +237,7 @@ function M:add_text_message(ctx, text, state, opts)
|
|||||||
}, {
|
}, {
|
||||||
state = state,
|
state = state,
|
||||||
uuid = ctx.content_uuid,
|
uuid = ctx.content_uuid,
|
||||||
|
original_content = ctx.content,
|
||||||
})
|
})
|
||||||
ctx.content_uuid = msg.uuid
|
ctx.content_uuid = msg.uuid
|
||||||
local msgs = { msg }
|
local msgs = { msg }
|
||||||
@@ -332,7 +333,7 @@ function M:add_text_message(ctx, text, state, opts)
|
|||||||
end
|
end
|
||||||
::continue::
|
::continue::
|
||||||
end
|
end
|
||||||
msg.displayed_content = table.concat(new_content_list, "\n")
|
msg.message.content = table.concat(new_content_list, "\n")
|
||||||
end
|
end
|
||||||
if opts.on_messages_add then opts.on_messages_add(msgs) 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
|
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 is_deleted boolean | nil
|
||||||
---@field turn_id string | nil
|
---@field turn_id string | nil
|
||||||
---@field is_calling boolean | nil
|
---@field is_calling boolean | nil
|
||||||
|
---@field original_content AvanteLLMMessageContent | nil
|
||||||
---
|
---
|
||||||
---@class AvanteLLMToolResult
|
---@class AvanteLLMToolResult
|
||||||
---@field tool_name string
|
---@field tool_name string
|
||||||
|
|||||||
Reference in New Issue
Block a user