fix(xai-image): drop unreachable editing code path

The agent-facing image_generate tool only passes prompt + aspect_ratio to
provider.generate() (see tools/image_generation_tool.py:953). The editing
block (reference_images / edit_image kwargs) could never fire from the
tool surface, and the xAI edits endpoint is /images/edits with a
different payload shape anyway — not /images/generations as submitted.

- Remove reference_images / edit_image kwargs handling from generate()
- Remove matching test_with_reference_images case
- Update docstring + plugin.yaml description to text-to-image only
- Surface resolution in the success extras

Follow-up to PR #14547. Tests: 18/18 pass.
This commit is contained in:
teknium1 2026-04-23 15:12:05 -07:00 committed by Teknium
parent a5e4a86ebe
commit 9599271180
3 changed files with 6 additions and 41 deletions

View file

@ -199,30 +199,6 @@ class TestGenerate:
assert result["success"] is False
assert result["error_type"] == "empty_response"
def test_with_reference_images(self):
from plugins.image_gen.xai import XAIImageGenProvider
mock_resp = MagicMock()
mock_resp.status_code = 200
mock_resp.raise_for_status = MagicMock()
mock_resp.json.return_value = {
"data": [{"url": "https://xai.image/edited.png"}],
}
with patch("plugins.image_gen.xai.requests.post", return_value=mock_resp) as mock_post:
provider = XAIImageGenProvider()
result = provider.generate(
prompt="Edit this image",
reference_images=["https://example.com/ref1.png", "https://example.com/ref2.png"],
)
assert result["success"] is True
# Check that reference_images was passed in payload
call_args = mock_post.call_args
payload = call_args.kwargs.get("json") or call_args[1].get("json")
assert "reference_images" in payload
assert len(payload["reference_images"]) == 2
def test_auth_header(self):
from plugins.image_gen.xai import XAIImageGenProvider