aboutsummaryrefslogtreecommitdiff
path: root/src/ollama.tsx
diff options
context:
space:
mode:
authoromagdy7 <omar.professional8777@gmail.com>2023-11-23 19:30:32 +0200
committeromagdy7 <omar.professional8777@gmail.com>2023-11-23 19:30:32 +0200
commit9c50d78cc5c1d611edba988f65c58a1bbbfd5697 (patch)
tree4ec366f87fd82d73189a5cfda3984d13e709b58e /src/ollama.tsx
parent611881839990a284ea15c8465dc42f1326f8a98c (diff)
downloadollama-logseq-9c50d78cc5c1d611edba988f65c58a1bbbfd5697.tar.xz
ollama-logseq-9c50d78cc5c1d611edba988f65c58a1bbbfd5697.zip
Added a little delay between generating the flashcard question and flashcard answer
Diffstat (limited to 'src/ollama.tsx')
-rw-r--r--src/ollama.tsx3
1 files changed, 1 insertions, 2 deletions
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')