summaryrefslogtreecommitdiff
path: root/misc/py-aider-chat/files
diff options
context:
space:
mode:
Diffstat (limited to 'misc/py-aider-chat/files')
-rw-r--r--misc/py-aider-chat/files/patch-aider_commands.py29
-rw-r--r--misc/py-aider-chat/files/patch-aider_scrape.py79
-rw-r--r--misc/py-aider-chat/files/patch-pyproject.toml6
3 files changed, 32 insertions, 82 deletions
diff --git a/misc/py-aider-chat/files/patch-aider_commands.py b/misc/py-aider-chat/files/patch-aider_commands.py
index 9a9c10e0cebe..cfa6e67a6b58 100644
--- a/misc/py-aider-chat/files/patch-aider_commands.py
+++ b/misc/py-aider-chat/files/patch-aider_commands.py
@@ -1,6 +1,6 @@
---- aider/commands.py.orig 2025-02-24 10:27:07 UTC
+--- aider/commands.py.orig 2025-05-09 22:41:18 UTC
+++ aider/commands.py
-@@ -20,7 +20,7 @@ from aider.run_cmd import run_cmd
+@@ -21,7 +21,7 @@ from aider.run_cmd import run_cmd
from aider.llm import litellm
from aider.repo import ANY_GIT_ERROR
from aider.run_cmd import run_cmd
@@ -9,17 +9,24 @@
from aider.utils import is_image_file
from .dump import dump # noqa: F401
-@@ -172,12 +172,8 @@ class Commands:
+@@ -220,20 +220,6 @@ class Commands:
+ return
self.io.tool_output(f"Scraping {url}...")
- if not self.scraper:
-- res = install_playwright(self.io)
-- if not res:
-- self.io.tool_warning("Unable to initialize playwright.")
+- if not self.scraper:
+- disable_playwright = getattr(self.args, "disable_playwright", False)
+- if disable_playwright:
+- res = False
+- else:
+- res = install_playwright(self.io)
+- if not res:
+- self.io.tool_warning("Unable to initialize playwright.")
-
- self.scraper = Scraper(
-- print_error=self.io.tool_error, playwright_available=res, verify_ssl=self.verify_ssl
-+ print_error=self.io.tool_error, playwright_available=False, verify_ssl=self.verify_ssl
- )
+- self.scraper = Scraper(
+- print_error=self.io.tool_error,
+- playwright_available=res,
+- verify_ssl=self.verify_ssl,
+- )
content = self.scraper.scrape(url) or ""
+ content = f"Here is the content of {url}:\n\n" + content
diff --git a/misc/py-aider-chat/files/patch-aider_scrape.py b/misc/py-aider-chat/files/patch-aider_scrape.py
index 969ff29d15f8..ba103c6f725e 100644
--- a/misc/py-aider-chat/files/patch-aider_scrape.py
+++ b/misc/py-aider-chat/files/patch-aider_scrape.py
@@ -1,65 +1,6 @@
---- aider/scrape.py.orig 2024-09-09 10:28:04 UTC
+--- aider/scrape.py.orig 2025-05-09 22:41:18 UTC
+++ aider/scrape.py
-@@ -15,57 +15,8 @@ def install_playwright(io):
-
-
- def install_playwright(io):
-- try:
-- from playwright.sync_api import sync_playwright
-+ return False
-
-- has_pip = True
-- except ImportError:
-- has_pip = False
--
-- try:
-- with sync_playwright() as p:
-- p.chromium.launch()
-- has_chromium = True
-- except Exception:
-- has_chromium = False
--
-- if has_pip and has_chromium:
-- return True
--
-- pip_cmd = utils.get_pip_install(["aider-chat[playwright]"])
-- chromium_cmd = "-m playwright install --with-deps chromium"
-- chromium_cmd = [sys.executable] + chromium_cmd.split()
--
-- cmds = ""
-- if not has_pip:
-- cmds += " ".join(pip_cmd) + "\n"
-- if not has_chromium:
-- cmds += " ".join(chromium_cmd) + "\n"
--
-- text = f"""For the best web scraping, install Playwright:
--
--{cmds}
--See {urls.enable_playwright} for more info.
--"""
--
-- io.tool_output(text)
-- if not io.confirm_ask("Install playwright?", default="y"):
-- return
--
-- if not has_pip:
-- success, output = utils.run_install(pip_cmd)
-- if not success:
-- io.tool_error(output)
-- return
--
-- success, output = utils.run_install(chromium_cmd)
-- if not success:
-- io.tool_error(output)
-- return
--
-- return True
--
--
- class Scraper:
- pandoc_available = None
- playwright_available = None
-@@ -82,7 +33,7 @@ class Scraper:
+@@ -92,7 +92,7 @@ class Scraper:
else:
self.print_error = print
@@ -68,7 +9,7 @@
self.verify_ssl = verify_ssl
def scrape(self, url):
-@@ -93,10 +44,7 @@ class Scraper:
+@@ -103,10 +103,7 @@ class Scraper:
`url` - the URL to scrape.
"""
@@ -80,10 +21,12 @@
if not content:
self.print_error(f"Failed to retrieve content from {url}")
-@@ -130,56 +78,6 @@ class Scraper:
+@@ -138,58 +135,6 @@ class Scraper:
+ ]
+ return any(re.search(pattern, content, re.IGNORECASE) for pattern in html_patterns)
return False
-
- # Internals...
+-
+- # Internals...
- def scrape_with_playwright(self, url):
- import playwright # noqa: F401
- from playwright.sync_api import Error as PlaywrightError
@@ -113,7 +56,8 @@
- try:
- response = page.goto(url, wait_until="networkidle", timeout=5000)
- except PlaywrightTimeoutError:
-- self.print_error(f"Timeout while loading {url}")
+- print(f"Page didn't quiesce, scraping content anyway: {url}")
+- response = None
- except PlaywrightError as e:
- self.print_error(f"Error navigating to {url}: {str(e)}")
- return None, None
@@ -133,7 +77,6 @@
- browser.close()
-
- return content, mime_type
--
+
def scrape_with_httpx(self, url):
import httpx
-
diff --git a/misc/py-aider-chat/files/patch-pyproject.toml b/misc/py-aider-chat/files/patch-pyproject.toml
index 2c261ee0ce98..c6b5ebe68b8c 100644
--- a/misc/py-aider-chat/files/patch-pyproject.toml
+++ b/misc/py-aider-chat/files/patch-pyproject.toml
@@ -1,7 +1,7 @@
---- pyproject.toml.orig 2024-09-09 09:50:15 UTC
+--- pyproject.toml.orig 2025-04-14 23:24:32 UTC
+++ pyproject.toml
-@@ -62,7 +62,7 @@ include = ["aider*", "aider.website"]
- ]
+@@ -41,7 +41,7 @@ include = ["aider"]
+ include = ["aider"]
[build-system]
-requires = ["setuptools>=68", "setuptools_scm[toml]>=8"]