mirror of
https://github.com/calesthio/OpenMontage.git
synced 2026-08-26 01:52:30 +08:00
Clamp Pixabay per_page to API-required 3-200 range
Pixabay rejects per_page outside 3-200 with HTTP 400. The stock_sources adapter already clamped, but the PixabayVideo and PixabayImage tools passed the value through raw, so callers using per_page < 3 got a 400. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
@@ -127,7 +127,8 @@ class PixabayImage(BaseTool):
|
||||
params: dict[str, Any] = {
|
||||
"key": api_key,
|
||||
"q": query,
|
||||
"per_page": inputs.get("per_page", 5),
|
||||
# Pixabay rejects per_page outside 3-200 with HTTP 400
|
||||
"per_page": max(3, min(inputs.get("per_page", 5), 200)),
|
||||
"page": inputs.get("page", 1),
|
||||
"safesearch": str(inputs.get("safesearch", True)).lower(),
|
||||
}
|
||||
|
||||
@@ -130,7 +130,8 @@ class PixabayVideo(BaseTool):
|
||||
params: dict[str, Any] = {
|
||||
"key": api_key,
|
||||
"q": query,
|
||||
"per_page": inputs.get("per_page", 5),
|
||||
# Pixabay rejects per_page outside 3-200 with HTTP 400
|
||||
"per_page": max(3, min(inputs.get("per_page", 5), 200)),
|
||||
"page": inputs.get("page", 1),
|
||||
"safesearch": str(inputs.get("safesearch", True)).lower(),
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user