Skip to content

Commit

Permalink
Merge pull request #33019 from homer8173/patch-45
Browse files Browse the repository at this point in the history
Added substitutions in AI response
  • Loading branch information
eldy authored Feb 13, 2025
2 parents cdb651f + b7079ac commit cd88ad0
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions htdocs/core/class/html.formmail.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -1554,6 +1554,16 @@ public function getSectionForAIPrompt($function = 'textgeneration', $format = ''
}),
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\" />');
Expand Down

0 comments on commit cd88ad0

Please sign in to comment.