fix: refine attempt_completion prompts (#2320)

This commit is contained in:
yetone
2025-06-24 19:15:49 +08:00
committed by GitHub
parent c48808b4a8
commit aa4fa9c89d
2 changed files with 3 additions and 1 deletions

View File

@@ -12,7 +12,7 @@ M.name = "attempt_completion"
M.description = [[
After each tool use, the user will respond with the result of that tool use, i.e. if it succeeded or failed, along with any reasons for failure. Once you've received the results of tool uses and can confirm that the task is complete, use this tool to present the result of your work to the user. Optionally you may provide a CLI command to showcase the result of your work. The user may respond with feedback if they are not satisfied with the result, which you can use to make improvements and try again.
IMPORTANT NOTE: This tool CANNOT be used until you've confirmed from the user that any previous tool uses were successful. Failure to do so will result in code corruption and system failure. Before using this tool, you must ask yourself in <thinking></thinking> tags if you've confirmed from the user that any previous tool uses were successful. If not, then DO NOT use this tool.
IMPORTANT NOTE: This tool CANNOT be used until you've confirmed from the user that any previous tool uses were successful. Failure to do so will result in code corruption and system failure. Before using this tool, you must ask yourself in `think` tool calling if you've confirmed from the user that any previous tool uses were successful. If not, then DO NOT use this tool.
]]
M.support_streaming = true

View File

@@ -77,6 +77,8 @@ function M.func(opts, on_log, on_complete, session_ctx)
return { { line_, Highlights.INCOMING } }
end)
:totable()
local line_count = vim.api.nvim_buf_line_count(bufnr)
if opts.insert_line > line_count - 1 then opts.insert_line = line_count - 1 end
vim.api.nvim_buf_set_extmark(bufnr, ns_id, opts.insert_line, 0, {
virt_lines = virt_lines,
hl_eol = true,