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

@ -21,8 +21,8 @@ const KIND_BLURB: Record<ProviderKind, string> = {
anthropic: 'Claude models with an Anthropic API key.',
gemini: 'Gemini models with a Google AI Studio key.',
deepseek: 'DeepSeek Flash and Pro with a DeepSeek platform key.',
openai_compatible: 'OpenRouter, Groq, Together, LM Studio, vLLM and other compatible servers.',
ollama: 'Models running on your own machine or server.',
openrouter: 'Hundreds of models from many labs with one OpenRouter key.',
openai_compatible: 'Ollama, LM Studio, vLLM, Groq, Together and other servers with an OpenAI-style API.',
};
function useAiData() {
@ -60,7 +60,7 @@ function ProviderDialog({ open, onClose, adapters, existing, onSaved }: { open:
const a = adapters.find((x) => x.kind === k)!;
setKind(k);
setName(k === 'openai_compatible' ? '' : a.label);
setBaseUrl(k === 'ollama' ? (a.defaultBaseUrl ?? '') : '');
setBaseUrl('');
};
const save = async () => {
@ -120,7 +120,7 @@ function ProviderDialog({ open, onClose, adapters, existing, onSaved }: { open:
<div className="grid gap-2">
{adapters.map((a) => (
<button key={a.kind} type="button" onClick={() => pick(a.kind)} className="flex items-center gap-3 rounded-xl border border-line-strong p-3.5 text-left hover:border-ink-3 hover:bg-ink/3">
<span className="grid size-10 shrink-0 place-items-center rounded-[11px] bg-sunken text-ink-2">{a.kind === 'ollama' || a.kind === 'openai_compatible' ? <Server className="size-[18px]" /> : <Brain className="size-[18px]" />}</span>
<span className="grid size-10 shrink-0 place-items-center rounded-[11px] bg-sunken text-ink-2">{a.kind === 'openai_compatible' ? <Server className="size-[18px]" /> : <Brain className="size-[18px]" />}</span>
<span className="min-w-0 flex-1">
<span className="block font-semibold">{a.label}</span>
<span className="block text-[13px] text-ink-2">{KIND_BLURB[a.kind]}</span>
@ -138,10 +138,10 @@ function ProviderDialog({ open, onClose, adapters, existing, onSaved }: { open:
}}
>
<Field label="Name" hint="Shown in model pickers. Useful when you connect the same service with two keys.">
<Input value={name} onChange={(e) => setName(e.target.value)} placeholder={adapter.kind === 'openai_compatible' ? 'OpenRouter' : adapter.label} maxLength={80} />
<Input value={name} onChange={(e) => setName(e.target.value)} placeholder={adapter.kind === 'openai_compatible' ? 'Ollama' : adapter.label} maxLength={80} />
</Field>
{(needsUrl || adapter.kind === 'ollama') && (
<Field label="Server URL" hint={adapter.kind === 'ollama' ? 'From inside Docker, "localhost" is the container. Use your server address, for example http://192.168.1.10:11434.' : 'The API root, for example https://openrouter.ai/api/v1 or http://192.168.1.10:1234/v1.'}>
{needsUrl && (
<Field label="Server URL" hint='The API root, for example http://192.168.1.10:11434/v1 for Ollama or http://192.168.1.10:1234/v1 for LM Studio. From inside Docker, "localhost" is the container itself.'>
<Input value={baseUrl} onChange={(e) => setBaseUrl(e.target.value)} placeholder={adapter.defaultBaseUrl ?? 'https://…/v1'} inputMode="url" spellCheck={false} className="num text-[13px]" />
</Field>
)}
@ -164,7 +164,7 @@ function ProviderDialog({ open, onClose, adapters, existing, onSaved }: { open:
<details className="rounded-xl border border-line">
<summary className="px-3.5 py-2.5 text-sm font-medium text-ink-2 hover:text-ink">Advanced</summary>
<div className="space-y-4 border-t border-line p-3.5">
{!needsUrl && adapter.kind !== 'ollama' && (
{!needsUrl && (
<Field label="Custom endpoint" optional hint="Only for proxies and gateways. Leave blank for the official API.">
<Input value={baseUrl} onChange={(e) => setBaseUrl(e.target.value)} placeholder={adapter.defaultBaseUrl ?? ''} spellCheck={false} className="num text-[13px]" />
</Field>
@ -190,8 +190,8 @@ const CACHE_HINT: Record<ProviderKind, string> = {
anthropic: "Claude's cache-read rate (10% of input)",
gemini: "Gemini's cache rate (10% of input)",
deepseek: "DeepSeek's cache-hit rate",
openrouter: 'the normal input price unless OpenRouter lists a cache price',
openai_compatible: 'the normal input price',
ollama: 'the normal input price',
};
function cachedGuess(model: AiModel): string {
@ -357,7 +357,7 @@ function ProviderCard({ provider, models, adapter, onEdit, reload }: { provider:
return (
<div className={cx('card overflow-hidden', !provider.enabled && 'opacity-70')}>
<div className="flex flex-wrap items-center gap-3 px-4 py-3.5">
<span className="grid size-10 shrink-0 place-items-center rounded-[11px] bg-sunken text-ink-2">{provider.kind === 'ollama' || provider.kind === 'openai_compatible' ? <Server className="size-[18px]" /> : <Brain className="size-[18px]" />}</span>
<span className="grid size-10 shrink-0 place-items-center rounded-[11px] bg-sunken text-ink-2">{provider.kind === 'openai_compatible' ? <Server className="size-[18px]" /> : <Brain className="size-[18px]" />}</span>
<div className="min-w-0 flex-1 basis-40">
<div className="flex flex-wrap items-center gap-2">
<span className="font-semibold">{provider.name}</span>
@ -711,7 +711,7 @@ export default function AiSettings() {
</Button>
}
>
Study Desk works without AI. Connecting a model adds question and flashcard generation from your documents, explanations, and the assistant. You can connect several providers and use different models for different jobs.
Study Desk works without AI. Connecting a model adds question and flashcard generation from your class materials, explanations, and the assistant. You can connect several providers and use different models for different jobs.
</EmptyState>
</div>
) : (