1301 Commits

Author SHA1 Message Date
yetone
1dc195d9ef fix: edit_file cannot find old str 2025-07-17 19:49:08 +08:00
yetone
bf3c210584 fix: assistant message content must be a string 2025-07-17 17:05:52 +08:00
yetone
bc1de981d8 fix: on_complete is nil 2025-07-17 16:41:43 +08:00
yetone
a08a2e3579 feat: add original_content for history message 2025-07-17 15:45:23 +08:00
yetone
cd81fbf8af fix: tool_use_id is nil 2025-07-17 14:29:17 +08:00
yetone
cf5234b4d9 optimize: reduce copilot invocation consumption 2025-07-17 14:21:34 +08:00
yetone
5ea24f59fa fix: clear useless parameters 2025-07-17 13:50:33 +08:00
yetone
2a16e7d4d9 fix: do not modify the tool_use input 2025-07-16 20:18:24 +08:00
yetone
ae06698c30 feat: add moonshot provider 2025-07-16 19:04:46 +08:00
yetone
adbd296ba6 feat: integrated morph 2025-07-16 18:34:52 +08:00
doodleEsc
1455ed6005 refactor(templates): Prioritize copying system templates to ensure latest version
- Refactor template copying order
2025-07-16 17:33:17 +08:00
Dmitry Torokhov
966eef743b refactor(history): move message rendering into history module
Move code related to converting history messages into UI representation
from utils into history/render.lua for better code organization and
clean up the implementation.
2025-07-16 12:49:15 +08:00
Dmitry Torokhov
06d9d8cec3 refactor(utils): remove history_messages_to_messages() function
Utils.history_messages_to_messages() is not used anywhere, remove it.
2025-07-16 12:49:15 +08:00
Dmitry Torokhov
d7c48075a5 refactor(history): move code collecting pending tools to history
Code dealing with scanning history messages and extracting some data or
state belongs to avante/history/ so move it there. Along with the move
update the implementation to make use of get_tool_use_data() and
get_tool_result_data() helpers to simplify it.

Also rename the function to History.get_pending_tools() to better
reflect its purpose: "uncalled" means something that was done without
request, unsolicited, not something that has not completed yet.
2025-07-16 12:49:15 +08:00
Dmitry Torokhov
b64120749f refactor(history): use get_tool_(result|use_data)() in dispatch_agent.lua
Using these helpers simplifies the code and provides better
encapsulation.
2025-07-16 12:49:15 +08:00
Dmitry Torokhov
36e116795d refactor(history): make use of get_tool_(use|result)_data() in llm.lua
Simplify the code locating viewed files as well as code locating last
completion attempt by using these new helpers.

Also avoid using "goto" in simple loops.
2025-07-16 12:49:15 +08:00
Dmitry Torokhov
47ad90b389 fix: when deleting tool use also delete tool result
Tool results are not useful without their "use" messages, so delete them
when deleting "use" ones.

Makes use of the new get_tool_use_data() and get_tool_result_data()
helpers.
2025-07-16 12:49:15 +08:00
Dmitry Torokhov
520ca47a8f refactor(history): add helpers to get content of tool "use" and "result"
There are many places in the code that wants to work with content of
"tool use" and "tool result" messages. Currently such code uses
is_tool_use_message() and is_tool_result() message to check if message
is of right kind, and then pokes into message internals. This is not
very efficient.

Introduce get_tool_use_data() and get_tool_result_data() that would
return contents of the message if it is of right kind, or nil otherwise.

Also introduce get_tool_result() that attempts to locate result of a
tool execution by its invocation ID.
2025-07-16 12:49:15 +08:00
Dmitry Torokhov
06cc3b3f21 refactor(history): add helpers to generate synthetic history messages
Add helpers such as HistoryMessage:new_assistant_synthetic() and
HistoryMessage:new_user_syntheric() to make callers more compact and
understandable.
2025-07-16 12:49:15 +08:00
Dmitry Torokhov
34907fc1cd refactor(history): start moving history-related code into avante/history
The utils module has grown too big and contains unrelated functionality.
Start moving code related to managing history messages comprising chat
history into lua/avante/history module to keep the code more manageable.
2025-07-16 12:49:15 +08:00
Dmitry Torokhov
85a9fcef95 fix(types): add is_user_declined field to AvanteLLMMessageContentItem
This field has been added to AvanteLLMToolResult, so it needs to be
included in AvanteLLMMessageContentItem as well.
2025-07-16 12:49:15 +08:00
yetone
127a12a878 fix: trim escapes for write_to_file tool (#2455) 2025-07-16 12:04:22 +08:00
Avinash Thakur
31be8718a6 fix: layout being resized on every keystroke (#2452) 2025-07-16 11:34:46 +08:00
yetone
154e5f578f feat: add timeout for bash tool (#2451) 2025-07-15 20:46:15 +08:00
Dmitry Torokhov
d3dde0c5ff refactor(utils): simplify and annotate count_lines() (#2446) 2025-07-15 16:42:30 +08:00
Dmitry Torokhov
5e50db3e05 refactor(file_selector): optimize handling of selected files
Sorting function in FileSelector:get_filepaths() is not very efficient
since it has to hit the filesystem each time it is called to determine
if it is dealing with a directory or not.

Optimize performance by figuring this data in get_project_filepaths()
and returning a list of structures containing paths and directory flags,
and use this data in get_filepaths(). Do the absolute->relative
conversion once.

Also use vim.fn.isdirectory() instead of vim.loop.fs_stat() everywhere
in the file.
2025-07-15 16:41:22 +08:00
Dmitry Torokhov
a5a2c22cf7 refactor(file_selector): remove unused argument from process_directory()
FileSelector:process_directory() does not make use of project_root
argument. Remove it and adjust all callers.
2025-07-15 16:41:22 +08:00
Dmitry Torokhov
318a45ae08 fix(file_selector): Correct path comparison for selected files
The FileSelector:get_filepaths() function incorrectly filters selected
files due to a mismatch in path formats (relative vs. absolute).

Fix the issue by converting relative file paths to absolute paths before
doing the comparison. Use a set instead of re-scanning the table when
filtering out duplicates.
2025-07-15 16:41:22 +08:00
Dmitry Torokhov
61e38024dc fix(file_selector): avoid converting to relative path twice
get_project_filepath() converts candidate file paths to relative form
twice, once in the first iterator, and then in vim.tbl_map() call while.
It also iterates the same list twice for no apparent reason.

Combine both scans into one and use dedicated vim.fn.isdirectory().
2025-07-15 16:41:22 +08:00
yetone
b8bb0fd969 refactor: llm tool parameters (#2449) 2025-07-15 16:40:25 +08:00
Dmitry Torokhov
0c6a8f5688 refactor(llm): remove dead code summarizing threads and generating todos (#2439) 2025-07-14 10:14:40 +08:00
Raul Luzetti
e06f55d353 fix(replace_in_file): added a replace substring logic (#2438) 2025-07-14 10:14:16 +08:00
Arnon Keereena
a78af4ce99 Fix bugs where the file picker windows disappear on @file mentions (#2442)
Co-authored-by: Arnon Keereena <arnon.keereena@accenture.com>
2025-07-14 10:08:55 +08:00
Dmitry Torokhov
80f50af6fb Some refactors in suggestion.lua (#2443) 2025-07-14 10:05:03 +08:00
soulfy
c4ce24e3c0 fix: result_container takes the actual height of the editor (#2405) 2025-07-12 00:36:42 +08:00
yetone
c20e4e8f05 fix: finetune beast mode (#2433) 2025-07-10 12:47:03 +08:00
yetone
d7fa5fec6d fix: incorrect tool names (#2432) 2025-07-10 12:42:02 +08:00
yetone
8942e12798 feat: beast mode for gpt4.1 (#2431) 2025-07-10 12:30:06 +08:00
yetone
14cfccdba9 fix: do not use str_replace_editor (#2428) 2025-07-10 10:17:48 +08:00
skt041959
6a9424a63b set keymap with nowait (#2422) 2025-07-09 22:32:05 +08:00
Kyle
9f4da7ea09 fix(openai): handle nil function arguments in tool calls (#2425) 2025-07-09 14:19:29 +08:00
Dmitry Torokhov
30eb77af04 feat: optimize showing hints in visual mode (#2416) 2025-07-08 19:56:54 +08:00
yetone
c0249db33d fix: call a slow function in a fast event context (#2424) 2025-07-08 19:54:21 +08:00
yetone
6227d5c340 fix: close input hint when closing the sidebar (#2420) 2025-07-07 16:51:30 +08:00
Dmitry Torokhov
b051ce449a fix: slow typing in input window and other input hint optimizations (#2418) 2025-07-07 16:45:35 +08:00
Han Pham
39ac64aca6 feat(file_selector): handle parsing oil directory (#2409) 2025-07-04 21:29:02 +08:00
yetone
935234981b fix: missing new_str (#2407) 2025-07-04 00:38:17 +08:00
Dmitry Torokhov
8346d9b005 fix: don't throw errors when closing code window (#2401) 2025-07-03 14:45:35 +08:00
yetone
9bc5bf8053 fix: breaklines (#2403) 2025-07-03 14:43:44 +08:00
yetone
17a1f83950 fix: trim slashes (#2399) 2025-07-03 00:30:58 +08:00