aboutsummaryrefslogtreecommitdiff
path: root/src/client/views/nodes/formattedText/FormattedTextBox.tsx
diff options
context:
space:
mode:
Diffstat (limited to 'src/client/views/nodes/formattedText/FormattedTextBox.tsx')
-rw-r--r--src/client/views/nodes/formattedText/FormattedTextBox.tsx18
1 files changed, 11 insertions, 7 deletions
diff --git a/src/client/views/nodes/formattedText/FormattedTextBox.tsx b/src/client/views/nodes/formattedText/FormattedTextBox.tsx
index aee885688..2091ee89a 100644
--- a/src/client/views/nodes/formattedText/FormattedTextBox.tsx
+++ b/src/client/views/nodes/formattedText/FormattedTextBox.tsx
@@ -1001,12 +1001,16 @@ export class FormattedTextBox extends ViewBoxAnnotatableComponent<FormattedTextB
!help && cm.addItem({ description: 'Help...', subitems: helpItems, icon: 'eye' });
};
- findImageTags = () => {
+ findImageTags = async () => {
const c = this.ProseRef?.getElementsByTagName('img');
if (c) {
for (let i of c) {
- this.getImageDesc(i.src);
console.log(i);
+
+ // console.log(canvas.toDataURL());
+ // canvas.style.zIndex = '2000000';
+ // document.body.appendChild(canvas);
+ if (i.className !== 'ProseMirror-separator') this.getImageDesc(i.src);
}
}
// console.log('HI' + this.ProseRef?.getElementsByTagName('img'));
@@ -1031,13 +1035,13 @@ export class FormattedTextBox extends ViewBoxAnnotatableComponent<FormattedTextB
getImageDesc = async (u: string) => {
// if (StrCast(this.dataDoc.description)) return StrCast(this.dataDoc.description); // Return existing description
- const { href } = (u as URLField).url;
- const hrefParts = href.split('.');
+ // const { href } = (u as URLField).url;
+ const hrefParts = u.split('.');
const hrefComplete = `${hrefParts[0]}_o.${hrefParts[1]}`;
try {
- const hrefBase64 = await FormattedTextBox.imageUrlToBase64(hrefComplete);
- //const response = await gptImageLabel(hrefBase64, 'Tell me what words you see on this image.');
- const response = await gptImageLabel(hrefBase64, 'Make flashcards out of this text with each question and answer labeled as question and answer. Do not label each flashcard and do not include asterisks: ');
+ const hrefBase64 = await FormattedTextBox.imageUrlToBase64(u);
+ const response = await gptImageLabel(hrefBase64, 'Tell me what you see in this image');
+ //const response = await gptImageLabel(u, 'Make flashcards out of this text with each question and answer labeled as question and answer. Do not label each flashcard and do not include asterisks: ');
console.log(response);
// AnchorMenu.Instance.transferToFlashcard(response);
// this.Document[DocData].description = response.trim();