You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Responses from GPT sometimes includes words or phrases surrounded by quote marks (or other HTML special characters/entities). This is causing issues where the generated alt text breaks the HTML markup.
Example
<imgsrc="example.jpg" alt="Stacked coins of increasing height next to wooden blocks spelling "HEALTH." The arrangement symbolizes the connection between health and wealth.">
Notice how HEALTH is surrounded by quote marks. This is breaking the markup and causing multiple knock-on effects.
Suggested Fix
Could the returned response be further sanitised to escape special characters? There are cases where they might be relevant to the description so removing them entirely wouldn't be ideal. For example:
$result = trim($response->choices[0]->message->content);
// Escape the special characters$sanitisedResult = htmlspecialchars($result, ENT_QUOTES, 'UTF-8');
Environment
Statamic: 4.58.2
PHP: 8.2.17
A.I.D.A: 1.0.1
The text was updated successfully, but these errors were encountered:
thanks for your report. We included your suggested fix in the newest version and also provided an alternative solution for custom generators using Statamic's sanitize modifier.
Responses from GPT sometimes includes words or phrases surrounded by quote marks (or other HTML special characters/entities). This is causing issues where the generated alt text breaks the HTML markup.
Example
Notice how HEALTH is surrounded by quote marks. This is breaking the markup and causing multiple knock-on effects.
Suggested Fix
Could the returned response be further sanitised to escape special characters? There are cases where they might be relevant to the description so removing them entirely wouldn't be ideal. For example:
Environment
Statamic: 4.58.2
PHP: 8.2.17
A.I.D.A: 1.0.1
The text was updated successfully, but these errors were encountered: