Compatibility with Gemini
I am using Gemini and getting a total failure for imports because it seems set up for `bedrock`. I can get around that with an `if` statement. ```php if ($provider->getPluginId() === 'bedrock') { $messages->setChatTools(new ToolsInput([new FormatPagesTool()])); } ``` But ... when I try to import a PDF that has an image/images in it, then the import fails because it can't read the JSON - `Couldn't decode JSON response: Syntax error`. --- I got it working with the help of Claude. Here's Claude suggestion for the text for this issue: When using a non-Bedrock AI provider (tested with Gemini via gemini_provider), the transform_ai_aio plugin fails in several ways: 1. **format_pages function not found** — AiAllInOne unconditionally attaches a ToolsInput containing FormatPagesTool to every chat request. Bedrock handles this correctly, but Gemini passes tool calls through its FunctionCallPluginManager, which has no registered plugin for format_pages, throwing Function with name format_pages not found. 2. **JSON syntax errors from Gemini** — When falling back to text-based JSON parsing (the non-Bedrock path), Gemini's responses contain two classes of invalid JSON: - Unescaped double quotes around emphasised words in content strings (e.g. a "tile" component), which breaks json_decode. - Invalid JSON escape sequences (\&quot;) produced when Gemini simultaneously HTML-encodes and JSON-escapes HTML attribute quotes. - Markdown code fences (```json) wrapping the response despite the prompt requesting plain JSON. 3. **Images not imported** — After the JSON is decoded, Gemini double-encodes the src attribute of image placeholders, producing <img src=""uuid.png""> (extra pair of double quotes). The Save plugin's filename-matching regex expects <img src="uuid.png"> and fails to match, so no image paragraph is created. 4. **cURL connection drops not retried** — Gemini wraps network errors as AiResponseErrorException, but AiAllInOne only catches AiRequestErrorException. The exception escapes the retry mechanism, causing the import to fail permanently instead of being retried.
issue