Skip to content
This repository was archived by the owner on Mar 9, 2026. It is now read-only.

Commit 6ea7694

Browse files
committed
Enhance user input handling in cli.py
The code has been modified to allow users to edit their input using their preferred editor. Post-editing, the revised input is displayed on the terminal for user reference. This enhancement promotes user convenience and traceability.
1 parent 4beebfc commit 6ea7694

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

aicodebot/cli.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -405,6 +405,7 @@ def sidekick(request, verbose, response_token_size, files):
405405
history_file = Path.home() / ".aicodebot_request_history"
406406

407407
while True: # continuous loop for multiple questions
408+
edited_input = None
408409
if request:
409410
human_input = request
410411
else:
@@ -414,10 +415,15 @@ def sidekick(request, verbose, response_token_size, files):
414415
if human_input.lower() == "q":
415416
break
416417
elif human_input.lower() == "e":
417-
human_input = click.edit()
418+
human_input = edited_input = click.edit()
418419
elif human_input.lower()[-2:] == r"\e":
419420
# If the text ends with \e then we want to edit it
420-
human_input = click.edit(human_input[:-2])
421+
human_input = edited_input = click.edit(human_input[:-2])
422+
423+
if edited_input:
424+
# If the user edited the input, then we want to print it out so they
425+
# have a record of what they asked for on their terminal
426+
console.print(f"Request:\n{edited_input}")
421427

422428
with Live(Markdown(""), auto_refresh=True) as live:
423429
callback = RichLiveCallbackHandler(live, bot_style)

0 commit comments

Comments
 (0)