MCPcopy
hub / github.com/Aider-AI/aider / check_for_urls

Method check_for_urls

aider/coders/base_coder.py:964–984  ·  view source on GitHub ↗

Check input for URLs and offer to add them to the chat.

(self, inp: str)

Source from the content-addressed store, hash-verified

962 return urls
963
964 def check_for_urls(self, inp: str) -> List[str]:
965 """Check input for URLs and offer to add them to the chat."""
966 if not self.detect_urls:
967 return inp
968
969 # Exclude double quotes from the matched URL characters
970 url_pattern = re.compile(r'(https?://[^\s/$.?#].[^\s"]*[^\s,.])')
971 urls = list(set(url_pattern.findall(inp))) # Use set to remove duplicates
972 group = ConfirmGroup(urls)
973 for url in urls:
974 if url not in self.rejected_urls:
975 url = url.rstrip(".',\"")
976 if self.io.confirm_ask(
977 "Add URL to the chat?", subject=url, group=group, allow_never=True
978 ):
979 inp += "\n\n"
980 inp += self.commands.cmd_web(url, return_content=True)
981 else:
982 self.rejected_urls.add(url)
983
984 return inp
985
986 def keyboard_interrupt(self):
987 # Ensure cursor is visible on exit

Callers 4

preproc_user_inputMethod · 0.95
test_check_for_urlsMethod · 0.80

Calls 3

ConfirmGroupClass · 0.90
cmd_webMethod · 0.80
confirm_askMethod · 0.45

Tested by 3

test_check_for_urlsMethod · 0.64