refactor: simplify voice command and improve installation docs

This commit is contained in:
Paul Gauthier 2024-12-11 13:52:33 -08:00 committed by Paul Gauthier (aider)
parent fcb2bacd1e
commit f6b956dc8e
5 changed files with 20 additions and 31 deletions

View file

@ -181,6 +181,7 @@ class Analytics:
def posthog_error(self): def posthog_error(self):
"""disable posthog if we get an error""" """disable posthog if we get an error"""
print("X" * 100)
# https://github.com/PostHog/posthog-python/blob/9e1bb8c58afaa229da24c4fb576c08bb88a75752/posthog/consumer.py#L86 # https://github.com/PostHog/posthog-python/blob/9e1bb8c58afaa229da24c4fb576c08bb88a75752/posthog/consumer.py#L86
# https://github.com/Aider-AI/aider/issues/2532 # https://github.com/Aider-AI/aider/issues/2532
self.ph = None self.ph = None

View file

@ -1125,36 +1125,14 @@ class Commands:
) )
return 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: 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: except litellm.OpenAIError as err:
self.io.tool_error(f"Unable to use OpenAI whisper model: {err}") self.io.tool_error(f"Unable to use OpenAI whisper model: {err}")
return return
if text: if text:
self.io.add_to_input_history(text) self.io.placeholder = text
self.io.print()
self.io.user_input(text, log_only=False)
self.io.print()
return text
def cmd_paste(self, args): def cmd_paste(self, args):
"""Paste image/text from the clipboard into the chat.\ """Paste image/text from the clipboard into the chat.\

View file

@ -1,16 +1,20 @@
## Avoid package conflicts ## Avoid package conflicts
You can avoid python package conflicts by installing aider using
[pipx](/docs/install/pipx.html)
or
[uv](/docs/install/uv.html).
If you are using aider to work on a python project, sometimes your project will require If you are using aider to work on a python project, sometimes your project will require
specific versions of python packages which conflict with the versions that aider specific versions of python packages which conflict with the versions that aider
requires. requires.
If this happens, the `python -m pip install` command may return errors like these: If this happens, the `python -m pip install aide-chat` command may return errors like these:
``` ```
aider-chat 0.23.0 requires somepackage==X.Y.Z, but you have somepackage U.W.V which is incompatible. aider-chat 0.23.0 requires somepackage==X.Y.Z, but you have somepackage U.W.V which is incompatible.
``` ```
You can avoid this problem by installing aider using `pipx` or `uv`,
which will install it globally on your system which will install it globally on your system
within its own python environment. within its own python environment.
This way you can use aider to work on any python project, This way you can use aider to work on any python project,

View file

@ -5,13 +5,16 @@ nav_order: 100
# Install with pipx # Install with pipx
A recommended way to install aider is with pipx:
Install [pipx](https://pipx.pypa.io/stable/) then do:
``` ```
python -m pip install pipx # If you need to install pipx
pipx install aider-chat pipx install aider-chat
``` ```
See also the
[docs on other methods for installing pipx itself](https://pipx.pypa.io/stable/installation/).
## pipx on replit ## pipx on replit

View file

@ -5,11 +5,14 @@ nav_order: 100
# Install with uv # Install with uv
A recommended way to install aider is with uv:
Install [uv](https://docs.astral.sh/uv/getting-started/installation/) then do: ```bash
python -m pip install uv # If you need to install uv
```
uv tool install --python python3.12 aider-chat uv tool install --python python3.12 aider-chat
``` ```
See also the
[docs on other methods for installing uv itself](https://docs.astral.sh/uv/getting-started/installation/).
{% include conflicts.md %} {% include conflicts.md %}