forked from retoor/devplacepy
37 lines
1.2 KiB
Python
37 lines
1.2 KiB
Python
# retoor <retoor@molodetz.nl>
|
|||
|
|
|
||
|
|
from __future__ import annotations
|
||
|
|
|
||
|
|
from .spec import Action, Param
|
||
|
|
|
||
|
|
FETCH_ACTIONS: tuple[Action, ...] = (
|
||
|
|
Action(
|
||
|
|
name="fetch_url",
|
||
|
|
method="LOCAL",
|
||
|
|
path="",
|
||
|
|
summary="Fetch a web page and return its readable text content",
|
||
|
|
description=(
|
||
|
|
"Retrieves any http(s) URL as a real browser would (stealth headers) and returns "
|
||
|
|
"the page title and readable text with links preserved, safely truncated to fit "
|
||
|
|
"the context window. Use it to read external pages, then summarize or create posts, "
|
||
|
|
"gists, or articles from the content. Private and loopback addresses are refused."
|
||
|
|
),
|
||
|
|
handler="fetch",
|
||
|
|
requires_auth=False,
|
||
|
|
params=(
|
||
|
|
Param(
|
||
|
|
name="url",
|
||
|
|
location="body",
|
||
|
|
description="The page URL to fetch (https is assumed if no scheme is given).",
|
||
|
|
required=True,
|
||
|
|
),
|
||
|
|
Param(
|
||
|
|
name="max_chars",
|
||
|
|
location="body",
|
||
|
|
description="Optional cap on returned characters; clamped to a context-safe maximum.",
|
||
|
|
type="integer",
|
||
|
|
),
|
||
|
|
),
|
||
|
|
),
|
||
|
|
)
|