Commit Graph

182 Commits

Author SHA1 Message Date
brook hong
b3289ff51a fix: wrap user input in task only in agentic mode (#2636) 2025-08-24 15:47:30 +08:00
samuelm00
0a603efad1 add possibility to define a project based instruction file 2025-08-19 14:53:40 +08:00
yetone
be0937a459 fix: timer already closed (#2608) 2025-08-14 17:55:24 +08:00
NekoNekoNiko120
5e4eb8652b feat: remember the last selected model (#2518)
Co-authored-by: pre-commit-ci-lite[bot] <117423508+pre-commit-ci-lite[bot]@users.noreply.github.com>
Co-authored-by: yetone <yetoneful@gmail.com>
2025-07-28 13:21:49 +08:00
yetone
7e50de8904 fix: ReAct tool use format in few-shot (#2542) 2025-07-28 11:14:45 +08:00
yetone
8bc149ccd8 fix: react prompts (#2537) 2025-07-26 16:06:56 +08:00
Joshua Petitma
a72ee55b20 fix: typo (#2513) 2025-07-23 11:42:59 +08:00
Dmitry Torokhov
aa606b6147 refactor(history): change HistoryMessage:new() to accept role and item
Change the constructor to accept role and a single content item instead
of raw AvanteLLMMessage instance. This will help when we will start
changing message.content from being a string or a list of tables to just
a string or a single table.
2025-07-22 17:49:28 +08:00
Dmitry Torokhov
394e4d79eb refactor(message): add helper to update contents of simple text message
Add update_content() helper so code outside of history module does not
need to know details of the message structure.
2025-07-22 17:49:28 +08:00
doodleEsc
3fcfa6ec05 refactor: refactor TODO handling to context messages
- Refactor TODOs handling: move logic to `context_messages` instead of using `template_opts`
- Improve todo message filtering by using more precise tags (`<todos>...</todos>`)
- Append TODOs after history messages
- Remove the TODOs section from `_task-guidelines.avanterules` template

Signed-off-by: doodleEsc <cinuor@gmail.com>
2025-07-21 16:56:03 +08:00
Dmitry Torokhov
2335ea3d15 refactor(history): reduce computational complexity when handling history
When updating chat history to be used in LLM request there are several
instances where we do O(n^2) operations: scanning all messages to locate
a tool "use" and for each use scan messages again to locate
corresponding "result".

Refactor the code to scan messages once collecting tool uses and results
together, and then do 2nd scan to drop incomplete tool invocations and
refresh "view" and "edit" results with the latest content.

Also reduce number of pre-scan loops (where we discard partially
generated messages or messages that are not interesting or too-old) by
combining them when possible.

This reduces time to scan initial 417 messages on my system (which
result in 576 final messages) from 0.32 to 0.12 seconds.
2025-07-18 22:36:21 -07:00
Dmitry Torokhov
c2e4ae5ef6 fix(llm): fix rate limit handling
Rate limit handling seems to be broken: it starts an one-shot timer
with callback that reschedules the timer each second and prints/updates
messages. Simultaneously it schedules a deferred by 1 second function
that cancels the timer and resumes the stream. This results in the timer
executing at most once, and stream resume happening way too early.

Fix this by switching to use repeating timer with first instance
executing immediately. All message handling is moved into the timer
callback. Once countdown is complete the same callback will stop and
destroy the timer and resume the stream.
2025-07-18 22:35:44 -07:00
yetone
bc1de981d8 fix: on_complete is nil 2025-07-17 16:41:43 +08:00
yetone
cd81fbf8af fix: tool_use_id is nil 2025-07-17 14:29:17 +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
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
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
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
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
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
yetone
203861bb71 feat: init project (#2395) 2025-07-02 18:44:30 +08:00
Peter Cardenas
2ecfe587a0 feat: parse and conditionally add cursor rules to system prompt (#2385) 2025-07-02 00:59:01 +08:00
yetone
68ead5d2f0 feat: respect agents.md (#2376) 2025-06-30 18:44:06 +08:00
Peter Cardenas
508cc4c22c fix: get_history_messages is nil (#2368) 2025-06-30 10:25:49 +08:00
Peter Cardenas
87f3aee073 fix: gracefully handle failed curl (#2356) 2025-06-28 20:10:27 +08:00
yetone
270c11da57 fix: tokens usage is nil (#2322) 2025-06-24 20:44:04 +08:00
yetone
c48808b4a8 fix: tool logs rendering (#2315) 2025-06-24 11:00:26 +08:00
yetone
0613b1f307 fix: unfinished todos count (#2306) 2025-06-23 14:26:42 +08:00
yetone
6830f2d8b9 feat: tokens usage (#2300) 2025-06-23 03:13:37 +08:00
yetone
3033556d5b fix: tool calling (#2297) 2025-06-22 21:50:26 +08:00
Brewinski
8572a4832d fix: handle user-declined tool executions separately from errors (#2258) 2025-06-21 00:50:00 +08:00
yetone
fcf457ed7f fix: refine tools (#2229) 2025-06-16 01:27:39 +08:00
yetone
ad05a802f9 feat: todos (#2184) 2025-06-15 15:10:07 +08:00
yetone
801adc4692 feat: delete tool use messages tool (#2158) 2025-06-05 02:51:46 +08:00
kyrisu
4495ee6bcf feat: load templates from cache and project directories (#2126) 2025-06-04 03:24:53 +08:00
yetone
12d69945c5 fix: legacy warning (#2120) 2025-06-03 11:27:01 +08:00
yetone
647a459a2b feat: streaming attempt completion (#2113) 2025-06-02 21:21:05 +08:00
yetone
746f071b37 feat: streaming diff (#2107) 2025-06-02 16:44:33 +08:00
yetone
bc403ddcbf feat: ReAct tool calling (#2104) 2025-05-31 08:53:34 +08:00
yetone
d44db10535 fix: tool result message must be adjacent to the tool use message (#2096) 2025-05-29 03:55:32 +08:00
yetone
7fd6cf3d64 fix: the foolish copilot/claude-3.7-sonnet is unable to invoke the attempt_completion tool as instructed (#2095) 2025-05-29 03:18:15 +08:00
yetone
0b4775c8f7 fix: attempt completion (#2091) 2025-05-27 17:29:53 +08:00
yetone
53f29bf76d fix: view truncated file (#2090) 2025-05-27 17:09:14 +08:00
yetone
269a3939f2 fix: not just for display (#2089) 2025-05-27 16:21:32 +08:00
yetone
dbddc0408f fix: filter out uncomplete tool_use (#2088) 2025-05-27 16:09:37 +08:00
yetone
edb78e5646 fix: uncompleted task (#2086) 2025-05-27 15:59:56 +08:00
yetone
0e7d66333d fix: ignore error when reading file from tool_use (#2083) 2025-05-26 18:53:02 +08:00
yetone
ef61ba52c0 fix: do not modify the failed view tool_result (#2055) 2025-05-20 11:47:46 +08:00