mirror of
https://github.com/NousResearch/hermes-agent.git
synced 2026-07-19 15:18:03 +00:00
fix(tools): never let a model whitelist strip the prompt / source images
_build_fal_payload and _build_fal_edit_payload assemble the request and then filter it down to the model's supports / edit_supports whitelist. That filter also covers prompt (and image_urls for edits), which every FAL endpoint requires. Today all model configs happen to list those keys, but a single config that omits one would silently produce a request with no prompt or no source images — a broken generation with no error. Always keep the mandatory keys regardless of the whitelist so a missing whitelist entry can only drop optional knobs, never the prompt or the images.
This commit is contained in:
parent
8ebe37f6ad
commit
d45addc2f1
2 changed files with 50 additions and 2 deletions
|
|
@ -607,7 +607,13 @@ def _build_fal_payload(
|
|||
payload[k] = v
|
||||
|
||||
supports = meta["supports"]
|
||||
return {k: v for k, v in payload.items() if k in supports}
|
||||
# ``prompt`` is required by every FAL text-to-image endpoint; keep it even
|
||||
# if a model's ``supports`` whitelist omits it, so a missing whitelist entry
|
||||
# can't silently strip the prompt and send an empty request.
|
||||
return {
|
||||
k: v for k, v in payload.items()
|
||||
if k in supports or k == "prompt"
|
||||
}
|
||||
|
||||
|
||||
def _build_fal_edit_payload(
|
||||
|
|
@ -656,7 +662,15 @@ def _build_fal_edit_payload(
|
|||
if v is not None:
|
||||
payload[k] = v
|
||||
|
||||
return {k: v for k, v in payload.items() if k in edit_supports}
|
||||
# ``prompt`` and ``image_urls`` are required by every FAL edit endpoint;
|
||||
# keep them even if a model's ``edit_supports`` whitelist omits them, so a
|
||||
# missing whitelist entry can't silently drop the prompt or the source
|
||||
# images and send a broken edit request.
|
||||
_required = {"prompt", "image_urls"}
|
||||
return {
|
||||
k: v for k, v in payload.items()
|
||||
if k in edit_supports or k in _required
|
||||
}
|
||||
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue