Validate URLs in web commands before execution (#2616)

Co-authored-by: Reinier van der Leer <github@pwuts.nl>
This commit is contained in:
Eddie Cohen
2023-04-24 06:33:44 -04:00
committed by GitHub
parent 794a164098
commit 40a75c804c
7 changed files with 120 additions and 82 deletions

View File

@@ -21,6 +21,7 @@ import autogpt.processing.text as summary
from autogpt.commands.command import command
from autogpt.config import Config
from autogpt.processing.html import extract_hyperlinks, format_hyperlinks
from autogpt.url_utils.validators import validate_url
FILE_DIR = Path(__file__).parent.parent
CFG = Config()
@@ -31,6 +32,7 @@ CFG = Config()
"Browse Website",
'"url": "<url>", "question": "<what_you_want_to_find_on_website>"',
)
@validate_url
def browse_website(url: str, question: str) -> tuple[str, WebDriver]:
"""Browse a website and return the answer and links to the user