diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/client/views/nodes/chatbot/chatboxcomponents/ChatBox.tsx | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/src/client/views/nodes/chatbot/chatboxcomponents/ChatBox.tsx b/src/client/views/nodes/chatbot/chatboxcomponents/ChatBox.tsx index 594736fbc..7859eae01 100644 --- a/src/client/views/nodes/chatbot/chatboxcomponents/ChatBox.tsx +++ b/src/client/views/nodes/chatbot/chatboxcomponents/ChatBox.tsx @@ -506,6 +506,7 @@ export class ChatBox extends ViewBoxAnnotatableComponent<FieldViewProps>() { break; } case 'web': + options.data_useCors = true; doc = DocCast(Docs.Create.WebDocument(data, options)); break; case 'comparison': @@ -579,10 +580,14 @@ export class ChatBox extends ViewBoxAnnotatableComponent<FieldViewProps>() { const flashcardArray = Array.isArray(deckData) ? deckData : Object.values(deckData); console.log(typeof flashcardArray); // Process each flashcard document in the `deckData` array - flashcardArray.forEach(doc => { - const flashcardDoc = this.createFlashcard(doc, options); - if (flashcardDoc) flashcardDeck.push(flashcardDoc); - }); + if (flashcardArray.length == 2 && flashcardArray[0].doc_type == 'text' && flashcardArray[1].doc_type == 'text') { + this.createFlashcard(flashcardArray, options); + } else { + flashcardArray.forEach(doc => { + const flashcardDoc = this.createFlashcard(doc, options); + if (flashcardDoc) flashcardDeck.push(flashcardDoc); + }); + } // Create a carousel to contain the flashcard deck const carouselDoc = DocCast( @@ -603,6 +608,7 @@ export class ChatBox extends ViewBoxAnnotatableComponent<FieldViewProps>() { // Process each flashcard item in the data array // const p = JSON.parse(data); + const deckData = typeof data === 'string' ? JSON.parse(data) : data; const flashcardArray = Array.isArray(deckData) ? deckData : Object.values(deckData)[2]; console.log(typeof flashcardArray); |