Skip to content

Commit c6ded54

Browse files
authored
Update Generate an AI image.js (#458)
Uses Blocks to handle multiline prompts better
1 parent 05a4284 commit c6ded54

File tree

1 file changed

+17
-2
lines changed

1 file changed

+17
-2
lines changed

Parsers/Generate an AI image.js

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,8 +52,23 @@ if (dalleResponseStatusCode != 200) {
5252
var cloudinaryResponse = cloudinary.execute();
5353
var cloudinaryResponseBody = JSON.parse(cloudinaryResponse.getBody());
5454

55-
if (cloudinaryResponseBody.url) {
56-
new x_snc_slackerbot.Slacker().send_chat(current, "<" + cloudinaryResponseBody.url + "|" + prompt + ">\n");
55+
var message = {
56+
"blocks": [
57+
{
58+
"type": "image",
59+
"title": {
60+
"type": "plain_text",
61+
"text": prompt
62+
},
63+
"block_id": "image4",
64+
"image_url": cloudinaryResponseBody.url,
65+
"alt_text": prompt
66+
}
67+
]
68+
}
69+
70+
if (cloudinaryResponseBody.url) {
71+
new x_snc_slackerbot.Slacker().send_chat(current, message);
5772
} else {
5873
new x_snc_slackerbot.Slacker().send_chat(current, failureMessage);
5974
}

0 commit comments

Comments
 (0)