diff --git a/public/components/my-resources.html b/public/components/my-resources.html index 9b60a862..6b77736b 100644 --- a/public/components/my-resources.html +++ b/public/components/my-resources.html @@ -23,7 +23,7 @@ Slides - + Words diff --git a/src/routes/myResources.js b/src/routes/myResources.js index 8f6a5823..55e0184d 100644 --- a/src/routes/myResources.js +++ b/src/routes/myResources.js @@ -366,7 +366,7 @@ async function generateResource(userId, body) { wantsImages: wantsImages, deckMode: deckMode, format: deckMode ? deckFormats.formatId(body.format) : '', figureCount: wantsImages ? (resourceImages.requestedCount(refinement) || 0) : 0, - slideCount: clampInt(body.slideCount, 3, 30, 8), + slideCount: clampInt(body.slideCount, 3, 60, 8), wordCount: clampInt(body.wordCount, 200, 3000, 800) }); @@ -487,7 +487,7 @@ async function generateResource(userId, body) { literature: sources.literature, webFindings: sources.webFindings, searchedAndFoundNothing: sources.searchedAndFoundNothing, wantsImages: false, deckMode: false, - slideCount: clampInt(body.slideCount, 3, 30, 8), + slideCount: clampInt(body.slideCount, 3, 60, 8), wordCount: clampInt(body.wordCount, 200, 3000, 800) }); ai = await callAI([{ role: 'user', content: plain }], options); diff --git a/src/utils/deckReview.js b/src/utils/deckReview.js index c3f7124f..5731171c 100644 --- a/src/utils/deckReview.js +++ b/src/utils/deckReview.js @@ -23,7 +23,7 @@ var os = require('os'); var pathMod = require('path'); var { execFile } = require('child_process'); -var MAX_SLIDES = 20; // a review pass is one image per slide +var MAX_SLIDES = 60; // a review pass is one image per slide var RENDER_DPI = 70; // legible to a model, small enough to send var CONVERT_TIMEOUT = 60000; // The reply restates the whole deck, so it needs room for one. diff --git a/test/deck-review.test.js b/test/deck-review.test.js index 854e6eed..21a60f58 100644 --- a/test/deck-review.test.js +++ b/test/deck-review.test.js @@ -137,6 +137,28 @@ test('nothing about the review can fail a generation', async () => { assert.match(long.reason, /too long/); }); +test('the three caps agree, so a deck that can be generated can also be reviewed and modified', async () => { + // 20 used to be the review ceiling while the form allowed 30: a 21-30 slide + // deck was generated, stored and then silently never reviewed, and a + // modification above 20 was shown only the first 20 pages while the prompt + // claimed one image per slide. All three numbers are the schema's own limit + // now, which is what stops a deck falling between them. + assert.equal(review.MAX_SLIDES, 60, 'the review ceiling'); + + const route = read('src/routes/myResources.js'); + assert.equal((route.match(/clampInt\(body\.slideCount, 3, 60, 8\)/g) || []).length, 2, 'both generation paths'); + assert.match(read('public/components/my-resources.html'), /id="mr-slide-count"[^>]*max="60"/, 'the form'); + assert.match(read('src/utils/deckSchema.js'), /slice\(0, 60\)/, 'and what the schema will store'); + + // The gate really moved: 60 slides is no longer "too long", 61 still is. + const sixty = await review.review({ slides: new Array(60).fill({ type: 'bullets', heading: 'x', bullets: [{ text: 'y' }] }) }, + { model: 'some-model', gotenberg: 'http://127.0.0.1:1', mime: 'application/x', pptx: Buffer.from(''), extractJson: () => null }); + assert.notEqual(sixty.reason, 'deck too long to review', '60 slides is reviewed, not skipped'); + assert.equal(sixty.reviewed, false, 'the renderer failed on the test\u2019s bad url, which is the point: it got that far'); + const sixtyOne = await review.review({ slides: new Array(61).fill({ type: 'bullets', heading: 'x' }) }, { model: 'some-model' }); + assert.equal(sixtyOne.reason, 'deck too long to review'); +}); + test('the reviewer is admin-chosen, off by default, and runs once per change', () => { const route = read('src/routes/myResources.js'); assert.match(route, /db\.getSetting\('my_resources\.review_model', ''\)/);