Skip to content

AutoGPT is the vision of accessible AI for everyone, to use and to build on. Our mission is to provide the tools, so that you can focus on what matters.

Adding most basic URL validation in scrape_text

Itamar Friedmanda4a045bd6aa
diff --git a/scripts/browse.py b/scripts/browse.py
index 40e6ca1fe0..7eeaaf4d94 100644
--- a/scripts/browse.py
+++ b/scripts/browse.py
@@ -6,6 +6,10 @@ from llm_utils import create_chat_completion
cfg = Config()
def scrape_text(url):
+ # Most basic check if the URL is valid:
+ if not url.startswith('http'):
+ return "Error: Invalid URL"
+
try:
response = requests.get(url, headers=cfg.user_agent_header)
except requests.exceptions.RequestException as e: