Fourth revision: OpenRouter, live tool stages, Explain layout, share sections
All checks were successful
Verify and publish V2 container / build-and-push (push) Successful in 29s

- Interactive blocks are encouraged by default; Explain gets a reduced library
  and never writes practice questions.
- Assistant tool steps breathe while running, show live stages from generation
  and the Python check, and read in the past tense when done.
- The assistant asks before searching the web when class materials do not
  cover a question; clarifying questions list every class's exams and never
  ask about format (always NCLEX).
- Explain opens beside the question from 900px wide, moving the question left
  while open and back on the next one.
- Generate dialog drops the practice set/exam switch (presets cover it) and the
  Generate buttons lose their icon.
- Python check notes are green when every check passed, applied fixes neutral.
- Share pages group by exam, then Quizzes, Flashcards, Notes, Class Materials,
  hiding empty groups; the class page uses the same order. "Documents" is now
  "Class Materials".
- OpenRouter provider replaces the Ollama type; migration 6 turns Ollama
  connections into OpenAI-compatible ones at /v1.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Elijah 2026-11-15 21:54:39 -07:00
parent c595e0ff2c
commit 25bc03ea75
45 changed files with 663 additions and 329 deletions

View file

@ -5,8 +5,16 @@ discover models where supported (or add a custom model), enable models and selec
for generation, chat, explanations and vision. Output limits, capabilities, pricing and
reasoning settings can be edited per model. Catalog prices are estimates, not billing records.
Adapters use OpenAI Responses, Anthropic Messages, Gemini generateContent, DeepSeek and
OpenAI-compatible Chat Completions, and Ollama's native chat API.
Adapters use OpenAI Responses, Anthropic Messages, Gemini generateContent, and Chat
Completions for DeepSeek, OpenRouter and OpenAI-compatible servers. Ollama is connected as an
OpenAI-compatible server at `http://<host>:11434/v1` (migration 6 moved existing Ollama
connections there).
OpenRouter (`https://openrouter.ai/api/v1`) needs a key; its test calls `/key`, so a bad key
fails even though the model list is public. Discovery reads each model's context length,
output limit, prices (with cache reads), tool and reasoning support and image input from
`/models`. Reasoning effort is sent as `reasoning: { effort }`, and requests carry
`X-Title: Study Desk`.
Reasoning effort has seven levels (Off, Minimal, Low, Medium, High, Extra high, Max); each
adapter maps them onto the nearest value its API accepts. DeepSeek accepts low / high / max
@ -42,8 +50,9 @@ warning on the document. At most 600 pages are read per file.
## Semantic search
Settings → AI → Semantic search chooses an embeddings provider and model (suggested:
OpenAI `text-embedding-3-small`, Gemini `gemini-embedding-001`, Ollama `nomic-embed-text`;
Anthropic and DeepSeek have no embeddings API). Until something else is chosen, the built-in
OpenAI `text-embedding-3-small`, Gemini `gemini-embedding-001`, or e.g. `nomic-embed-text` on
Ollama through an OpenAI-compatible connection; Anthropic, DeepSeek and OpenRouter connections
are not used for embeddings). Until something else is chosen, the built-in
model is used: BAAI bge-small-en-v1.5 (8-bit ONNX, 384 dimensions) running on the server's CPU
through transformers.js. The Docker image ships the model in `/app/models` (`LOCAL_MODELS_DIR`),
so it works without internet access; outside Docker it is downloaded once (about 35 MB) from
@ -135,7 +144,10 @@ with its own instructions and area switches like any server.
Every tool call shows as one line: an icon for the kind of tool, a friendly name ("Searched
the web for: …", "Read pubmed.ncbi.nlm.nih.gov", "Drug reference: Lookup drug") and a
spinner, check or cross. Clicking it shows the pages found, the request and a clipped result.
check or cross. While a step runs its icon breathes, and long steps report their stage
(generation and Python checking send "Reading your material", "Writing questions 1-8 of 15",
"Checking the questions with Python" and so on through `ToolActivity.stage`). Finished steps
read in the past tense ("Wrote 15 quiz questions"). Clicking it shows the pages found, the request and a clipped result.
More than three finished steps fold into "N steps". The model is told never to mention tool
names or internal ids. In a chat, the sliders button left of + turns individual servers (and
web search) off for that conversation; the choice is saved with it.
@ -147,7 +159,13 @@ choices, text or a number, with defaults) and ends the turn. The answers are sen
user's next message, and the stored tool result travels with that message, so the model sees
question and answer together. The prompt tells the model to ask before generating when the
exam, materials or count are missing and not clear from the page in view, to ask at most once
per request, and to use defaults when the user says to go ahead.
per request, and to use defaults when the user says to go ahead. Every class is listed in the
prompt with its exams, so the exam question can offer them by name; the model is told never to
ask about question format (quizzes are always NCLEX style).
When web search is on in a chat and the class materials do not answer a question, the
assistant asks whether to search the web ("Search the web" / "Answer from general knowledge")
instead of answering from its own knowledge. It searches straight away only when asked to.
## Exams within a class
@ -167,7 +185,10 @@ in OpenUI Lang inside ```` ```openui-lang ```` fences, rendered with `@openuidev
against the app's own component library (`shared/genui.ts` lists it; `web/src/genui/` renders
it): layout, callouts, stats, tables, steps, bar/line/pie charts with a table view, sliders and
inputs bound to variables, practice questions, flashcards and follow-up buttons that send a
message. Library telemetry is off (`OPENUI_TELEMETRY_DISABLED=1`, `DO_NOT_TRACK=1`).
message. The prompt lists the reply shapes that should become a block (comparisons, sequences,
calculations, safety points, a self-check after teaching), so blocks appear without being asked
for. Explain uses a reduced library without Question and Flashcards and is told to give
information only (`genUiPrompt('explain')`). Library telemetry is off (`OPENUI_TELEMETRY_DISABLED=1`, `DO_NOT_TRACK=1`).
## AI on share links