From 9c50d78cc5c1d611edba988f65c58a1bbbfd5697 Mon Sep 17 00:00:00 2001
From: omagdy7 <omar.professional8777@gmail.com>
Date: Thu, 23 Nov 2023 19:30:32 +0200
Subject: Added a little delay between generating the flashcard question and
 flashcard answer

---
 src/ollama.tsx | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

(limited to 'src/ollama.tsx')

diff --git a/src/ollama.tsx b/src/ollama.tsx
index df6a568..eac27fb 100644
--- a/src/ollama.tsx
+++ b/src/ollama.tsx
@@ -103,8 +103,6 @@ export async function defineWord(word: string) {
 
 
 export async function askWithContext(prompt: string) {
-  await delay(300)
-
   try {
     const currentBlocksTree = await logseq.Editor.getCurrentPageBlocksTree()
     const currentBlock = currentBlocksTree[0]
@@ -225,6 +223,7 @@ export async function convertToFlashCard(uuid: string, blockContent: string) {
     const question = await promptLLM(`Create a question about this that would fit in a flashcard :\n ${blockContent}`)
     const answer = await promptLLM(`Given the question ${question} and the context of ${blockContent} What is the answer? be as brief as possible and provide the answer only.`)
     await logseq.Editor.updateBlock(questionBlock.uuid, `${question} #card`)
+    await delay(300)
     await logseq.Editor.updateBlock(answerBlock.uuid, answer)
   } catch (e: any) {
     logseq.App.showMsg(e.toString(), 'warning')
-- 
cgit v1.2.3

