Fix inline images to use data URI format instead of raw base64 #138
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Inline images were being sent as raw base64 to the OpenAI API, which expects a data URI (
data:image/png;base64,...) for theimage_url.urlfield. This caused 400 errors as the API attempted to download the base64 string as a URL.Changes
$file->getDataUri()instead of$file->getBase64Data()for inline images inAbstractOpenAiCompatibleTextGenerationModel::getMessagePartContentData()Note: Audio inputs correctly continue using
getBase64Data()since that API expects raw base64 with a separateformatfield.Warning
Firewall rules blocked me from connecting to one or more addresses (expand for details)
I tried to connect to the following addresses, but was blocked by firewall rules:
https://api.github.com/repos/PHPCSStandards/PHPCSUtils/zipball/f7eb16f2fa4237d5db9e8fed8050239bee17a9bd/usr/bin/php8.3 /usr/bin/php8.3 -n -c /tmp/1ygweD /usr/bin/composer install --no-progress(http block)https://api.github.com/repos/PHPCSStandards/PHP_CodeSniffer/zipball/5b5e3821314f947dd040c70f7992a64eac89025c/usr/bin/php8.3 /usr/bin/php8.3 -n -c /tmp/1ygweD /usr/bin/composer install --no-progress(http block)https://api.github.com/repos/PHPCSStandards/composer-installer/zipball/e9cf5e4bbf7eeaf9ef5db34938942602838fc2b1/usr/bin/php8.3 /usr/bin/php8.3 -n -c /tmp/1ygweD /usr/bin/composer install --no-progress(http block)https://api.github.com/repos/PHPCompatibility/PHPCompatibility/zipball/6e10469b0f3827862b37df2ac2b7ec4580ce888f/usr/bin/php8.3 /usr/bin/php8.3 -n -c /tmp/1ygweD /usr/bin/composer install --no-progress(http block)https://api.github.com/repos/clue/stream-filter/zipball/049509fef80032cb3f051595029ab75b49a3c2f7/usr/bin/php8.3 /usr/bin/php8.3 -n -c /tmp/1ygweD /usr/bin/composer install --no-progress(http block)https://api.github.com/repos/doctrine/instantiator/zipball/0a0fa9780f5d4e507415a065172d26a98d02047b/usr/bin/php8.3 /usr/bin/php8.3 -n -c /tmp/1ygweD /usr/bin/composer install --no-progress(http block)https://api.github.com/repos/myclabs/DeepCopy/zipball/07d290f0c47959fd5eed98c95ee5602db07e0b6a/usr/bin/php8.3 /usr/bin/php8.3 -n -c /tmp/1ygweD /usr/bin/composer install --no-progress(http block)https://api.github.com/repos/php-http/client-common/zipball/0cfe9858ab9d3b213041b947c881d5b19ceeca46/usr/bin/php8.3 /usr/bin/php8.3 -n -c /tmp/1ygweD /usr/bin/composer install --no-progress(http block)https://api.github.com/repos/php-http/curl-client/zipball/f3eb48d266341afec0229a7a37a03521d3646b81/usr/bin/php8.3 /usr/bin/php8.3 -n -c /tmp/1ygweD /usr/bin/composer install --no-progress(http block)https://api.github.com/repos/php-http/discovery/zipball/82fe4c73ef3363caed49ff8dd1539ba06044910d/usr/bin/php8.3 /usr/bin/php8.3 -n -c /tmp/1ygweD /usr/bin/composer install --no-progress(http block)https://api.github.com/repos/php-http/httplug/zipball/5cad731844891a4c282f3f3e1b582c46839d22f4/usr/bin/php8.3 /usr/bin/php8.3 -n -c /tmp/1ygweD /usr/bin/composer install --no-progress(http block)https://api.github.com/repos/php-http/message-factory/zipball/4d8778e1c7d405cbb471574821c1ff5b68cc8f57/usr/bin/php8.3 /usr/bin/php8.3 -n -c /tmp/1ygweD /usr/bin/composer install --no-progress(http block)https://api.github.com/repos/php-http/message/zipball/06dd5e8562f84e641bf929bfe699ee0f5ce8080a/usr/bin/php8.3 /usr/bin/php8.3 -n -c /tmp/1ygweD /usr/bin/composer install --no-progress(http block)https://api.github.com/repos/php-http/mock-client/zipball/81f558234421f7da58ed015604a03808996017d0/usr/bin/php8.3 /usr/bin/php8.3 -n -c /tmp/1ygweD /usr/bin/composer install --no-progress(http block)https://api.github.com/repos/php-http/promise/zipball/fc85b1fba37c169a69a07ef0d5a8075770cc1f83/usr/bin/php8.3 /usr/bin/php8.3 -n -c /tmp/1ygweD /usr/bin/composer install --no-progress(http block)https://api.github.com/repos/phpstan/phpdoc-parser/zipball/b9e61a61e39e02dd90944e9115241c7f7e76bfd8/usr/bin/php8.3 /usr/bin/php8.3 -n -c /tmp/1ygweD /usr/bin/composer install --no-progress(http block)https://api.github.com/repos/phpstan/phpstan/zipball/41600c8379eb5aee63e9413fe9e97273e25d57e4/usr/bin/php8.3 /usr/bin/php8.3 -n -c /tmp/1ygweD /usr/bin/composer install --no-progress(http block)https://api.github.com/repos/ralouphie/getallheaders/zipball/120b605dfeb996808c31b6477290a714d356e822/usr/bin/php8.3 /usr/bin/php8.3 -n -c /tmp/1ygweD /usr/bin/composer install --no-progress(http block)https://api.github.com/repos/sebastianbergmann/object-reflector/zipball/b4f479ebdbf63ac605d183ece17d8d7fe49c15c7/usr/bin/php8.3 /usr/bin/php8.3 -n -c /tmp/1ygweD /usr/bin/composer install --no-progress(http block)https://api.github.com/repos/sebastianbergmann/phpunit/zipball/ea49afa29aeea25ea7bf9de9fdd7cab163cc0701/usr/bin/php8.3 /usr/bin/php8.3 -n -c /tmp/1ygweD /usr/bin/composer install --no-progress(http block)https://api.github.com/repos/sebastianbergmann/recursion-context/zipball/539c6691e0623af6dc6f9c20384c120f963465a0/usr/bin/php8.3 /usr/bin/php8.3 -n -c /tmp/1ygweD /usr/bin/composer install --no-progress(http block)https://api.github.com/repos/sebastianbergmann/resource-operations/zipball/05d5692a7993ecccd56a03e40cd7e5b09b1d404e/usr/bin/php8.3 /usr/bin/php8.3 -n -c /tmp/1ygweD /usr/bin/composer install --no-progress(http block)https://api.github.com/repos/sebastianbergmann/type/zipball/75e2c2a32f5e0b3aef905b9ed0b179b953b3d7c7/usr/bin/php8.3 /usr/bin/php8.3 -n -c /tmp/1ygweD /usr/bin/composer install --no-progress(http block)https://api.github.com/repos/sebastianbergmann/version/zipball/c6c1022351a901512170118436c764e473f6de8c/usr/bin/php8.3 /usr/bin/php8.3 -n -c /tmp/1ygweD /usr/bin/composer install --no-progress(http block)https://api.github.com/repos/slevomat/coding-standard/zipball/b4f9f02edd4e6a586777f0cabe8d05574323f3eb/usr/bin/php8.3 /usr/bin/php8.3 -n -c /tmp/1ygweD /usr/bin/composer install --no-progress(http block)https://api.github.com/repos/symfony/deprecation-contracts/zipball/605389f2a7e5625f273b53960dc46aeaf9c62918/usr/bin/php8.3 /usr/bin/php8.3 -n -c /tmp/aF8zSF /usr/bin/composer install(http block)/usr/bin/php8.3 /usr/bin/php8.3 -n -c /tmp/1ygweD /usr/bin/composer install --no-progress(http block)https://api.github.com/repos/symfony/options-resolver/zipball/74e5b6f0db3e8589e6cfd5efb317a1fc2bb52fb6/usr/bin/php8.3 /usr/bin/php8.3 -n -c /tmp/1ygweD /usr/bin/composer install --no-progress(http block)https://api.github.com/repos/symfony/polyfill-php73/zipball/0f68c03565dcaaf25a890667542e8bd75fe7e5bb/usr/bin/php8.3 /usr/bin/php8.3 -n -c /tmp/1ygweD /usr/bin/composer install --no-progress(http block)https://api.github.com/repos/symfony/polyfill-php80/zipball/0cc9dd0f17f61d8131e7df6b84bd344899fe2608/usr/bin/php8.3 /usr/bin/php8.3 -n -c /tmp/1ygweD /usr/bin/composer install --no-progress(http block)If you need me to access, download, or install something from one of these locations, you can either:
Original prompt
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.