aboutsummaryrefslogtreecommitdiff
path: root/src/client/views/smartdraw/DrawingFillHandler.tsx
diff options
context:
space:
mode:
Diffstat (limited to 'src/client/views/smartdraw/DrawingFillHandler.tsx')
-rw-r--r--src/client/views/smartdraw/DrawingFillHandler.tsx5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/client/views/smartdraw/DrawingFillHandler.tsx b/src/client/views/smartdraw/DrawingFillHandler.tsx
index 48107ff0d..73a47681a 100644
--- a/src/client/views/smartdraw/DrawingFillHandler.tsx
+++ b/src/client/views/smartdraw/DrawingFillHandler.tsx
@@ -25,8 +25,8 @@ export class DrawingFillHandler {
: []
: Doc.Links(drawing)
.map(link => Doc.getOppositeAnchor(link, drawing))
- .map(anchor => anchor && DocCast(anchor.embedContainer));
- const styleUrl = await DocumentView.GetDocImage(styleDocs.filter(doc => doc?.data instanceof ImageField).lastElement())?.then(styleImg => {
+ .map(anchor => anchor && DocCast(anchor.embedContainer));
+ const styyleUrl = await DocumentView.GetDocImage(styleDocs.lastElement())?.then(styleImg => {
const hrefParts = ImageCast(styleImg).url.href.split('.');
return `${hrefParts.slice(0, -1).join('.')}_o.${hrefParts.lastElement()}`;
});
@@ -42,6 +42,7 @@ export class DrawingFillHandler {
const { href } = ImageCast(imageField).url;
const hrefParts = href.split('.');
const structureUrl = `${hrefParts.slice(0, -1).join('.')}_o.${hrefParts.lastElement()}`;
+ const styleUrl = styleDoc ? `${hrefParts.slice(0, -1).join('.')}_o.${hrefParts.lastElement()}` : undefined;
return imageUrlToBase64(structureUrl)
.then(gptDescribeImage)
.then((prompt, newPrompt = user_prompt || prompt) =>