Merge branch 'main' into swe-bench

This commit is contained in:
Paul Gauthier 2024-05-23 13:36:23 -07:00
commit fb76895eb1
8 changed files with 2245 additions and 5 deletions

View file

@ -618,6 +618,20 @@ class Coder:
return self.commands.run(inp)
self.check_for_file_mentions(inp)
inp = self.check_for_urls(inp)
return inp
def check_for_urls(self, inp):
url_pattern = re.compile(
r"http[s]?://(?:[a-zA-Z]|[0-9]|[$-_@.&+]|[!*\\(\\),]|(?:%[0-9a-fA-F][0-9a-fA-F]))+"
)
urls = url_pattern.findall(inp)
for url in urls:
if self.io.confirm_ask(f"Add {url} to the chat?"):
inp += "\n\n"
inp += self.commands.cmd_web(url)
return inp
def keyboard_interrupt(self):