mirror of
https://github.com/Aider-AI/aider.git
synced 2025-06-06 04:35:00 +00:00
refactor: simplify voice command and improve installation docs
This commit is contained in:
parent
fcb2bacd1e
commit
f6b956dc8e
5 changed files with 20 additions and 31 deletions
|
@ -1125,36 +1125,14 @@ class Commands:
|
|||
)
|
||||
return
|
||||
|
||||
history_iter = self.io.get_input_history()
|
||||
|
||||
history = []
|
||||
size = 0
|
||||
for line in history_iter:
|
||||
if line.startswith("/"):
|
||||
continue
|
||||
if line in history:
|
||||
continue
|
||||
if size + len(line) > 1024:
|
||||
break
|
||||
size += len(line)
|
||||
history.append(line)
|
||||
|
||||
history.reverse()
|
||||
history = "\n".join(history)
|
||||
|
||||
try:
|
||||
text = self.voice.record_and_transcribe(history, language=self.voice_language)
|
||||
text = self.voice.record_and_transcribe(None, language=self.voice_language)
|
||||
except litellm.OpenAIError as err:
|
||||
self.io.tool_error(f"Unable to use OpenAI whisper model: {err}")
|
||||
return
|
||||
|
||||
if text:
|
||||
self.io.add_to_input_history(text)
|
||||
self.io.print()
|
||||
self.io.user_input(text, log_only=False)
|
||||
self.io.print()
|
||||
|
||||
return text
|
||||
self.io.placeholder = text
|
||||
|
||||
def cmd_paste(self, args):
|
||||
"""Paste image/text from the clipboard into the chat.\
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue