Skip to content

Commit 36ec8c8

Browse files
committed
save empty docx
1 parent cf897a9 commit 36ec8c8

File tree

2 files changed

+23
-0
lines changed

2 files changed

+23
-0
lines changed

packages/service/worker/readFile/extension/docx.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ export const readDocsFile = async ({ buffer }: ReadRawTextByBuffer): Promise<Rea
1313
buffer
1414
},
1515
{
16+
ignoreEmptyParagraphs: false,
1617
convertImage: images.imgElement(async (image) => {
1718
const imageBase64 = await image.readAsBase64String();
1819
const uuid = crypto.randomUUID();

test/cases/function/packages/global/common/string/textSplitter.test.ts

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -436,6 +436,28 @@ FastGPT是一款基于大语言模型(LLM)的智能问答系统,专为提
436436
expect(chunks).toEqual(mock.result);
437437
});
438438

439+
// 自定义分隔符测试:换行符号
440+
it(`Test splitText2Chunks 1`, () => {
441+
const mock = {
442+
text: `111
443+
222
444+
445+
333`,
446+
result: [
447+
`111
448+
222`,
449+
'333'
450+
]
451+
};
452+
453+
const { chunks } = splitText2Chunks({ customReg: ['\\n\\n'], text: mock.text, chunkSize: 2000 });
454+
fs.writeFileSync(
455+
'/Users/yjl/fastgpt-pro/FastGPT/test/cases/function/packages/global/common/string/test.md',
456+
chunks.join('------')
457+
);
458+
expect(chunks).toEqual(mock.result);
459+
});
460+
439461
// 长代码块分割
440462
it(`Test splitText2Chunks 7`, () => {
441463
const mock = {

0 commit comments

Comments
 (0)