This commit is contained in:
2026-02-27 22:10:46 -05:00
parent fcd60c908b
commit a84ea40d16
11 changed files with 82 additions and 3 deletions

View File

@@ -398,7 +398,7 @@ def fetch_url(url: str) -> str:
if not url.startswith("http"):
url = "https://" + url
req = urllib.request.Request(url, headers={'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64)'})
req = urllib.request.Request(url, headers={'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/121.0.0.0 Safari/537.36'})
try:
with urllib.request.urlopen(req, timeout=10) as resp:
html = resp.read().decode('utf-8', errors='ignore')
@@ -406,6 +406,10 @@ def fetch_url(url: str) -> str:
parser.feed(html)
full_text = " ".join(parser.text)
full_text = _re.sub(r'\s+', ' ', full_text)
if not full_text.strip():
return f"FETCH OK: No readable text extracted from {url}. The page might be empty, JavaScript-heavy, or blocked."
# Limit to 40k chars to prevent context blowup
if len(full_text) > 40000:
return full_text[:40000] + "\n... (content truncated)"
@@ -417,7 +421,7 @@ def fetch_url(url: str) -> str:
def get_ui_performance() -> str:
"""Returns current UI performance metrics (FPS, Frame Time, CPU, Input Lag)."""
if perf_monitor_callback is None:
return "ERROR: Performance monitor callback not registered."
return "INFO: UI Performance monitor is not available (headless/CLI mode). This tool is only functional when the Manual Slop GUI is running."
try:
metrics = perf_monitor_callback()
# Clean up the dict string for the AI