Skip to content

Commit

Permalink
Added a little delay between generating the flashcard question and fl…
Browse files Browse the repository at this point in the history
…ashcard answer
  • Loading branch information
omagdy7 committed Nov 23, 2023
1 parent 6118818 commit 9c50d78
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions src/ollama.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down Expand Up @@ -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')
Expand Down

0 comments on commit 9c50d78

Please sign in to comment.