Skip to content

Commit

Permalink
refactor: simplify voice command and improve installation docs
Browse files Browse the repository at this point in the history
  • Loading branch information
paul-gauthier committed Dec 11, 2024
1 parent fcb2bac commit f6b956d
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 31 deletions.
1 change: 1 addition & 0 deletions aider/analytics.py
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,7 @@ def _redact_model_name(self, model):

def posthog_error(self):
"""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/Aider-AI/aider/issues/2532
self.ph = None
Expand Down
26 changes: 2 additions & 24 deletions aider/commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -1125,36 +1125,14 @@ def cmd_voice(self, args):
)
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.\
Expand Down
8 changes: 6 additions & 2 deletions aider/website/_includes/conflicts.md
Original file line number Diff line number Diff line change
@@ -1,16 +1,20 @@

## 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
specific versions of python packages which conflict with the versions that aider
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.
```

You can avoid this problem by installing aider using `pipx` or `uv`,
which will install it globally on your system
within its own python environment.
This way you can use aider to work on any python project,
Expand Down
7 changes: 5 additions & 2 deletions aider/website/docs/install/pipx.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,16 @@ nav_order: 100

# Install with pipx


Install [pipx](https://pipx.pypa.io/stable/) then do:
A recommended way to install aider is with pipx:

```
python -m pip install pipx # If you need to install pipx
pipx install aider-chat
```

See also the
[docs on other methods for installing pipx itself](https://pipx.pypa.io/stable/installation/).


## pipx on replit

Expand Down
9 changes: 6 additions & 3 deletions aider/website/docs/install/uv.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,14 @@ nav_order: 100

# 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
```

See also the
[docs on other methods for installing uv itself](https://docs.astral.sh/uv/getting-started/installation/).

{% include conflicts.md %}

0 comments on commit f6b956d

Please sign in to comment.