feat(learn): an assistant proposes flashcards from a text, a note or a PDF page

The cards come as drafts (ADR 0021, D10, D55): one question with one
tool, propose_cards, the cards in a sheet, every one chosen at first,
each changed in a small sheet of its own or left out, and only those
chosen added, marked as an assistant's (origin "assistant"). They are
proposed from a text pasted in Add material, from a note's title and
text, and from a PDF's page or the text selected on it, tied to that page
(D56). A note or a page of a private studyset goes only once agreed to
(D9), the text pasted counting as the person's own; nothing is offered
without an assistant. PDFs give their pages' text (PdfDocumentView.pageText).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Tizian 「ティツィアーン」 <raisondetredev@pm.me>
This commit is contained in:
Tizian 「ティツィアーン」 2026-10-25 21:30:59 +01:00
commit cca10e855e
Signed by: raisondetredev
GPG key ID: 07F6FCF405488B64

View file

@ -22,6 +22,9 @@ class FakePdfEngine() implements PdfEngine {
/// Whether the next PDF opened can't be read.
bool failNext = false;
/// The pages' text, by page; a page not named reads "The text of page N."
final texts = <int, String>{};
/// Selects [text] in the viewer showing.
void select(String text) =>
viewers.last.controller.report(selectedText: text);
@ -62,6 +65,10 @@ class _FakeDocument(
return _engine.image;
}
@override
Future<String> pageText(int page) async =>
_engine.texts[page] ?? 'The text of page $page.';
final _viewers = <PdfReaderController, FakePdfViewer>{};
@override