From c0328267be464a5258d2c148ff0e234846457242 Mon Sep 17 00:00:00 2001 From: Keegan George Date: Tue, 20 Aug 2024 12:53:51 -0700 Subject: [PATCH] FIX: Add original upload markdown on caption failure (#762) --- assets/javascripts/initializers/ai-image-caption.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/assets/javascripts/initializers/ai-image-caption.js b/assets/javascripts/initializers/ai-image-caption.js index d97352f9..b70bec65 100644 --- a/assets/javascripts/initializers/ai-image-caption.js +++ b/assets/javascripts/initializers/ai-image-caption.js @@ -145,6 +145,9 @@ export default apiInitializer("1.25.0", (api) => { } const caption = await fetchImageCaption(upload.url, "long_url"); + if (!caption) { + return getUploadMarkdown(upload); + } return `![${caption}|${upload.thumbnail_width}x${upload.thumbnail_height}](${upload.short_url})`; });