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
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:
parent
c595e0ff2c
commit
25bc03ea75
45 changed files with 663 additions and 329 deletions
|
|
@ -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>
|
||||
) : (
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@ import { cx, plural, timeAgo, useDebounced, useLocalStorage } from '@/lib/util';
|
|||
import { citedSources, GenUiContext, Markdown, type Citation } from '@/ui/Markdown';
|
||||
import { AskCard } from './AskCard';
|
||||
import { ToolSteps } from './ToolSteps';
|
||||
import { Badge, Button, Callout, IconButton, Input, Menu, MenuItem, MenuLabel, MenuSeparator, Popover, Spinner } from '@/ui';
|
||||
import { Badge, Button, Callout, IconButton, Input, Menu, MenuItem, MenuLabel, MenuSeparator, Popover, Spinner, Thinking } from '@/ui';
|
||||
|
||||
|
||||
/** Applies one streamed event to a message. Text after a tool step or a new model step starts a new paragraph. */
|
||||
|
|
@ -222,9 +222,7 @@ function AssistantMessage({ message, onNavigate, onAction, onSend, answerable =
|
|||
) : null,
|
||||
)}
|
||||
{thinking && (
|
||||
<div className="flex items-center gap-2 text-[13px] text-ink-3" role="status">
|
||||
<Spinner className="size-3.5" label="Thinking" /> {message.reasoning ? 'Thinking it through' : 'Thinking'}
|
||||
</div>
|
||||
<Thinking label={message.reasoning ? 'Thinking it through' : 'Thinking'} />
|
||||
)}
|
||||
{cited.length > 0 && (
|
||||
<div className="flex flex-wrap gap-1.5 pt-0.5">
|
||||
|
|
@ -659,7 +657,7 @@ export default function AssistantPanel({
|
|||
return ['Summarise the key points of this document', 'Make flashcards from this, focusing on medications and adverse effects', 'Write 15 NCLEX-style questions from this', 'What are the most testable concepts here?'];
|
||||
}
|
||||
if (className) {
|
||||
return [`Create a 20-question NCLEX-style quiz using the documents in ${className}`, 'Find the questions I frequently get wrong and create a new practice quiz covering those concepts', `What should I focus on in ${className} this week?`, 'Make a study guide from all the documents in this class'];
|
||||
return [`Create a 20-question NCLEX-style quiz using the class materials in ${className}`, 'Find the questions I frequently get wrong and create a new practice quiz covering those concepts', `What should I focus on in ${className} this week?`, 'Make a study guide from all the class materials in this class'];
|
||||
}
|
||||
return ['What should I study today?', 'Find the questions I frequently get wrong and create a new practice quiz covering those concepts', 'Explain the difference between left-sided and right-sided heart failure', 'Start a practice session with the questions I miss most'];
|
||||
}, [activeDocs.length, className]);
|
||||
|
|
@ -801,7 +799,7 @@ export default function AssistantPanel({
|
|||
) : messages.length === 0 ? (
|
||||
<div className="mx-auto flex h-full max-w-md flex-col justify-center pb-6">
|
||||
<h2 className="display text-[26px]">What are we working on?</h2>
|
||||
<p className="mt-1.5 text-sm text-ink-2">I can read your documents, look at your results, and prepare quizzes, flashcards and study guides for you to review. Use + (or type @, or drag items in) to point me at a specific quiz, deck, note or document.</p>
|
||||
<p className="mt-1.5 text-sm text-ink-2">I can read your class materials, look at your results, and prepare quizzes, flashcards and study guides for you to review. Use + (or type @, or drag items in) to point me at a specific quiz, deck, note or class material.</p>
|
||||
<div className="mt-5 space-y-2">
|
||||
{suggestions.map((s) => (
|
||||
<button key={s} type="button" onClick={() => send(s)} className="group flex w-full items-center gap-3 rounded-[13px] border border-line bg-surface px-3.5 py-2.5 text-left text-sm shadow-1 hover:border-ink-3">
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@ import { errorMessage, streamEvents } from '@/lib/api';
|
|||
import type { ToolActivity } from '@/lib/types';
|
||||
import { cx } from '@/lib/util';
|
||||
import { GenUiContext, Markdown } from '@/ui/Markdown';
|
||||
import { Button, Callout, IconButton, Spinner } from '@/ui';
|
||||
import { Button, Callout, IconButton, Thinking } from '@/ui';
|
||||
import { ToolSteps } from './ToolSteps';
|
||||
|
||||
type ExplainBody =
|
||||
|
|
@ -25,22 +25,32 @@ interface Turn {
|
|||
}
|
||||
|
||||
/**
|
||||
* Set by the quiz runner: on wide screens the explanation opens in the empty space to the right
|
||||
* of the question instead of below it.
|
||||
* Set by the quiz runner: on larger screens the explanation opens beside the question instead of
|
||||
* below it. When the free space right of the centred question is too narrow, the runner moves the
|
||||
* question left by `reserve` pixels while the explanation is open.
|
||||
*/
|
||||
export const ExplainSideContext = createContext(false);
|
||||
export const ExplainSideContext = createContext<{ reserve: (px: number) => void } | null>(null);
|
||||
|
||||
/** Width available beside a centred 48rem column, or 0 when there is not enough room. */
|
||||
function useSideRoom(enabled: boolean): number {
|
||||
const measure = () => (typeof window === 'undefined' ? 0 : Math.floor((window.innerWidth - 768) / 2 - 44));
|
||||
const [room, setRoom] = useState(measure);
|
||||
/** Below this width the explanation stays under the question. */
|
||||
const SIDE_MIN_VIEWPORT = 900;
|
||||
|
||||
/**
|
||||
* Where the explanation goes: `width` 0 means below the question. `shift` is how far the
|
||||
* question column must make room on the right (0 when the space beside it is already enough).
|
||||
*/
|
||||
function useSideLayout(enabled: boolean): { width: number; shift: number } {
|
||||
const [vw, setVw] = useState(() => (typeof window === 'undefined' ? 0 : window.innerWidth));
|
||||
useEffect(() => {
|
||||
if (!enabled) return;
|
||||
const onResize = () => setRoom(measure());
|
||||
const onResize = () => setVw(window.innerWidth);
|
||||
window.addEventListener('resize', onResize);
|
||||
return () => window.removeEventListener('resize', onResize);
|
||||
}, [enabled]);
|
||||
return enabled && room >= 300 ? Math.min(room, 520) : 0;
|
||||
if (!enabled || vw < SIDE_MIN_VIEWPORT) return { width: 0, shift: 0 };
|
||||
const room = Math.floor((vw - 768) / 2 - 44);
|
||||
if (room >= 300) return { width: Math.min(room, 520), shift: 0 };
|
||||
const width = Math.max(340, Math.min(480, Math.round(vw * 0.4)));
|
||||
return { width, shift: width + 36 };
|
||||
}
|
||||
|
||||
/** "Explain with AI": streams a short explanation and accepts follow-up questions. */
|
||||
|
|
@ -52,7 +62,14 @@ export function Explain({ body, label = 'Explain with AI', className, url = '/ap
|
|||
const [ask, setAsk] = useState('');
|
||||
const abort = useRef<AbortController | null>(null);
|
||||
const key = JSON.stringify(body);
|
||||
const sideWidth = useSideRoom(useContext(ExplainSideContext));
|
||||
const side = useContext(ExplainSideContext);
|
||||
const { width: sideWidth, shift } = useSideLayout(Boolean(side));
|
||||
// Smaller screens: push the question left while the explanation is open (back on close).
|
||||
useEffect(() => {
|
||||
if (!side || !open || !shift) return;
|
||||
side.reserve(shift);
|
||||
return () => side.reserve(0);
|
||||
}, [side, open, shift]);
|
||||
|
||||
useEffect(() => {
|
||||
// A different question: start over.
|
||||
|
|
@ -121,7 +138,7 @@ export function Explain({ body, label = 'Explain with AI', className, url = '/ap
|
|||
<div key={i} className="space-y-1.5">
|
||||
{t.ask && <div className="mb-1 text-[13px] font-medium text-ink-2">{t.ask}</div>}
|
||||
{t.tools.length > 0 && <ToolSteps tools={t.tools} compact />}
|
||||
{t.text ? <Markdown className="text-[14.5px]">{t.text}</Markdown> : busy && i === turns.length - 1 && !t.tools.some((x) => x.status === 'running') ? <Spinner className="size-4" label="Thinking" /> : null}
|
||||
{t.text ? <Markdown className="text-[14.5px]">{t.text}</Markdown> : busy && i === turns.length - 1 && !t.tools.some((x) => x.status === 'running') ? <Thinking /> : null}
|
||||
</div>
|
||||
))}
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -90,7 +90,8 @@ export function GenerateDialog({ open, onClose, classId, folderId, preset }: { o
|
|||
const applyTemplate = (id: string) => {
|
||||
setTemplateId(id);
|
||||
const t = templates.data?.find((x) => x.id === id);
|
||||
if (!t) return;
|
||||
// Custom: an ordinary practice set. Full practice exams come from the "Practice exam" preset.
|
||||
if (!t) return setFormat('practice');
|
||||
const p = t.payload;
|
||||
if (p.kind && !preset?.kind) setKind(p.kind);
|
||||
if (typeof p.count === 'number') setCount(p.count);
|
||||
|
|
@ -197,7 +198,7 @@ export function GenerateDialog({ open, onClose, classId, folderId, preset }: { o
|
|||
<div className="grid grid-cols-2 gap-2 sm:grid-cols-4">
|
||||
{(
|
||||
[
|
||||
{ v: 'documents', label: 'Documents', icon: <FileText />, hint: docs.length ? `${docs.length} ready` : 'None yet' },
|
||||
{ v: 'documents', label: 'Class Materials', icon: <FileText />, hint: docs.length ? `${docs.length} ready` : 'None yet' },
|
||||
{ v: 'text', label: 'Pasted notes', icon: <NotebookPen />, hint: 'Paste text' },
|
||||
{ v: 'topic', label: 'A topic', icon: <Sparkles />, hint: 'No source' },
|
||||
{ v: 'weak', label: 'Weak areas', icon: <Target />, hint: 'From results' },
|
||||
|
|
@ -243,7 +244,7 @@ export function GenerateDialog({ open, onClose, classId, folderId, preset }: { o
|
|||
{mode === 'text' && <Textarea className="mt-3" rows={6} value={text} onChange={(e) => setText(e.target.value)} placeholder="Paste lecture notes, a chapter summary, or anything you want turned into study material." aria-label="Pasted notes" />}
|
||||
{mode === 'weak' && (
|
||||
<Callout className="mt-3" icon={<Target />}>
|
||||
Uses the questions you have missed most in this class, plus matching passages from its documents, to write new {kind === 'deck' ? 'cards' : kind === 'note' ? 'review notes' : 'questions'} on the same concepts.
|
||||
Uses the questions you have missed most in this class, plus matching passages from its class materials, to write new {kind === 'deck' ? 'cards' : kind === 'note' ? 'review notes' : 'questions'} on the same concepts.
|
||||
</Callout>
|
||||
)}
|
||||
</div>
|
||||
|
|
@ -273,21 +274,6 @@ export function GenerateDialog({ open, onClose, classId, folderId, preset }: { o
|
|||
<Input type="number" min={1} max={100} value={count} onChange={(e) => setCount(Math.max(1, Math.min(100, Number(e.target.value) || 1)))} />
|
||||
</Field>
|
||||
)}
|
||||
<Field label="Set" hint={format === 'exam' ? 'Like a unit exam: 50 questions, up to 5 calculations when the material has them.' : 'All questions are NCLEX style.'}>
|
||||
<Segmented
|
||||
label="Set"
|
||||
value={format}
|
||||
onChange={(f) => {
|
||||
setFormat(f);
|
||||
setCount(f === 'exam' ? 50 : 15);
|
||||
}}
|
||||
options={[
|
||||
{ value: 'practice', label: 'Practice set' },
|
||||
{ value: 'exam', label: 'Practice exam' },
|
||||
]}
|
||||
className="w-full"
|
||||
/>
|
||||
</Field>
|
||||
<Field label="Difficulty">
|
||||
<Select value={difficulty} onChange={(e) => setDifficulty(e.target.value as typeof difficulty)}>
|
||||
<option value="mixed">Mixed</option>
|
||||
|
|
|
|||
|
|
@ -65,7 +65,7 @@ export function SemanticSettings({ providers }: { providers: Provider[] }) {
|
|||
setBusy('save');
|
||||
try {
|
||||
await api.put('/api/ai/embeddings', { providerId: providerId || null, model: providerId && !isLocal ? model.trim() : '', dimensions: dimensions && !isLocal ? Number(dimensions) : null });
|
||||
toast.success(providerId ? 'Semantic search is on. Indexing your documents…' : 'Semantic search is off');
|
||||
toast.success(providerId ? 'Semantic search is on. Indexing your class materials…' : 'Semantic search is off');
|
||||
await reload();
|
||||
} catch (e) {
|
||||
toast.error(errorMessage(e));
|
||||
|
|
@ -152,7 +152,7 @@ export function SemanticSettings({ providers }: { providers: Provider[] }) {
|
|||
)}
|
||||
{eligible.length === 0 && !isLocal && (
|
||||
<Callout tone="accent" icon={<Sparkles />} className="mt-3" title="Cloud embeddings need a provider">
|
||||
Use the built-in model, or connect OpenAI, Gemini, Ollama or an OpenAI-compatible server above. Anthropic and DeepSeek do not offer embeddings.
|
||||
Use the built-in model, or connect OpenAI, Gemini or an OpenAI-compatible server (Ollama included) above. Anthropic, DeepSeek and OpenRouter connections are not used for embeddings.
|
||||
</Callout>
|
||||
)}
|
||||
{(
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ import { errorMessage, streamEvents } from '@/lib/api';
|
|||
import type { ToolActivity } from '@/lib/types';
|
||||
import { cx } from '@/lib/util';
|
||||
import { GenUiContext, Markdown } from '@/ui/Markdown';
|
||||
import { Button, Callout, IconButton, Spinner, Tooltip } from '@/ui';
|
||||
import { Button, Callout, IconButton, Thinking, Tooltip } from '@/ui';
|
||||
import { ToolSteps } from './ToolSteps';
|
||||
|
||||
type Event = { type: 'text'; delta: string } | { type: 'tool'; tool: ToolActivity } | { type: 'error'; message: string } | { type: 'done' };
|
||||
|
|
@ -112,7 +112,7 @@ export function SharedAssistant({ token, title, item, hidden }: { token: string;
|
|||
{t.text ? (
|
||||
<Markdown className="text-[14px]">{t.text}</Markdown>
|
||||
) : busy && i === turns.length - 1 && !t.tools?.some((x) => x.status === 'running') ? (
|
||||
<Spinner className="size-4" label="Thinking" />
|
||||
<Thinking />
|
||||
) : null}
|
||||
</div>
|
||||
),
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
/**
|
||||
* Tool steps in a conversation: one quiet line per step with a status mark (spinner, check or
|
||||
* cross) and a friendly name ("Searched the web for: sepsis bundle"). Clicking a line opens its
|
||||
* Tool steps in a conversation: one quiet line per step with a status mark (a breathing icon
|
||||
* while it runs, then a check or cross) and a friendly name ("Searched the web for: sepsis bundle"). Clicking a line opens its
|
||||
* details: the pages it found, what it was asked and what it returned.
|
||||
*/
|
||||
import {
|
||||
|
|
@ -15,7 +15,6 @@ import {
|
|||
Globe,
|
||||
Library,
|
||||
ListChecks,
|
||||
LoaderCircle,
|
||||
PencilLine,
|
||||
Play,
|
||||
Plug,
|
||||
|
|
@ -55,7 +54,7 @@ const BUILTIN_ICON: Record<string, ReactNode> = {
|
|||
function iconFor(tool: ToolActivity): ReactNode {
|
||||
switch (tool.kind) {
|
||||
case 'web_search':
|
||||
return <Globe className={cx(tool.status === 'running' && 'tool-spin-slow')} />;
|
||||
return <Globe />;
|
||||
case 'web_fetch':
|
||||
return <FileText />;
|
||||
case 'web_research':
|
||||
|
|
@ -70,7 +69,8 @@ function iconFor(tool: ToolActivity): ReactNode {
|
|||
/** The line's text: what is happening while it runs, what happened once it is done. */
|
||||
export function toolTitle(tool: ToolActivity): ReactNode {
|
||||
const subject = tool.subject ? <span className="text-ink-2">{tool.subject}</span> : null;
|
||||
if (tool.status === 'running') return tool.label;
|
||||
// While running, the current stage ("Checking the questions with Python") replaces the label.
|
||||
if (tool.status === 'running') return tool.stage || tool.label;
|
||||
const failed = tool.status === 'error';
|
||||
switch (tool.kind) {
|
||||
case 'web_search':
|
||||
|
|
@ -130,11 +130,9 @@ function Details({ tool }: { tool: ToolActivity }) {
|
|||
|
||||
function Mark({ tool }: { tool: ToolActivity }) {
|
||||
return (
|
||||
<span className="relative grid size-[18px] shrink-0 place-items-center text-ink-3 [&>svg]:size-[15px]">
|
||||
<span className={cx('relative grid size-[18px] shrink-0 place-items-center [&>svg]:size-[15px]', tool.status === 'running' ? 'animate-pulse text-accent' : 'text-ink-3')}>
|
||||
{iconFor(tool)}
|
||||
{tool.status === 'running' ? (
|
||||
<LoaderCircle className="absolute -inset-[3px] !size-[24px] animate-spin text-accent/70" strokeWidth={1.5} />
|
||||
) : (
|
||||
{tool.status === 'running' ? null : (
|
||||
<span className={cx('tool-pop absolute -right-1 -bottom-1 grid size-[11px] place-items-center rounded-full ring-2 ring-paper', tool.status === 'error' ? 'bg-bad text-white' : 'bg-good text-white')}>
|
||||
{tool.status === 'error' ? <X className="!size-[8px]" strokeWidth={3.5} /> : <Check className="!size-[8px]" strokeWidth={3.5} />}
|
||||
</span>
|
||||
|
|
|
|||
|
|
@ -151,7 +151,7 @@ export function WebSearchSettings() {
|
|||
</fieldset>
|
||||
</div>
|
||||
<Callout tone="neutral" className="mt-3 text-[13px]">
|
||||
Only the search words and page addresses the AI writes are sent to Parallel, never your documents. You can switch web search off for a single conversation from the assistant's tools button.
|
||||
Only the search words and page addresses the AI writes are sent to Parallel, never your class materials. You can switch web search off for a single conversation from the assistant's tools button.
|
||||
</Callout>
|
||||
</Section>
|
||||
</>
|
||||
|
|
|
|||
|
|
@ -280,8 +280,8 @@ const SHARE_BLURB: Record<ShareKind, string> = {
|
|||
deck: 'Anyone with the link can study these flashcards. They cannot change them.',
|
||||
note: 'Anyone with the link can read this note.',
|
||||
document: 'Anyone with the link can view and download this file.',
|
||||
folder: 'Anyone with the link can study the quizzes, decks and notes in this exam (or folder) and read or download its documents.',
|
||||
class: 'Anyone with the link can study every quiz, deck and note in this class and view or download its documents.',
|
||||
folder: 'Anyone with the link can study the quizzes, decks and notes in this exam (or folder) and view or download its class materials.',
|
||||
class: 'Anyone with the link can study every quiz, deck and note in this class and view or download its class materials.',
|
||||
};
|
||||
|
||||
export function ShareDialog({ target, onClose }: { target: { kind: ShareKind; id: string; title: string } | null; onClose: () => void }) {
|
||||
|
|
|
|||
|
|
@ -214,6 +214,9 @@ export function QuizRunner(p: RunnerProps) {
|
|||
const confirm = useConfirm();
|
||||
const [elapsed, setElapsed] = useState(p.elapsedSec);
|
||||
const [navOpen, setNavOpen] = useState(false);
|
||||
// Room the Explain panel needs on the right on smaller screens (0 = question stays centred).
|
||||
const [explainReserve, setExplainReserve] = useState(0);
|
||||
const explainSide = useMemo(() => ({ reserve: setExplainReserve }), []);
|
||||
const topRef = useRef<HTMLDivElement>(null);
|
||||
const tick = useLatest(p.onTick);
|
||||
const finish = useLatest(p.onFinish);
|
||||
|
|
@ -367,7 +370,11 @@ export function QuizRunner(p: RunnerProps) {
|
|||
<ProgressBar value={answeredCount / total} tone="ink" className="h-[3px] rounded-none" label="Progress" />
|
||||
</header>
|
||||
|
||||
<main className="mx-auto w-full max-w-3xl flex-1 px-4 pt-6 pb-32 sm:px-5 sm:pt-9">
|
||||
<main
|
||||
className="mx-auto w-full max-w-3xl flex-1 px-4 pt-6 pb-32 transition-[transform,max-width] duration-300 ease-out motion-reduce:transition-none sm:px-5 sm:pt-9"
|
||||
// Explain open on a smaller screen: the question moves left and narrows to make room.
|
||||
style={explainReserve ? { maxWidth: Math.min(768, window.innerWidth - explainReserve - 40), transform: `translateX(-${explainReserve / 2}px)` } : undefined}
|
||||
>
|
||||
<div ref={topRef} className="scroll-mt-20" />
|
||||
<div key={question.id} className="animate-in">
|
||||
<div className="mb-3 flex flex-wrap items-center gap-2">
|
||||
|
|
@ -398,7 +405,7 @@ export function QuizRunner(p: RunnerProps) {
|
|||
<Markdown className="text-[15px]">{question.rationale}</Markdown>
|
||||
</div>
|
||||
)}
|
||||
<ExplainSideContext.Provider value>{p.renderExtra?.(question, answerTexts(question, selected))}</ExplainSideContext.Provider>
|
||||
<ExplainSideContext.Provider value={explainSide}>{p.renderExtra?.(question, answerTexts(question, selected))}</ExplainSideContext.Provider>
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue