47 lines
3 KiB
Markdown
47 lines
3 KiB
Markdown
|
|
# KI: Claude schlägt vor, der Nutzer entscheidet
|
||
|
|
|
||
|
|
Since 2026-10-24. Organisation help with Claude (Anthropic) across diora: books and magazines
|
||
|
|
first; podcasts, news/blogs and projects follow (same building blocks).
|
||
|
|
|
||
|
|
## The key: the user's own, end-to-end encrypted, only on the devices
|
||
|
|
|
||
|
|
Decided with the user: the Anthropic API key is entered in the app ("KI-Assistent", the ✦ of a
|
||
|
|
feature or the app menu) and stored like the books — encrypted with the book key on the device,
|
||
|
|
kept by the server as a blob it can't read:
|
||
|
|
|
||
|
|
- `GET/POST /accounts/vault/<name>/` (`accounts.UserVault`, name `ai`): `{ct, iv}`; `{ct: ''}`
|
||
|
|
removes it. Its own store, not the library prefs (`/books/prefs/` is rewritten whole when
|
||
|
|
the folder order is saved).
|
||
|
|
- The devices decrypt it into memory only and call Claude **directly** from the page
|
||
|
|
(browser, the apps' WebView, the desktop). The diora server sees neither the key nor what is
|
||
|
|
sent; Anthropic sees what a feature needs (titles, authors, folder names …). Anthropic bills
|
||
|
|
the user.
|
||
|
|
- Without the book key on a device (or after a password change, which changes the book key)
|
||
|
|
the key can't be read: the settings ask for it again. Not on diora Reader (e-readers).
|
||
|
|
- Server-side jobs (in the background, without an app open) were left out on purpose: they
|
||
|
|
would need the key on the server. The project Radar has its own server key (docs/projects.md).
|
||
|
|
|
||
|
|
## Building blocks (`static/js/ai.js`, an ES module)
|
||
|
|
|
||
|
|
- The official SDK, `@anthropic-ai/sdk` 0.133.0, bundled for the browser with esbuild 0.28.2:
|
||
|
|
`static/vendor/anthropic-sdk-0.133.0.mjs` (licence beside it). `dangerouslyAllowBrowser`:
|
||
|
|
the key is the user's own. To update: `npm install @anthropic-ai/sdk@<v> esbuild` in an empty
|
||
|
|
folder, `esbuild entry.mjs --bundle --format=esm --platform=browser --target=es2020 --minify`
|
||
|
|
with `export { default } from '@anthropic-ai/sdk'`, and change the import in ai.js.
|
||
|
|
- `DioraAI.ask({system, prompt, schema, effort})`: model `claude-opus-5-5`, structured output
|
||
|
|
(`output_config.format` json_schema), effort `low` by default, streamed, `fallbacks: "default"`
|
||
|
|
(beta `server-side-fallback-2026-07-01`) for declined requests; refusals and over-long
|
||
|
|
answers become plain German messages.
|
||
|
|
- `DioraAI.review({title, intro, items, onApply})`: the suggestions with checkboxes — nothing
|
||
|
|
changes until the user ticks and presses "Übernehmen".
|
||
|
|
- `DioraAI.settings()`, `withKey(fn)`, `progress()`, `showError()`, `toast()`; the sheets close
|
||
|
|
with Android's back key; ⚙ in each sheet opens the settings.
|
||
|
|
|
||
|
|
## Features
|
||
|
|
|
||
|
|
| area | where | what Claude gets | what it suggests |
|
||
|
|
|---|---|---|---|
|
||
|
|
| Bücher, Zeitschriften | ✦ in the library's head (`static/js/app/55-library-tools.js`) | per book: id, title, author, folders, series, magazine mark; the existing folders | folders to add (existing first; new ones only for ≥ 3 books), series with volume, cleaned title/author where broken, magazine mark |
|
||
|
|
|
||
|
|
Applied through `_updateBookMeta` (the encrypted meta, as when editing by hand).
|