Address first round of feedback
- Flashcards: whole card flips on click (both sides), 3D turn, swipe-away on grading, streak chip and flame bursts, bigger cards on desktop, arrow keys for everything - Review and browse keep the sidebar on desktop - Quizzes: live practice score, partial-credit explanation, time limit for shared exams - Class page: items grouped by type inside each folder - Import: copyable, editable instructions for outside chatbots - Assistant: reads notes and links to library items Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
This commit is contained in:
parent
c59591ccb9
commit
aed14cd04f
13 changed files with 769 additions and 216 deletions
|
|
@ -5,9 +5,9 @@ import { Hono } from 'hono';
|
|||
import { bodyLimit } from 'hono/body-limit';
|
||||
import { z } from 'zod';
|
||||
import { questionToDraft, validateDraft, type ContentDraft } from '../../shared/content.ts';
|
||||
import { draftsFromValue } from '../../shared/importer.ts';
|
||||
import { draftsFromValue, LLM_INSTRUCTIONS } from '../../shared/importer.ts';
|
||||
import { badRequest, HttpError, idParam, readBody, type AppContext } from '../http.ts';
|
||||
import { appSettingsSchema, getAppSettings, setSetting } from '../settings.ts';
|
||||
import { appSettingsSchema, deleteSetting, getAppSettings, getSetting, setSetting } from '../settings.ts';
|
||||
import { createSnapshot, exportBundle, fullBackupStream, listBackups } from '../services/backup.ts';
|
||||
import { createClass, createDeck, createFolder, createNote, createQuiz, draftCardToInput, draftQuestionToInput, getClass, getDeck, getQuiz, listCards, listQuestions } from '../services/content.ts';
|
||||
import { createTemplate, deleteTemplate, listTemplates, templateInputSchema, updateTemplate } from '../services/templates.ts';
|
||||
|
|
@ -85,6 +85,24 @@ export function dataRoutes(app: AppContext): Hono {
|
|||
return c.json({ settings: next });
|
||||
});
|
||||
|
||||
/* ------------------------------ instructions for outside chatbots ------------------------------ */
|
||||
|
||||
r.get('/llm-instructions', (c) =>
|
||||
c.json({
|
||||
quiz: getSetting<string | null>(db, 'llm.quiz', null) ?? LLM_INSTRUCTIONS.quiz,
|
||||
deck: getSetting<string | null>(db, 'llm.deck', null) ?? LLM_INSTRUCTIONS.deck,
|
||||
customized: { quiz: getSetting<string | null>(db, 'llm.quiz', null) !== null, deck: getSetting<string | null>(db, 'llm.deck', null) !== null },
|
||||
}),
|
||||
);
|
||||
|
||||
/** Saves an edited copy; `text: null` goes back to the built-in wording. */
|
||||
r.put('/llm-instructions', async (c) => {
|
||||
const body = await readBody(c, z.object({ kind: z.enum(['quiz', 'deck']), text: z.string().trim().min(20).max(20000).nullable() }));
|
||||
if (body.text === null) deleteSetting(db, `llm.${body.kind}`);
|
||||
else setSetting(db, `llm.${body.kind}`, body.text);
|
||||
return c.json({ ok: true });
|
||||
});
|
||||
|
||||
/* ------------------------------ import ------------------------------ */
|
||||
|
||||
r.post('/import', bodyLimit({ maxSize: 30 * 1024 * 1024 }), async (c) => {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue