fix: route image.generate through the provider dispatcher (#85520)

The ws handler called the in-tree FAL leaf (image_generate_tool)
directly, bypassing _handle_image_generate's dispatch chain — plugin-
registered providers and managed Krea routing never ran, so a user
with a non-FAL image provider configured got FAL (or a failure)
instead of their provider. Reported against the Hermes-Bot-Mode
plugin's avatar generation; defect is in the RPC, not the plugin.
Source-image confinement also now applies, matching the model tool.
This commit is contained in:
Teknium
2026-08-13 11:23:51 -07:00
committed by GitHub
parent 70143def0f
commit 787f42cc16

View File

@@ -97,9 +97,13 @@ def _(rid, params: dict) -> dict:
cap = 8_000_000
try:
from tools.image_generation_tool import image_generate_tool
from tools.image_generation_tool import _handle_image_generate
raw = image_generate_tool(prompt=prompt, aspect_ratio=aspect)
# Full provider dispatcher — the same path the model tool takes:
# source-image confinement, plugin-registered providers, managed
# Krea routing, then the in-tree FAL fallback. Calling the FAL leaf
# (image_generate_tool) directly here bypassed configured providers.
raw = _handle_image_generate({"prompt": prompt, "aspect_ratio": aspect})
result = json.loads(raw)
except Exception as e:
return _err(rid, 5071, str(e))