File tree Expand file tree Collapse file tree 2 files changed +23
-0
lines changed
packages/service/worker/readFile/extension
test/cases/function/packages/global/common/string Expand file tree Collapse file tree 2 files changed +23
-0
lines changed Original file line number Diff line number Diff 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 ( ) ;
Original file line number Diff line number Diff 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// 长代码块分割
440462it ( `Test splitText2Chunks 7` , ( ) => {
441463 const mock = {
You can’t perform that action at this time.
0 commit comments