42 lines
1.6 KiB
Markdown
42 lines
1.6 KiB
Markdown
That python script should help users take a block of text / vocab list / whatever in any format from a book, website or such, input it, parse and understand it with an llm, create flashcards from source langauge (dropdown) to target language, and allows adding these with ankiconnect.
|
|
The script should have an UI for the following:
|
|
|
|
- Have a dropdown for source and a dropdown for target language
|
|
- have a settings window for choosing the model and provider (litellm) and adding API keys. Stored locally, shared prefs or something? Or local folders?
|
|
- Have an input window for inputting text
|
|
- Create Anki flashcards from the text (by making the model output yaml in this format:
|
|
|
|
```yaml
|
|
name: <stack name>
|
|
description: <short description of what the cards are about>
|
|
cards:
|
|
- front: back
|
|
- front2: back2
|
|
- the suspects: der/die verdächtige -n
|
|
- ...
|
|
```
|
|
|
|
The UI should then show these flashcards in a datatable one by one, allow changing, modifying, and / or deleting / adding flashcards. Once that's done, there should be an "add to anki" button that adds the cards to a deck of the user's choice using a local instance of Anki running AnkiConnect. Also export as yaml, and csv
|
|
|
|
## Tooling
|
|
I always use uv to install stuff, not pip
|
|
|
|
use `uv add <package>` to install instead of `pip install <package>`.
|
|
use `uv run <command>` to run commands, e.g. `uv run python hello.py`.
|
|
|
|
|
|
## Coding
|
|
|
|
For dialogs and snackbars, do the following:
|
|
|
|
```python
|
|
dialog = < create dialog >
|
|
|
|
# to show
|
|
page.open(dialog)
|
|
|
|
# to close
|
|
page.close(dialog)
|
|
```
|
|
|
|
Do NOT use `page.show_snack_bar or page.dialog = ...` as those don't exist in recent Flet versions anymore. |