Fifth revision: share-link AI safety, sturdier generation, cleaner UI
All checks were successful
Verify and publish V2 container / build-and-push (push) Successful in 1m0s
All checks were successful
Verify and publish V2 container / build-and-push (push) Successful in 1m0s
- Malformed model JSON is sent back for repair, then retried; a failed job starts over once before it fails. Visitors can dismiss failed sets. - Generated sets get a short distinct name and description; flashcards are atomic and have no hints; standard study shows known/learning counts. - Share links: "In progress" list, finished sets join the normal lists with a "New" tag, plain progress steps, newest exam first. - Share-link AI expires after a week, can be limited to the US or Arizona (DB-IP Lite or Cloudflare headers) and is locked by abuse protection (migration 8). - The assistant never answers from general knowledge; MCP and web search tools load without a manual test. - Plain-text copy, no question count in exam mode, filler text removed. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
d8df5edf30
commit
85d5c9186d
46 changed files with 1242 additions and 283 deletions
|
|
@ -54,6 +54,7 @@ async function sse(url: string, body: unknown): Promise<any[]> {
|
|||
const isCheck = (r: { body: any }) => (r.body?.tools ?? []).some((t: any) => t.function?.name === 'submit_review');
|
||||
/** The quick call that groups topic labels after a quiz is written. */
|
||||
const isGrouping = (r: { body: any }) => (r.body?.tools ?? []).some((t: any) => t.function?.name === 'submit_topics');
|
||||
const isNaming = (r: { body: any }) => r.body?.tool_choice?.function?.name === 'name_set';
|
||||
|
||||
async function waitForDraft(id: string) {
|
||||
for (let i = 0; i < 200; i += 1) {
|
||||
|
|
@ -201,7 +202,7 @@ describe('generation', () => {
|
|||
expect(draft.payload.questions[0].source).toMatch(/Heart failure lecture/);
|
||||
// 12 questions at 8 per batch means two model calls, each carrying the source excerpts.
|
||||
const all = mock.requests.filter((r) => r.path.endsWith('/chat/completions'));
|
||||
const calls = all.filter((r) => !isCheck(r) && !isGrouping(r));
|
||||
const calls = all.filter((r) => !isCheck(r) && !isGrouping(r) && !isNaming(r));
|
||||
expect(all.filter(isGrouping)).toHaveLength(1);
|
||||
expect(calls).toHaveLength(2);
|
||||
// Then the Python check: one run, a review, and its fix applied to question 2.
|
||||
|
|
@ -251,7 +252,7 @@ describe('generation', () => {
|
|||
// Deck -> quiz conversion uses the cards as the source.
|
||||
const converted = await waitForDraft((await t.api('POST', '/api/ai/generate', { kind: 'quiz', classId: cls.id, source: { deckId } })).body.draftId);
|
||||
expect(converted.status).toBe('ready');
|
||||
expect(JSON.stringify(mock.requests.filter((r) => r.path.endsWith('/chat/completions') && !isCheck(r) && !isGrouping(r)).at(-1)!.body.messages)).toMatch(/Flashcards from the deck/);
|
||||
expect(JSON.stringify(mock.requests.filter((r) => r.path.endsWith('/chat/completions') && !isCheck(r) && !isGrouping(r) && !isNaming(r)).at(-1)!.body.messages)).toMatch(/Flashcards from the deck/);
|
||||
|
||||
// Append more cards to the existing deck.
|
||||
const more = await waitForDraft((await t.api('POST', '/api/ai/generate', { kind: 'deck', classId: cls.id, focus: 'beta blockers', count: 4 })).body.draftId);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue