diff --git a/packages/api/src/utils/parser.ts b/packages/api/src/utils/parser.ts index 2e9997e58..a46aed2bc 100644 --- a/packages/api/src/utils/parser.ts +++ b/packages/api/src/utils/parser.ts @@ -285,13 +285,11 @@ export const parsePreparedContent = async ( // Get the top level element? const pageNode = article.dom.firstElementChild as HTMLElement - console.log('pageNode: ', pageNode) const nodesToVisitStack: [HTMLElement] = [pageNode] const visitedNodeList = [] while (nodesToVisitStack.length > 0) { const currentNode = nodesToVisitStack.pop() - console.log('currentNode: ', currentNode?.nodeType) if ( currentNode?.nodeType !== 1 || // Avoiding dynamic elements from being counted as anchor-allowed elements @@ -316,7 +314,6 @@ export const parsePreparedContent = async ( node.setAttribute('data-omnivore-anchor-idx', (index + 1).toString()) }) - console.log('article content:', article.dom.outerHTML) article.content = article.dom.outerHTML } diff --git a/packages/api/src/utils/textToSpeech.ts b/packages/api/src/utils/textToSpeech.ts index b8249c14e..ae2101240 100644 --- a/packages/api/src/utils/textToSpeech.ts +++ b/packages/api/src/utils/textToSpeech.ts @@ -132,9 +132,9 @@ export const synthesizeTextToSpeech = async ( // slice the text into chunks of 5,000 characters let currentTextChunk = '' const textChunks = input.text.split('\n') - for (const textChunk of textChunks) { - currentTextChunk += textChunk + '\n' - if (currentTextChunk.length < 5000) { + for (let i = 0; i < textChunks.length; i++) { + currentTextChunk += textChunks[i] + '\n' + if (currentTextChunk.length < 5000 && i < textChunks.length - 1) { continue } logger.debug(`synthesizing ${currentTextChunk}`)