Skip to content

Commit 38a45fb

Browse files
committed
2 changes, one to deduplicate repeated tool call id usage and another for #91 and #93 to start the spinner after confirmations so the system is more obviously responsive
1 parent a38d085 commit 38a45fb

2 files changed

Lines changed: 16 additions & 6 deletions

File tree

aider/coders/base_coder.py

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -672,10 +672,6 @@ def show_pretty(self):
672672

673673
return True
674674

675-
def _stop_waiting_spinner(self):
676-
"""Stop and clear the waiting spinner if it is running."""
677-
self.io.stop_spinner()
678-
679675
def get_abs_fnames_content(self):
680676
for fname in list(self.abs_fnames):
681677
content = self.io.read_text(fname)
@@ -1281,6 +1277,7 @@ async def _processing_logic(self, user_message, preproc):
12811277
finally:
12821278
self.run_one_completed = True
12831279
self.compact_context_completed = True
1280+
self.io.stop_spinner()
12841281

12851282
def copy_context(self):
12861283
if self.auto_copy_context:
@@ -1994,7 +1991,7 @@ async def send_message(self, inp):
19941991
self.mdstream = None
19951992

19961993
# Ensure any waiting spinner is stopped
1997-
self._stop_waiting_spinner()
1994+
self.io.start_spinner("Processing Answer...")
19981995

19991996
self.partial_response_content = self.get_multi_response_content_in_progress(True)
20001997
self.remove_reasoning_content()
@@ -2064,7 +2061,13 @@ async def send_message(self, inp):
20642061
try:
20652062
if self.partial_response_tool_calls:
20662063
tool_calls = []
2064+
tool_id_set = set()
2065+
20672066
for tool_call_dict in self.partial_response_tool_calls:
2067+
# LLM APIs sometimes return duplicates and that's annoying
2068+
if tool_call_dict.get("id") in tool_id_set:
2069+
continue
2070+
20682071
tool_calls.append(
20692072
ChatCompletionMessageToolCall(
20702073
id=tool_call_dict.get("id"),

aider/io.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -424,6 +424,7 @@ def __init__(
424424
# Spinner state
425425
self.spinner_running = False
426426
self.spinner_text = ""
427+
self.last_spinner_text = ""
427428
self.spinner_frame_index = 0
428429
self.spinner_last_frame_index = 0
429430
self.unicode_palette = "░█"
@@ -493,14 +494,17 @@ def _spinner_supports_unicode(self) -> bool:
493494
except Exception:
494495
return False
495496

496-
def start_spinner(self, text):
497+
def start_spinner(self, text, update_last_text=True):
497498
"""Start the spinner."""
498499
self.stop_spinner()
499500

500501
if self.prompt_session:
501502
self.spinner_running = True
502503
self.spinner_text = text
503504
self.spinner_frame_index = self.spinner_last_frame_index
505+
506+
if update_last_text:
507+
self.last_spinner_text = text
504508
else:
505509
self.fallback_spinner = Spinner(text)
506510
self.fallback_spinner.step()
@@ -1115,6 +1119,7 @@ async def _confirm_ask(
11151119
else:
11161120
# Ring the bell if needed
11171121
self.ring_bell()
1122+
self.start_spinner("Awaiting Confirmation...", False)
11181123

11191124
while True:
11201125
try:
@@ -1157,7 +1162,9 @@ async def _confirm_ask(
11571162
break
11581163
res = res.lower()
11591164
good = any(valid_response.startswith(res) for valid_response in valid_responses)
1165+
11601166
if good:
1167+
self.start_spinner(self.last_spinner_text)
11611168
break
11621169

11631170
error_message = f"Please answer with one of: {', '.join(valid_responses)}"

0 commit comments

Comments
 (0)