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

Method do_web

aider/gui.py:464–496  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

462 self.messages.info(message)
463
464 def do_web(self):
465 st.markdown("Add the text content of a web page to the chat")
466
467 if not self.web_content_empty:
468 self.web_content_empty = st.empty()
469
470 if self.prompt_pending():
471 self.web_content_empty.empty()
472 self.state.web_content_num += 1
473
474 with self.web_content_empty:
475 self.web_content = st.text_input(
476 "URL",
477 placeholder="https://...",
478 key=f"web_content_{self.state.web_content_num}",
479 )
480
481 if not self.web_content:
482 return
483
484 url = self.web_content
485
486 if not self.state.scraper:
487 self.scraper = Scraper(print_error=self.info, playwright_available=has_playwright())
488
489 content = self.scraper.scrape(url) or ""
490 if content.strip():
491 content = f"{url}\n\n" + content
492 self.prompt = content
493 self.prompt_as = "text"
494 else:
495 self.info(f"No web content found for `{url}`.")
496 self.web_content = None
497
498 def do_undo(self, commit_hash):
499 self.last_undo_empty.empty()

Callers 1

do_add_web_pageMethod · 0.95

Calls 5

prompt_pendingMethod · 0.95
infoMethod · 0.95
ScraperClass · 0.90
has_playwrightFunction · 0.90
scrapeMethod · 0.45

Tested by

no test coverage detected