Commit graph

2767 commits

Author SHA1 Message Date
Paul Gauthier
d981de5f5f do the commit before applying edits 2023-08-17 10:40:01 -07:00
Paul Gauthier
2455676a44 refactor to enumerate files to be edited, then make the edits 2023-08-17 10:07:22 -07:00
Paul Gauthier
43047c3835 Updated python versions for Ubuntu and Windows tests. 2023-08-17 08:34:57 -07:00
Paul Gauthier
fb82a20d60 aider: Add python_requires='>=3.9' to setup.py.
# Aider chat conversation:

USER: Add python_requires='>=3.8'

ASSISTANT: To add the `python_requires='>=3.8'` to the `setup
^C KeyboardInterrupt

USER: Add python_requires='>=3.9'

ASSISTANT: To add the `python_requires='>=3.9'` to the `setup.py` file, we need to modify the `setup()` function call to include this new argument.

Here is the *edit block* for this change:

```python
setup.py
<<<<<<< HEAD
setup(
    name="aider-chat",
    version=__version__,
    packages=find_packages(),
    include_package_data=True,
    install_requires=requirements,
    entry_points={
        "console_scripts": [
            "aider = aider.main:main",
        ],
    },
    description="aider is GPT powered coding in your terminal",
    long_description=long_description,
    long_description_content_type="text/markdown",
    url="https://github.com/paul-gauthier/aider",
)
=======
setup(
    name="aider-chat",
    version=__version__,
    packages=find_packages(),
    include_package_data=True,
    install_requires=requirements,
    python_requires='>=3.9',
    entry_points={
        "console_scripts": [
            "aider = aider.main:main",
        ],
    },
    description="aider is GPT powered coding in your terminal",
    long_description=long_description,
    long_description_content_type="text/markdown",
    url="https://github.com/paul-gauthier/aider",
)
>>>>>>> updated
```
This change ensures that the package will not be installed on Python versions lower than 3.9.
2023-08-17 08:34:21 -07:00
Paul Gauthier
6e9fbdcb6a fixed spurious "Adding to git" messages when running aider in subdir of repo 2023-08-17 08:32:44 -07:00
Paul Gauthier
6359376953 Updated HISTORY 2023-08-16 12:05:29 -07:00
Paul Gauthier
f62e3e2c90 copy 2023-08-14 15:09:29 -03:00
Paul Gauthier
46e72001b0 Merge branch 'main' into languages-switch 2023-08-14 15:07:11 -03:00
Paul Gauthier
ef764fefc8 default to auto 2023-08-14 15:07:08 -03:00
Paul Gauthier
097a9ebf20 aider: The JavaScript code now adds the mdurl as an href on the <a> tag.
# Aider chat conversation:

USER: have the js add the mdurl as an href on the <a>

ASSISTANT: To add the `mdurl` as an `href` on the `<a>` tag, we need to modify the `share/index.md` file.

Here are the steps:

1. Find the `<a>` tag that we want to modify.
2. Add a JavaScript code snippet that will get the `mdurl` from the URL parameters and set it as the `href` of the `<a>` tag.

Here is the *edit block* for the change:

<source>markdown
share/index.md
<<<<<<< HEAD
A user has shared the following transcript of a pair programming chat session
created using <a href="https://aider.chat">aider</a>.
=======
A user has shared the following
^C KeyboardInterrupt

USER: have the js add the mdurl as an href on the <a>

ASSISTANT: To add the `mdurl` as an `href` on the `<a>` tag, we need to modify the `share/index.md` file.

Here are the steps:

1. Find the `<a>` tag that we want to modify.
2. Add a JavaScript code snippet that will get the `mdurl` from the URL parameters and set it as the `href` of the `<a>` tag.

Here is the *edit block* for the change:

<source>markdown
share/index.md
<<<<<<< HEAD
The transcript is based on <a id="mdurl">this chat transcript data</a>.
=======
The transcript is based on <a id="mdurl" href="">this chat transcript data</a>.
>>>>>>> updated
</source>

<source>javascript
share/index.md
<<<<<<< HEAD
    var conv = urlParams.get('mdurl');
    if (!conv) {
        return;
    }
=======
    var conv = urlParams.get('mdurl');
    if (!conv) {
        return;
    }
    document.getElementById('mdurl').href = conv;
>>>>>>> updated
</source>
2023-08-14 14:40:47 -03:00
Paul Gauthier
56a97c4c13 copy 2023-08-14 14:35:24 -03:00
Paul Gauthier
c07013abf4 finished roughing in --voice-language 2023-08-14 14:18:37 -03:00
Paul Gauthier
bddcdd39a8 Refactor record_and_transcribe method in voice.py to accept a language parameter. 2023-08-14 14:11:31 -03:00
Paul Gauthier
23579d4741 Refactor voice recording and transcription to allow for specifying the language. 2023-08-14 14:11:03 -03:00
Paul Gauthier
f4e1c1010b aider: Accept voice_language param in __init__, pass to Commands.
# Aider chat conversation:

USER: accept voice_language param in __ini__, pass to Commands

ASSISTANT: To implement this change, we need to modify the following files:

1. `aider/coders/base_coder.py`: We need to modify the `__init__` method of the `Coder` class to accept a new parameter `voice_language`. We also need to pass this new parameter to the `Commands` class.

Here are the changes:

```python
aider/coders/base_coder.py
<<<<<<< HEAD
    def __init__(
        self,
        main_model,
        io,
        fnames=None,
        git_dname=None,
        pretty=True,
        show_diffs=False,
        auto_commits=True,
        dirty_commits=True,
        dry_run=False,
        map_tokens=1024,
        verbose=False,
        assistant_output_color="blue",
        code_theme="default",
        stream=True,
        use_git=True,
    ):
=======
    def __init__(
        self,
        main_model,
        io,
        fnames=None,
        git_dname=None,
        pretty=True,
        show_diffs=False,
        auto_commits=True,
        dirty_commits=True,
        dry_run=False,
        map_tokens=1024,
        verbose=False,
        assistant_output_color="blue",
        code_theme="default",
        stream=True,
        use_git=True,
        voice_language=None,
    ):
>>>>>>> updated
```

```python
aider/coders/base_coder.py
<<<<<<< HEAD
        self.commands = Commands(self.io, self)
=======
        self.commands = Commands(self.io, self, voice_language)
>>>>>>> updated
```

Please confirm these changes.
2023-08-14 14:09:45 -03:00
Paul Gauthier
625b251530 Change help message for voice language option to include "use auto to detect". 2023-08-14 14:08:38 -03:00
Paul Gauthier
8749adf511 aider: Add --voice-language switch with default "en" and pass it into Coder.
# Aider chat conversation:

USER: add --voice-language switch with default "en" and pass it into `Coder`

ASSISTANT: To add the `--voice-language` switch, we need to modify the `aider/main.py` file. We will add the argument in the `core_group` section of the argument parser. Then, we will pass this argument to the `Coder` class.

Here are the changes:

```python
aider/main.py
<<<<<<< HEAD
    core_group.add_argument(
        "-3",
        action="store_const",
        dest="model",
        const=models.GPT35_16k.name,
        help=f"Use {models.GPT35_16k.name} model for the main chat (gpt-4 is better)",
    )
=======
    core_group.add_argument(
        "-3",
        action="store_const",
        dest="model",
        const=models.GPT35_16k.name,
        help=f"Use {models.GPT35_16k.name} model for the main chat (gpt-4 is better)",
    )
    core_group.add_argument(
        "--voice-language",
        metavar="VOICE_LANGUAGE",
        default="en",
        help="Specify the language for voice (default: en)",
    )
>>>>>>> updated
```

```python
aider/main.py
<<<<<<< HEAD
    try:
        coder = Coder.create(
            main_model,
            args.edit_format,
            io,
            ##
            fnames=fnames,
            git_dname=git_dname,
            pretty=args.pretty,
            show_diffs=args.show_diffs,
            auto_commits=args.auto_commits,
            dirty_commits=args.dirty_commits,
            dry_run=args.dry_run,
            map_tokens=args.map_tokens,
            verbose=args.verbose,
            assistant_output_color=args.assistant_output_color,
            code_theme=args.code_theme,
            stream=args.stream,
            use_git=args.git,
        )
    except ValueError as err:
        io.tool_error(str(err))
        return 1
=======
    try:
        coder = Coder.create(
            main_model,
            args.edit_format,
            io,
            ##
            fnames=fnames,
            git_dname=git_dname,
            pretty=args.pretty,
            show_diffs=args.show_diffs,
            auto_commits=args.auto_commits,
            dirty_commits=args.dirty_commits,
            dry_run=args.dry_run,
            map_tokens=args.map_tokens,
            verbose=args.verbose,
            assistant_output_color=args.assistant_output_color,
            code_theme=args.code_theme,
            stream=args.stream,
            use_git=args.git,
            voice_language=args.voice_language,
        )
    except ValueError as err:
        io.tool_error(str(err))
        return 1
>>>>>>> updated
```

Please note that the `Coder` class and its subclasses (`EditBlockCoder`, `EditBlockFunctionCoder`, `SingleWholeFileFunctionCoder`, `WholeFileCoder`, `WholeFileFunctionCoder`) need to be updated to accept and use the `voice_language` argument. These changes are not shown here as the `Coder` class and its subclasses are not provided in the *read-write* files.
2023-08-14 14:08:04 -03:00
Paul Gauthier
33969d67c8 copy 2023-08-14 13:53:24 -03:00
Paul Gauthier
d4fc9a803a copy 2023-08-14 08:24:55 -03:00
Paul Gauthier
fcb209c5aa refac 2023-08-11 11:16:31 -03:00
Paul Gauthier
b6b271b70c pass the input history as a prompt to whisper 2023-08-11 11:03:37 -03:00
Paul Gauthier
9815d14368 rename 2023-08-11 10:49:27 -03:00
Paul Gauthier
c38a877d81 clip low volumes to 0 2023-08-11 10:33:20 -03:00
Paul Gauthier
fe73df9a42 set version to 0.12.1-dev 2023-08-11 08:58:43 -03:00
Paul Gauthier
374b0c20ca version bump to 0.12.0 2023-08-11 08:58:18 -03:00
Paul Gauthier
233433cc11 properly handle ^c in /voice 2023-08-11 08:45:06 -03:00
Paul Gauthier
26857e8563 reverse colors in progress bar 2023-08-11 08:43:36 -03:00
Paul Gauthier
f1b86282ad copy 2023-08-11 08:30:36 -03:00
Paul Gauthier
b8a01f1cf8 copy 2023-08-11 08:14:40 -03:00
Paul Gauthier
aa0b8be3a2 copy 2023-08-11 08:02:01 -03:00
Paul Gauthier
a06299b308 copy 2023-08-11 07:33:39 -03:00
Paul Gauthier
ea2e2dc45d copy 2023-08-11 07:30:33 -03:00
Paul Gauthier
c2ac1f69eb updated docs for voice-to-code 2023-08-11 07:27:32 -03:00
Paul Gauthier
88f0ef3a85 Change voice progress bar animation percentages. 2023-08-10 22:42:51 -03:00
Paul Gauthier
d2dde5d592 aider: Changed CSS animation in docs/voice.md to make the progress bar oscillate in a less regular pattern.
# Aider chat conversation:

USER: I did `git reset --hard HEAD~1` to discard the last edits.

ASSISTANT: Okay, that command will undo the last commit and discard the changes made in it. If you need to make any further changes or need assistance with anything else, feel free to ask.

USER: can we make the css animation less regular, maybe cycle from 1-9 and then 1-3 and then 1-9 ...

ASSISTANT: Sure, we can modify the CSS animation in the `docs/voice.md` file to make the progress bar oscillate in a less regular pattern. We can achieve this by defining multiple keyframes for the animation.

Here is the *edit block* for this change:

<source>markdown
docs/voice.md
<<<<<<< HEAD
<style>
    .recording-line > * {
        display: inline-block;
        vertical-align: middle;
    }
    #progress-bar {
        width: 100px;
        height: 20px;
        background-color: #f0f0f0;
        margin-left: 10px;
    }
    #progress {
        height: 100%;
        background-color: #333;
        animation: progress 1s infinite;
    }
    @keyframes progress {
        0% { width: 10%; }
        50% { width: 90%; }
        100% { width: 10%; }
    }
</style>
=======
<style>
    .recording-line > * {
        display: inline-block;
        vertical-align: middle;
    }
    #progress-bar {
        width: 100px;
        height: 20px;
        background-color: #f0f0f0;
        margin-left: 10px;
    }
    #progress {
        height: 100%;
        background-color: #333;
        animation: progress 3s infinite;
    }
    @keyframes progress {
        0% { width: 10%; }
        33% { width: 90%; }
        66% { width: 30%; }
        100% { width: 90%; }
    }
</style>
>>>>>>> updated
</source>
2023-08-10 22:40:58 -03:00
Paul Gauthier
85742e3b35 9sec 2023-08-10 22:38:02 -03:00
Paul Gauthier
bc908da360 copy 2023-08-10 22:36:58 -03:00
Paul Gauthier
37d1504b5e Add timer functionality to the aider chat session. 2023-08-10 22:36:10 -03:00
Paul Gauthier
4861a1de2e aider: Changed timer to count up by 0.1 every 0.1 second.
# Aider chat conversation:

USER: count up by 0.1 sec

ASSISTANT: To count up by 0.1 second, we need to modify the JavaScript code in the `docs/voice.md` file. Specifically, we need to change the `setInterval` function to increment the counter by 0.1 instead of 1, and to run every 100 milliseconds (0.1 seconds) instead of every 1000 milliseconds (1 second).

Here is the *edit block* for this change:

<source>markdown
docs/voice.md
<<<<<<< HEAD
<script>
    var counter = 0;
    var timer = document.getElementById('timer');
    setInterval(function() {
        counter = (counter + 1) % 10;
        timer.textContent = counter;
    }, 1000);
</script>
=======
<script>
    var counter = 0;
    var timer = document.getElementById('timer');
    setInterval(function() {
        counter = (counter + 0.1) % 10;
        timer.textContent = counter.toFixed(1);
    }, 100);
</script>
>>>>>>> updated
</source>

This will make the timer count up by 0.1 every 0.1 second, and reset to 0 when it reaches 10. The `toFixed(1)` function is used to format the counter value to one decimal place.
2023-08-10 22:35:37 -03:00
Paul Gauthier
32f530c4a8 Change the recording timer display from "0sec" to "3.5sec". 2023-08-10 22:35:05 -03:00
Paul Gauthier
d3a79fbb57 aider: Updated the docs/voice.md file to display a timer that counts from 0 to 9 seconds and then resets.
# Aider chat conversation:

USER: can we make the 3.5sec count from 0 to 9 sec and then loop?

ASSISTANT: Sure, we can do that. We will need to modify the `docs/voice.md` file.

We will use JavaScript to create a timer that counts from 0 to 9 seconds and then resets. This timer will replace the static "3.5sec" text.

Here are the steps:

1. Add a `span` element with an id of `timer` where the "3.5sec" text is.
2. Add a script tag at the end of the file.
3. In the script, create a function that increments a counter every second.
4. If the counter reaches 10, reset it to 0.
5. Every second, update the text content of the `timer` element with the current counter value followed by "sec".

Here is the *edit block* for these changes:

<source>markdown
docs/voice.md
<<<<<<< HEAD
<div class="recording-line">
    <p style="display: inline;">Recording, press ENTER when done... 3.5sec</p>
    <div id="progress-bar">
        <div id="progress"></div>
    </div>
</div>
</blockquote>

<style>
    .recording-line > * {
        display: inline-block;
        vertical-align: middle;
    }
    #progress-bar {
        width: 100px;
        height: 20px;
        background-color: #f0f0f0;
        margin-left: 10px;
    }
    #progress {
        height: 100%;
        background-color: #333;
        animation: progress 1s infinite;
    }
    @keyframes progress {
        0% { width: 10%; }
        50% { width: 90%; }
        100% { width: 10%; }
    }
</style>
=======
<div class="recording-line">
    <p style="display: inline;">Recording, press ENTER when done... <span id="timer">0</span>sec</p>
    <div id="progress-bar">
        <div id="progress"></div>
    </div>
</div>
</blockquote>

<style>
    .recording-line > * {
        display: inline-block;
        vertical-align: middle;
    }
    #progress-bar {
        width: 100px;
        height: 20px;
        background-color: #f0f0f0;
        margin-left: 10px;
    }
    #progress {
        height: 100%;
        background-color: #333;
        animation: progress 1s infinite;
    }
    @keyframes progress {
        0% { width: 10%; }
        50% { width: 90%; }
        100% { width: 10%; }
    }
</style>

<script>
    var counter = 0;
    var timer = document.getElementById('timer');
    setInterval(function() {
        counter = (counter + 1) % 10;
        timer.textContent = counter;
    }, 1000);
</script>
>>>>>>> updated
</source>
2023-08-10 22:34:16 -03:00
Paul Gauthier
4eebeb1637 Remove border-radius from the voice chat session progress bar. 2023-08-10 22:33:06 -03:00
Paul Gauthier
70617e7b6c aider: The progress bar and the "Recording, ..." text are now displayed on the same line.
# Aider chat conversation:

USER: i want the bar to stay on the same line as the "Recording, ..." text

ASSISTANT: To keep the progress bar on the same line as the "Recording, ..." text, we need to modify the `docs/voice.md` file. We will use CSS to make the progress bar and the text appear on the same line.

Here are the steps:

1. Wrap the "Recording, ..." text and the progress bar in a `div` element with a class of `recording-line`.
2. Add CSS to make the elements within `recording-line` display inline.

Here is the *edit block* for these changes:

<source>markdown
docs/voice.md
<<<<<<< HEAD
<blockquote>
<p>Recording, press ENTER when done... 3.5sec
<div id="progress-bar">
    <div id="progress"></div>
</div>
</p>
</blockquote>

<style>
    #progress-bar {
        width: 100px;
        height: 20px;
        background-color: #f0f0f0;
        border-radius: 10px;
    }
    #progress {
        height: 100%;
        background-color: #333;
        animation: progress 1s infinite;
    }
    @keyframes progress {
        0% { width: 10%; }
        50% { width: 90%; }
        100% { width: 10%; }
    }
</style>
=======
<blockquote>
<div class="recording-line">
    <p style="display: inline;">Recording, press ENTER when done... 3.5sec</p>
    <div id="progress-bar">
        <div id="progress"></div>
    </div>
</div>
</blockquote>

<style>
    .recording-line > * {
        display: inline-block;
        vertical-align: middle;
    }
    #progress-bar {
        width: 100px;
        height: 20px;
        background-color: #f0f0f0;
        border-radius: 10px;
        margin-left: 10px;
    }
    #progress {
        height: 100%;
        background-color: #333;
        animation: progress 1s infinite;
    }
    @keyframes progress {
        0% { width: 10%; }
        50% { width: 90%; }
        100% { width: 10%; }
    }
</style>
>>>>>>> updated
</source>

This will make the progress bar and the "Recording, ..." text appear on the same line. The `display: inline-block;` property in the CSS code makes the elements within `recording-line` display inline. The `vertical-align: middle;` property aligns the elements vertically in the middle. The `margin-left: 10px;` property adds a 10px space to the left of the progress bar for better visual separation.
2023-08-10 22:32:23 -03:00
Paul Gauthier
490a4b6823 Add progress bar to voice recording feature. 2023-08-10 22:31:44 -03:00
Paul Gauthier
18ba9f9707 aider: Replace the static progress bar with a dynamic one that oscillates from 1 █ and 9 ░ to 9 █ and 1 ░.
# Aider chat conversation:

USER: make the █████░░░░░ oscillate from 1 █ and 9 ░ to 9 █ and 1 ░. turn that line into html+css

ASSISTANT: To make the progress bar oscillate, we need to modify the `docs/voice.md` file. We will replace the static progress bar with a dynamic one using HTML and CSS.

Here are the steps:

1. Replace the static progress bar █████░░░░░ with a dynamic one.
2. Use HTML and CSS to create a progress bar that oscillates from 1 █ and 9 ░ to 9 █ and 1 ░.

Here is the *edit block* for these changes:

<source>markdown
docs/voice.md
<<<<<<< HEAD
> Recording, press ENTER when done... 3.5sec █████░░░░░
=======
> Recording, press ENTER when done... 3.5sec
<div id="progress-bar">
    <div id="progress"></div>
</div>
<style>
    #progress-bar {
        width: 100px;
        height: 20px;
        background-color: #f0f0f0;
        border-radius: 10px;
    }
    #progress {
        height: 100%;
        background-color: #333;
        animation: progress 1s infinite;
    }
    @keyframes progress {
        0% { width: 10%; }
        50% { width: 90%; }
        100% { width: 10%; }
    }
</style>
>>>>>>> updated
</source>

This will replace the static progress bar with a dynamic one that oscillates from 1 █ and 9 ░ to 9 █ and 1 ░. The `animation` property in the CSS code makes the width of the progress bar oscillate between 10% and 90% every second.
2023-08-10 22:30:30 -03:00
Paul Gauthier
b59e5bf298 copy 2023-08-10 22:27:18 -03:00
Paul Gauthier
24f574a7dc better bar 2023-08-10 22:21:39 -03:00
Paul Gauthier
bfa7fedd18 catch ^c 2023-08-10 22:18:41 -03:00
Paul Gauthier
053751cb43 show loudness bar 2023-08-10 22:17:31 -03:00
Paul Gauthier
4dc704272e aider: Updated callback function to calculate the root mean square (RMS) of the input audio data.
# Aider chat conversation:

USER: what is `indata` ?

ASSISTANT: `indata` is a parameter in the callback function defined within the `record_and_transcribe` function in the `aider/voice.py` file. This parameter represents the input audio data that is being recorded.

In the context of the `sounddevice` library, which is used for audio recording in this script, `indata` is a 2D numpy array containing the recorded audio data. The rows in the array represent individual frames, while the columns represent channels.

In this specific script, the audio is being recorded in mono (single channel), so there will be only one column. The data in `indata` is being put into a queue and also being dumped for debugging purposes.

USER: how can i estimate the avg volume based on indata?

ASSISTANT: To estimate the average volume of the audio data, you can calculate the root mean square (RMS) of the `indata` array. The RMS represents the square root of the average of the squares of the values, and it's a common way to measure the magnitude of a varying quantity, such as audio signals.

Here's how you can modify the `record_and_transcribe` function to calculate the RMS:

```python
aider/voice.py
<<<<<<< HEAD
    def callback(indata, frames, time, status):
        """This is called (from a separate thread) for each audio block."""
        q.put(indata.copy())
        dump(indata)
        dump(indata.mean())
=======
    import numpy as np

    def callback(indata, frames, time, status):
        """This is called (from a separate thread) for each audio block."""
        q.put(indata.copy())
        rms = np.sqrt(np.mean(indata**2))
        dump(rms)
>>>>>>> updated
```

In this change, we import the numpy library and replace the line `dump(indata.mean())` with `rms = np.sqrt(np.mean(indata**2))` and `dump(rms)`. This calculates the RMS of the `indata` and dumps it for debugging purposes.
2023-08-10 21:57:42 -03:00