crybot/obsidian-flashcards-llm

Multi-line flashcards are kind of broken

Opened this issue · 5 comments

Multi-line flashcards are kind of broken

In some cases the multiline flashcards put out as
decision-making\n?\nReactive
instead of

decision-making
?
Reactive

I wouldn't know how to reproduce it, as it's somewhat random. But this makes it nearly unusable.

@dhniceday It is indeed random. I've recently introduced streaming text generation that lets you see in real time the generation of flashcards. This forces the formatting of the cards to be done mostly by the language model itself (I do some stuff to wrap the generated text in a block quote, but not much else). So I only have limited control over the formatting and it sometimes does not work at all for multi-line flashcards.

I'm planning to do some post-processing on the cards as they are generated so that I can enforce some structure on them. Should be able to issue this asap.

I have added the following additional instructions: "Make sure to replace \n by real linebreaks.".
So far I have tested this 20 times (in streaming mode) and the LLM worked fine.

@dhniceday Thank you, I'll test your prompt out.

Unfortunately, I realized that "block-quoted" multi-line flashcards do not work with Spaced Repetition (inline cards work fine though).
I tried wrapping the flashcards in html but that breaks syntax highlighting and the rendering of equations. Codeblocks also do not work with Spaced Repetition.
I also tried using %%, but Spaced Repetition doesn't like that either. So I'm either implementing a custom syntax to define blocks of flashcards or I'm dropping the feature of hiding them in preview mode altogether (which I'd regret since it's quite useful to me).