piazzatron / anki-smart-notes

Superchange your anki flashcards with ✨AI✨
GNU General Public License v3.0
18 stars 4 forks source link

Prompt doesnt run when a field is empty (card template with varied amount of answers) #20

Closed wadid closed 4 months ago

wadid commented 4 months ago

Hi, I cannot run the prompts because sometimes some of my fields are empty. And it seems in that case the plugin doesnt run.

a prompt for exemplifying the issue:

Question: {{Question}}
These are the answer options (some of the answers at the end might be empty, if empty just ignore them):
A: {{option_1 (A)}}
B: {{option_2 (B)}}
C: {{option_3 (C)}}
D: {{option_4 (D)}}
E: {{option_5 (E)}}
F: {{option_6 (F)}}
G: {{option_7 (G)}}
H: {{option_8 (H)}}
Correct Answer: {{Ans}}
Explanation: {{explanation}}

Explain more detailed....

It seems if any of the fields e.g. {{option_8 (H)}} is empty then there is no way to execute the prompt. Thats an issue as some cards have variable amount of fields. For example I have hundreds of cards, some with 4 answers, some with 5 or 6. So no chance to run the prompt.

Any chance this might be able fixed rather quickly or can you tell me what files to look in the code to fix it myself?

piazzatron commented 4 months ago

Hey @wadid, thanks for flagging - there's another user with the same issue. I'll fix this today :)

piazzatron commented 4 months ago

Fixed this in v1.5.0, feel free to re-open if you have any issues

wadid commented 4 months ago

Thank you! Thats very cool! :)