Update Modules/Web_Fetch.py
Browse files- Modules/Web_Fetch.py +2 -12
Modules/Web_Fetch.py
CHANGED
|
@@ -178,9 +178,9 @@ def _truncate_markdown(markdown: str, max_chars: int) -> Tuple[str, Dict[str, ob
|
|
| 178 |
def Web_Fetch(
|
| 179 |
url: Annotated[str, "The absolute URL to fetch (must return HTML)."],
|
| 180 |
max_chars: Annotated[int, "Maximum characters to return (0 = no limit, full page content)."] = 3000,
|
|
|
|
| 181 |
strip_selectors: Annotated[str, "CSS selectors to remove (comma-separated, e.g., '.header, .footer, nav')."] = "",
|
| 182 |
url_scraper: Annotated[bool, "Extract only links from the page instead of content."] = False,
|
| 183 |
-
offset: Annotated[int, "Character offset to start from (for pagination, use next_cursor from previous call)."] = 0,
|
| 184 |
) -> str:
|
| 185 |
_log_call_start(
|
| 186 |
"Web_Fetch",
|
|
@@ -239,18 +239,8 @@ def Web_Fetch(
|
|
| 239 |
|
| 240 |
|
| 241 |
def build_interface() -> gr.Interface:
|
| 242 |
-
# Wrapper to preserve original Web_Fetch signature while reordering UI inputs
|
| 243 |
-
def _web_fetch_ui(url: str, max_chars: int, offset: int, strip_selectors: str, url_scraper: bool) -> str:
|
| 244 |
-
return Web_Fetch(
|
| 245 |
-
url=url,
|
| 246 |
-
max_chars=max_chars,
|
| 247 |
-
strip_selectors=strip_selectors,
|
| 248 |
-
url_scraper=url_scraper,
|
| 249 |
-
offset=offset,
|
| 250 |
-
)
|
| 251 |
-
|
| 252 |
return gr.Interface(
|
| 253 |
-
fn=
|
| 254 |
inputs=[
|
| 255 |
gr.Textbox(label="URL", placeholder="https://example.com/article", max_lines=1),
|
| 256 |
gr.Slider(minimum=0, maximum=20000, value=3000, step=100, label="Max Characters", info="0 = no limit (full page), default 3000"),
|
|
|
|
| 178 |
def Web_Fetch(
|
| 179 |
url: Annotated[str, "The absolute URL to fetch (must return HTML)."],
|
| 180 |
max_chars: Annotated[int, "Maximum characters to return (0 = no limit, full page content)."] = 3000,
|
| 181 |
+
offset: Annotated[int, "Character offset to start from (for pagination, use next_cursor from previous call)."] = 0,
|
| 182 |
strip_selectors: Annotated[str, "CSS selectors to remove (comma-separated, e.g., '.header, .footer, nav')."] = "",
|
| 183 |
url_scraper: Annotated[bool, "Extract only links from the page instead of content."] = False,
|
|
|
|
| 184 |
) -> str:
|
| 185 |
_log_call_start(
|
| 186 |
"Web_Fetch",
|
|
|
|
| 239 |
|
| 240 |
|
| 241 |
def build_interface() -> gr.Interface:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 242 |
return gr.Interface(
|
| 243 |
+
fn=Web_Fetch,
|
| 244 |
inputs=[
|
| 245 |
gr.Textbox(label="URL", placeholder="https://example.com/article", max_lines=1),
|
| 246 |
gr.Slider(minimum=0, maximum=20000, value=3000, step=100, label="Max Characters", info="0 = no limit (full page), default 3000"),
|