My template has added tool support: gpt, search, translation and customization, etc



The template .apkg file can be downloaded here: Releases · ikkz/anki-template · GitHub

The source code is available at: GitHub - ikkz/anki-template: Excellent Anki templates

If you like it, please give me a star, thank you so much! This repository is actively under development, and I’m planning to add more templates in the future, such as interactive templates. Your star is definitely my motivation to keep updating!

2 Likes

Really cool! I’ve been wanting to implement a chatGPT query in my cards in a way that’d work on mobile too, so I think I’ll examine your source and add this to my own javascript filled templates.

I noticed one bug. It seems something is wrong with how .nightMode is handled. The text in the tool menu is white and thus invisible in dark mode. I guess you forgot to change the tool menu background in dark mode?

1 Like

Fixed in the latest release Releases · ikkz/anki-template · GitHub

And thanks for pointing that out, I always forget to test in dark mode haha

This feature was added in feat(all): tool support for ChatGPT, search, translation and customiz… by ikkz · Pull Request #40 · ikkz/anki-template · GitHub . If you have any questions I’d be happy to help

1 Like

One other bug I’m seeing is on AnkiDroid. It seems not all the template settings’ saved values get communicated to the card in AnkiDroid:

  • I made tool menu changes on desktop and then synced. These were then applied on AnkiDroid.
  • However the other basic settings did not get transferred to AnkiDroid. Editing these or the tool menu settings on AnkiDroid also seems to only apply in the current review session. Reopening the review causes those settings to get reset.

Yes, someone has reported similar issues, probably due to different behavior of localStorage on ankidroid.

But I don’t have an Android device so I can’t fix it right now. I plan to find a way to test it with a virtual machine later.

Ah, you’re using localStorage to store stuff. How is that getting synced to other devices? I think the most reliable way would be to store the config as a json file in collection media. Except I don’t know if the JS in the card template is allowed to edit files in collection media.

1 Like

Yes, the current implementation does not sync between multiple devices.
And as far as I know, it is not possible to modify media files only through card templates.

related links

What version of ankidroid are you using? It seems that localStorage can be used normally after 2.18 according to fix: Use media directory as the base url of the CardViewers by BrayanDSO · Pull Request #16140 · ankidroid/Anki-Android · GitHub

My AnkiDroid is 2.20. So to clarify, the settings do persist between reviews but closing the reviewer loses all changes - localStorage doesn’t persistent outside of the reviewer.

This is because ankidroid fell back to displaying the reviewer on a random port in later verisons, so after restarting ankidroid, the previous localStorage could not be accessed due to the different port. I am testing cross-site storage through iframe and postMessage, but there are still uncertainties.

From my test, v2.16 works well

Fixed in the latest version Releases · ikkz/anki-template · GitHub

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.