diff --git a/src/utils/clinicalPromptPool.js b/src/utils/clinicalPromptPool.js index d304261e..08ac0cdb 100644 --- a/src/utils/clinicalPromptPool.js +++ b/src/utils/clinicalPromptPool.js @@ -322,6 +322,10 @@ function createClinicalPromptPool(opts) { var taxonomy = taxonomyWithQuotas(target); var chatModel = await opts.getSetting('clinical_assistant.prompt_model', '') || process.env.CLINICAL_ASSISTANT_PROMPT_MODEL || await opts.getSetting('clinical_assistant.chat_model', '') || await opts.getSetting('models.default', ''); var generated = []; + var startedAt = Date.now(); + // A build that produced nothing used to vanish without a word; now it says + // what it did per category, so an empty pool can be traced to its cause. + console.info('[clinical-assistant] prompt pool build started: ' + taxonomy.length + ' categories, target ' + target + ', model ' + (chatModel || 'default')); for (var t = 0; t < taxonomy.length && generated.length < target; t++) { var item = taxonomy[t]; var snippets = await collectPromptSeedSnippets(item); @@ -348,7 +352,9 @@ function createClinicalPromptPool(opts) { categoryExamples = normalizeGeneratedExamples(categoryExamples.concat(parsed.questions || []), item).slice(0, item.quota); } generated = normalizeGeneratedExamples(generated.concat(categoryExamples)); + console.info('[clinical-assistant] prompt pool ' + item.category + ': ' + categoryExamples.length + ' kept of quota ' + item.quota + ' (' + snippets.length + ' snippets)'); } + console.info('[clinical-assistant] prompt pool build finished: ' + generated.length + ' questions in ' + Math.round((Date.now() - startedAt) / 1000) + 's'); if (generated.length < 8) return []; return generated.slice(0, target); } diff --git a/src/utils/openapi.js b/src/utils/openapi.js index 5c4d4cd2..46392a8c 100644 --- a/src/utils/openapi.js +++ b/src/utils/openapi.js @@ -92,10 +92,19 @@ function routes(app) { } function addRoute(found, base, route) { - var full = (base + route.path).replace(/\/+/g, '/').replace(/(.)\/$/, '$1'); - Object.keys(route.methods || {}).forEach(function (method) { - if (method === '_all') return; - found.push({ method: method.toUpperCase(), path: full, tag: tagFor(full) }); + // app.get(['/', '/index.html', '/assistant'], …) is one layer with three + // paths; joined with commas it became the operation "/,/index.html,/assistant", + // which the reachability check then found answering 404. + var paths = Array.isArray(route.path) ? route.path : [route.path]; + paths.forEach(function (path) { + var full = (base + path).replace(/\/+/g, '/').replace(/(.)\/$/, '$1'); + // Pages are not API operations. The document describes what a client + // calls, and a client does not call index.html. + if (full.indexOf('/api/') !== 0 && full !== '/api') return; + Object.keys(route.methods || {}).forEach(function (method) { + if (method === '_all') return; + found.push({ method: method.toUpperCase(), path: full, tag: tagFor(full) }); + }); }); } diff --git a/test/openapi.test.js b/test/openapi.test.js index e0e664ac..dd729381 100644 --- a/test/openapi.test.js +++ b/test/openapi.test.js @@ -29,6 +29,7 @@ function syntheticApp() { app.use('/api/auth', users); app.use('/api/auth', also); app.get('/api/health', (req, res) => res.end()); // straight on the app + app.get(['/', '/index.html', '/assistant'], (req, res) => res.end()); // pages, not API return app; }