mirror of
https://github.com/Aider-AI/aider.git
synced 2025-05-24 14:25:00 +00:00
Add a memory to check_for_urls
to avoid asking about previously rejected URLs.
This commit is contained in:
parent
5bf9dbb226
commit
15faf69173
1 changed files with 10 additions and 4 deletions
|
@ -70,6 +70,7 @@ class Coder:
|
||||||
lint_outcome = None
|
lint_outcome = None
|
||||||
test_outcome = None
|
test_outcome = None
|
||||||
multi_response_content = ""
|
multi_response_content = ""
|
||||||
|
rejected_urls = set()
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def create(
|
def create(
|
||||||
|
@ -671,12 +672,17 @@ 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 = list(set(url_pattern.findall(inp))) # Use set to remove duplicates
|
urls = list(set(url_pattern.findall(inp))) # Use set to remove duplicates
|
||||||
|
added_urls = []
|
||||||
for url in urls:
|
for url in urls:
|
||||||
if self.io.confirm_ask(f"Add {url} to the chat?"):
|
if url not in self.rejected_urls:
|
||||||
inp += "\n\n"
|
if self.io.confirm_ask(f"Add {url} to the chat?"):
|
||||||
inp += self.commands.cmd_web(url)
|
inp += "\n\n"
|
||||||
|
inp += self.commands.cmd_web(url)
|
||||||
|
added_urls.append(url)
|
||||||
|
else:
|
||||||
|
self.rejected_urls.add(url)
|
||||||
|
|
||||||
return urls
|
return added_urls
|
||||||
|
|
||||||
def keyboard_interrupt(self):
|
def keyboard_interrupt(self):
|
||||||
now = time.time()
|
now = time.time()
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue