aboutsummaryrefslogtreecommitdiff
path: root/src/client/views/StyleProviderQuiz.tsx
diff options
context:
space:
mode:
authorbobzel <zzzman@gmail.com>2025-04-21 13:48:58 -0400
committerbobzel <zzzman@gmail.com>2025-04-21 13:48:58 -0400
commit17e24e780b54f2f7015c0ca955c3aa5091bba19c (patch)
treeb13002c92d58cb52a02b46e4e1d578f1d57125f2 /src/client/views/StyleProviderQuiz.tsx
parent22a40443193320487c27ce02bd3f134d13cb7d65 (diff)
parent1f294ef4a171eec72a069a9503629eaf7975d983 (diff)
merged with master and cleaned up outpainting a bit.
Diffstat (limited to 'src/client/views/StyleProviderQuiz.tsx')
-rw-r--r--src/client/views/StyleProviderQuiz.tsx39
1 files changed, 20 insertions, 19 deletions
diff --git a/src/client/views/StyleProviderQuiz.tsx b/src/client/views/StyleProviderQuiz.tsx
index acda38dd7..fe76bce28 100644
--- a/src/client/views/StyleProviderQuiz.tsx
+++ b/src/client/views/StyleProviderQuiz.tsx
@@ -9,7 +9,7 @@ import { DocData } from '../../fields/DocSymbols';
import { List } from '../../fields/List';
import { NumCast, StrCast } from '../../fields/Types';
import { Networking } from '../Network';
-import { GPTCallType, gptAPICall, gptImageLabel } from '../apis/gpt/GPT';
+import { GPTCallType, gptAPICall } from '../apis/gpt/GPT';
import { Docs } from '../documents/Documents';
import { ContextMenu } from './ContextMenu';
import { ContextMenuProps } from './ContextMenuItem';
@@ -67,7 +67,7 @@ export namespace styleProviderQuiz {
newCol.zIndex = 1000;
newCol.forceActive = true;
newCol.quiz = text;
- newCol[DocData][Doc.LayoutFieldKey(newCol) + '_transform'] = 'none';
+ newCol['$' + Doc.LayoutDataKey(newCol) + '_transform'] = 'none';
Doc.AddDocToList(img.Document, 'quizBoxes', newCol);
img.addDocument(newCol);
// img._loading = false;
@@ -110,20 +110,21 @@ export namespace styleProviderQuiz {
const blob = await ImageUtility.canvasToBlob(canvas);
return selectUrlToBase64(blob);
}
- /**
- * Create flashcards from an image.
- */
- async function makeFlashcardsForImage(img: ImageBox) {
- img.Loading = true;
- try {
- const hrefBase64 = await createCanvas(img);
- const response = await gptImageLabel(hrefBase64, 'Make flashcards out of this image with each question and answer labeled as "question" and "answer". Do not label each flashcard and do not include asterisks: ');
- AnchorMenu.Instance.transferToFlashcard(response, NumCast(img.layoutDoc.x), NumCast(img.layoutDoc.y));
- } catch (error) {
- console.log('Error', error);
- }
- img.Loading = false;
- }
+
+ // /**
+ // * Create flashcards from an image.
+ // */
+ // async function makeFlashcardsForImage(img: ImageBox) {
+ // img.Loading = true;
+ // try {
+ // const hrefBase64 = await createCanvas(img);
+ // const response = await gptImageLabel(hrefBase64, 'Make flashcards out of this image with each question and answer labeled as "question" and "answer". Do not label each flashcard and do not include asterisks: ');
+ // AnchorMenu.Instance.transferToFlashcard(response, NumCast(img.layoutDoc.x), NumCast(img.layoutDoc.y));
+ // } catch (error) {
+ // console.log('Error', error);
+ // }
+ // img.Loading = false;
+ // }
/**
* Calls the createCanvas and pushInfo methods to convert the
@@ -247,7 +248,7 @@ export namespace styleProviderQuiz {
function check(img: ImageBox) {
//this._loading = true;
imgQuizBoxes(img).forEach(async doc => {
- const input = StrCast(doc[DocData].title);
+ const input = StrCast(doc.$title);
if (imgQuizMode(img) == quizMode.SMART && input) {
const questionText = 'Question: What was labeled in this image?';
const rubricText = ' Rubric: ' + StrCast(doc.quiz);
@@ -274,8 +275,8 @@ export namespace styleProviderQuiz {
function redo(img: ImageBox) {
imgQuizBoxes(img).forEach(doc => {
- doc[DocData].title = '';
- doc.backgroundColor = '#e4e4e4';
+ doc.$title = '';
+ doc.$backgroundColor = '#e4e4e4';
});
}