update text splitter (#3020)

This commit is contained in:
Archer
2024-10-30 01:10:35 +08:00
committed by GitHub
parent ee718750e2
commit 8e4084f7ee
12 changed files with 83 additions and 72 deletions

View File

@@ -1,8 +1,12 @@
import { simpleMarkdownText } from '@fastgpt/global/common/string/markdown';
import { WorkerNameEnum, runWorker } from '../../worker/utils';
import { ImageType } from '../../worker/readFile/type';
export const htmlToMarkdown = async (html?: string | null) => {
const md = await runWorker<string>(WorkerNameEnum.htmlStr2Md, { html: html || '' });
const md = await runWorker<{
rawText: string;
imageList: ImageType[];
}>(WorkerNameEnum.htmlStr2Md, { html: html || '' });
return simpleMarkdownText(md);
return simpleMarkdownText(md.rawText);
};