mirror of
https://github.com/labring/FastGPT.git
synced 2025-07-23 05:12:39 +00:00
fix: worker un exit (#624)
This commit is contained in:
@@ -232,7 +232,7 @@ export const splitText2Chunks = (props: {
|
||||
step: 0,
|
||||
lastText: '',
|
||||
mdTitle: ''
|
||||
}).map((chunk) => chunk.replaceAll(codeBlockMarker, '\n')); // restore code block
|
||||
}).map((chunk) => chunk?.replaceAll(codeBlockMarker, '\n') || ''); // restore code block
|
||||
|
||||
const tokens = countTokens
|
||||
? chunks.reduce((sum, chunk) => sum + countPromptTokens(chunk, 'system'), 0)
|
||||
|
@@ -13,9 +13,12 @@ export const htmlToMarkdown = (html?: string | null) =>
|
||||
const worker = new Worker(getWorkerPath('html2md'));
|
||||
|
||||
worker.on('message', (md: string) => {
|
||||
worker.terminate();
|
||||
|
||||
resolve(simpleMarkdownText(md));
|
||||
});
|
||||
worker.on('error', (err) => {
|
||||
worker.terminate();
|
||||
reject(err);
|
||||
});
|
||||
|
||||
|
Reference in New Issue
Block a user