Fix the issue with repeated URLs in the check_for_urls method

This commit is contained in:
Paul Gauthier (aider) 2024-07-28 16:41:38 -03:00
parent a0eadb62c5
commit 3e1ad07069

View file

@ -670,7 +670,7 @@ class Coder:
def check_for_urls(self, inp): def check_for_urls(self, inp):
url_pattern = re.compile(r"(https?://[^\s/$.?#].[^\s]*[^\s,.])") url_pattern = re.compile(r"(https?://[^\s/$.?#].[^\s]*[^\s,.])")
urls = url_pattern.findall(inp) urls = list(set(url_pattern.findall(inp))) # Use set to remove duplicates
for url in urls: for url in urls:
if self.io.confirm_ask(f"Add {url} to the chat?"): if self.io.confirm_ask(f"Add {url} to the chat?"):
inp += "\n\n" inp += "\n\n"