Commit graph

3416 commits

Author SHA1 Message Date
Paul Gauthier
aa54fdd5f7 aider: Add the missing requirements for selenium and related packages.
# Aider chat conversation:

USER: add the missing requirements for selenium and related packages

ASSISTANT: ```diff
--- requirements.in
+++ requirements.in
@@ ... @@
+webdriver_manager
+selenium
```

The above diff adds the missing requirements for Selenium and the WebDriver Manager to the `requirements.in` file.
2024-02-07 14:23:24 -08:00
Paul Gauthier
ef12107bd7 aider: Add command /web to use headless selenium to scrape a webpage and add the content to the chat.
# Aider chat conversation:

USER: Add a command /web to use headless selenium to scrape a webpage and add the content to the chat

ASSISTANT: To implement the `/web` command, we will need to add a new method to the `Commands` class in the `aider/commands.py` file. This method will use Selenium with a headless browser to scrape the content of a given webpage and add the content to the chat.

Here are the diffs for the changes:

```diff
--- aider/commands.py
+++ aider/commands.py
@@ ... @@
 from pathlib import Path
+from selenium import webdriver
+from selenium.webdriver.chrome.options import Options
+from selenium.webdriver.chrome.service import Service
+from selenium.webdriver.common.by import By
+from webdriver_manager.chrome import ChromeDriverManager
 import re
 import subprocess
@@ ... @@
 class Commands:
     voice = None
+    web_driver = None

     def __init__(self, io, coder, voice_language=None):
         self.io = io
@@ ... @@
         self.voice_language = voice_language
         self.tokenizer = coder.main_model.tokenizer
+        self.initialize_web_driver()

+    def initialize_web_driver(self):
+        chrome_options = Options()
+        chrome_options.add_argument("--headless")
+        chrome_options.add_argument("--disable-gpu")
+        chrome_options.add_argument("--no-sandbox")
+        chrome_options.add_argument("--disable-dev-shm-usage")
+        self.web_driver = webdriver.Chrome(
+            service=Service(ChromeDriverManager().install()),
+            options=chrome_options
+        )
+
+    def cmd_web(self, args):
+        "Use headless selenium to scrape a webpage and add the content to the chat"
+        url = args.strip()
+        if not url:
+            self.io.tool_error("Please provide a URL to scrape.")
+            return
+
+        try:
+            self.web_driver.get(url)
+            page_content = self.web_driver.find_element(By.TAG_NAME, "body").text
+            self.io.tool_output(f"Content from {url}:\n{page_content}")
+            return page_content
+        except Exception as e:
+            self.io.tool_error(f"Error scraping {url}: {e}")
+
     def is_command(self, inp):
         return inp[0] in "/!"
@@ ... @@
```

This diff adds the necessary imports for Selenium and the WebDriver manager, initializes a headless Chrome WebDriver when the `Commands` class is instantiated, and adds a new command method `cmd_web` that takes a URL as an argument, scrapes the webpage, and outputs the content to the chat.
2024-02-07 14:22:02 -08:00
Paul Gauthier
8d9c2ba60b Added links to openai docs/pricing 2024-02-07 14:17:24 -08:00
Paul Gauthier
49f81ac784 ssh 2024-02-07 12:13:32 -08:00
Paul Gauthier
35f812859e Rationalized openai model attributes #458 2024-02-07 12:07:30 -08:00
Paul Gauthier
873a388693 Fixed the ! shortcut for /run 2024-02-06 16:14:27 -08:00
Paul Gauthier
926e393529 set version to 0.23.1-dev 2024-02-03 08:40:50 -08:00
Paul Gauthier
b0fd819241 version bump to 0.23.0 2024-02-03 08:40:17 -08:00
Paul Gauthier
174702babe Updated gpt-4 turbo model switches 2024-02-03 08:39:19 -08:00
Paul Gauthier
bca265abfc Updated HISTORY 2024-02-03 08:31:28 -08:00
Paul Gauthier
e2e2ee83a4 Added support for gpt-4-0125-preview 2024-02-03 08:27:31 -08:00
Paul Gauthier
f5887a5098 tweaking graph labels 2024-02-03 08:25:19 -08:00
Paul Gauthier
da14474cbe Updated HISTORY 2024-01-31 17:55:22 -08:00
Paul Gauthier
1317ee1ace Added --openrouter 2024-01-31 17:33:50 -08:00
Paul Gauthier
e79732dcf7 Added env_vars for all the OPENAI_ env vars 2024-01-31 15:26:53 -08:00
Paul Gauthier
885e33c2b3 copy 2024-01-26 13:51:03 -08:00
Paul Gauthier
edcf9b146b updated graph 2024-01-25 15:33:52 -08:00
Paul Gauthier
bae834cc2f updated graph 2024-01-25 15:12:03 -08:00
Paul Gauthier
0fbd702bfa updated graph 2024-01-25 14:06:14 -08:00
Paul Gauthier
506c366b16 copy 2024-01-25 13:33:03 -08:00
Paul Gauthier
09bd4d7caf updated graph 2024-01-25 13:31:43 -08:00
Paul Gauthier
a75e7c8472 copy 2024-01-25 13:17:18 -08:00
Paul Gauthier
cd59f0d63a copy 2024-01-25 13:11:14 -08:00
Paul Gauthier
af9bab9643 copy 2024-01-25 13:05:22 -08:00
Paul Gauthier
9033be74bf Initial benchmark results for 0125 2024-01-25 13:00:16 -08:00
Paul Gauthier
13e9a01f3b copy 2024-01-24 10:19:50 -08:00
Paul Gauthier
448735a604 copy 2024-01-24 10:07:56 -08:00
Paul Gauthier
18c3b67ec2 copy 2024-01-24 09:59:41 -08:00
Paul Gauthier
22a73efec4 copy 2024-01-24 09:56:14 -08:00
Paul Gauthier
f6075605c6 copy 2024-01-24 09:53:04 -08:00
Paul Gauthier
065bc63e33 Merge remote-tracking branch 'origin/main' 2024-01-23 13:07:56 -08:00
Paul Gauthier
0c314144d2 Added /quit #451 2024-01-23 13:07:24 -08:00
paul-gauthier
247cab56f0
Merge pull request #453 from zackees/patch-1
fix https://github.com/paul-gauthier/aider/issues/452
2024-01-23 13:05:15 -08:00
Paul Gauthier
c31f2313ba updated docs 2024-01-23 12:58:29 -08:00
Paul Gauthier
3e96fda71a catch shutdown errors 2024-01-23 10:45:58 -08:00
Paul Gauthier
af4f224c00 cleanup 2024-01-23 10:02:07 -08:00
Paul Gauthier
580c52bd85 set mdargs on init 2024-01-23 09:58:57 -08:00
Paul Gauthier
da131da427 aider: Add __del__ method to MarkdownStream to call self.live.stop().
# Aider chat conversation:

USER: make sire self.live.stop() is called no matter how the object gets destroyed

ASSISTANT: To ensure that `self.live.stop()` is called no matter how the object gets destroyed, we can use Python's built-in `__del__` method. This method is called when an object is about to be destroyed. We can override this method in our `MarkdownStream` class to stop the `Live` instance.

Here are the steps to make this change:

1. Add a `__del__` method to the `MarkdownStream` class that calls `self.live.stop()`.

Here is the *SEARCH/REPLACE* block:

aider/mdstream.py
<source>python
<<<<<<< SEARCH
class MarkdownStream:
    live = None
    when = 0
    min_delay = 0.050
    live_window = 6

    def __init__(self):
        self.printed = []

        self.live = Live(Text(''), refresh_per_second=1./self.min_delay)
        self.live.start()
=======
class MarkdownStream:
    live = None
    when = 0
    min_delay = 0.050
    live_window = 6

    def __init__(self):
        self.printed = []

        self.live = Live(Text(''), refresh_per_second=1./self.min_delay)
        self.live.start()

    def __del__(self):
        self.live.stop()
>>>>>>> REPLACE
</source>
2024-01-23 09:50:27 -08:00
Paul Gauthier
24f1e01177 Refactored MarkdownStream to use rich.live for real-time updates and improved text rendering. 2024-01-23 09:50:23 -08:00
Paul Gauthier
b143bc56ac switch to mdstream 2024-01-23 09:20:31 -08:00
Paul Gauthier
e50a0e8b09 noop 2024-01-23 08:55:28 -08:00
Paul Gauthier
85383079f6 cleanup 2024-01-23 08:55:08 -08:00
Paul Gauthier
e6a4edf2e2 aider: Mark _text as noqa 501.
# Aider chat conversation:

USER: mark _text as noqa 501

ASSISTANT: To mark `_text` as `noqa 501`, we need to modify `aider/mdstream.py`:

1. Add `# noqa: 501` at the end of the `_text` variable declaration.

Here is the *SEARCH/REPLACE* block:

aider/mdstream.py
<source>python
<<<<<<< SEARCH
_text = 5 * _text
=======
_text = 5 * _text  # noqa: 501
>>>>>>> REPLACE
</source>
2024-01-23 08:53:34 -08:00
Paul Gauthier
c051104dc0 Add MarkdownStream class for displaying markdown content in a stream. 2024-01-23 08:53:29 -08:00
Zachary Vorhies
c6ced90e51
fix https://github.com/paul-gauthier/aider/issues/452
Adds option to skip the check for an update, better supports tooling which wants to do it's own update mechanism and not have aider print it out unconditionally.
2024-01-22 18:52:06 -08:00
Paul Gauthier
009c5c3c0d set version to 0.22.1-dev 2024-01-22 17:52:04 -08:00
Paul Gauthier
28b69f381c version bump to 0.22.0 2024-01-22 17:51:33 -08:00
Paul Gauthier
51810aa4d2 Updated HISTORY 2024-01-22 17:50:54 -08:00
Paul Gauthier
b2f36a786d Updated HISTORY 2024-01-22 14:49:15 -08:00
Paul Gauthier
4e3ace6199 Added ! as alias for /run #334 2024-01-22 13:52:59 -08:00