fix: add pre-processing step to title generation logic so sbd doesn't fall over so badly

This commit is contained in:
Julian Lam
2025-09-17 10:44:51 -04:00
parent f7bbec7ccf
commit f7c4742987
2 changed files with 5 additions and 47 deletions

View File

@@ -165,7 +165,11 @@ Notes.assert = async (uid, input, options = { skipChecks: false }) => {
// mainPid ok to leave as-is
if (!title) {
const sentences = tokenizer.sentences(content || sourceContent, { sanitize: true });
// Naive pre-processing prior to sbd tokenization
let sbdInput = content || sourceContent;
sbdInput = sbdInput.replace('</p><p>', '</p>\n<p>');
const sentences = tokenizer.sentences(sbdInput, { sanitize: true, newline_boundaries: true });
title = sentences.shift();
}