fix: selected code (#1542)

This commit is contained in:
yetone
2025-03-10 00:17:24 +08:00
committed by GitHub
parent 32665974ee
commit 05b3b843c8
3 changed files with 17 additions and 12 deletions

View File

@@ -31,13 +31,17 @@ function M.entries_to_llm_messages(entries)
local messages = {}
for _, entry in ipairs(entries) do
local user_content = ""
if entry.selected_file ~= nil then
user_content = user_content .. "SELECTED FILE: " .. entry.selected_file.filepath .. "\n\n"
if entry.selected_filepaths ~= nil then
user_content = user_content .. "SELECTED FILES:\n\n"
for _, filepath in ipairs(entry.selected_filepaths) do
user_content = user_content .. filepath .. "\n"
end
end
if entry.selected_code ~= nil then
user_content = user_content
.. "SELECTED CODE:\n\n```"
.. entry.selected_code.filetype
.. (entry.selected_code.file_type or "")
.. (entry.selected_code.path and ":" .. entry.selected_code.path or "")
.. "\n"
.. entry.selected_code.content
.. "\n```\n\n"