Merge pull request #33019 from homer8173/patch-45

Added substitutions in AI response
This commit is contained in:
Laurent Destailleur 2025-02-13 10:09:16 +01:00 committed by GitHub
commit cd88ad0bc6
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -1554,6 +1554,16 @@ class FormMail extends Form
}),
success: function(response) {
console.log('Received image URL: '+response);
// make substitutions
let substit = ". json_encode($this->substit).";
for (let key in substit) {
if (substit.hasOwnProperty(key)) {
// Replace the placeholder with its corresponding value
response = response.replace(key, substit[key]);
}
}
// Assuming response is the URL of the generated image
var imageUrl = response;
$('#ai_image_result').html('<img src=\"' + imageUrl + '\" alt=\"Generated Image\" />');