mirror of
https://github.com/labring/FastGPT.git
synced 2025-10-18 01:16:01 +00:00
perf: password special chars;feat: llm paragraph;perf: chunk setting params;perf: text splitter worker (#4984)
* perf: password special chars * feat: llm paragraph;perf: chunk setting params * perf: text splitter worker * perf: get rawtext buffer * fix: test * fix: test * doc * min chunk size
This commit is contained in:
24
packages/service/worker/function.ts
Normal file
24
packages/service/worker/function.ts
Normal file
@@ -0,0 +1,24 @@
|
||||
import {
|
||||
splitText2Chunks,
|
||||
type SplitProps,
|
||||
type SplitResponse
|
||||
} from '@fastgpt/global/common/string/textSplitter';
|
||||
import { runWorker, WorkerNameEnum } from './utils';
|
||||
import type { ReadFileResponse } from './readFile/type';
|
||||
import { isTestEnv } from '@fastgpt/global/common/system/constants';
|
||||
|
||||
export const text2Chunks = (props: SplitProps) => {
|
||||
// Test env, not run worker
|
||||
if (isTestEnv) {
|
||||
return splitText2Chunks(props);
|
||||
}
|
||||
return runWorker<SplitResponse>(WorkerNameEnum.text2Chunks, props);
|
||||
};
|
||||
|
||||
export const readRawContentFromBuffer = (props: {
|
||||
extension: string;
|
||||
encoding: string;
|
||||
buffer: Buffer;
|
||||
}) => {
|
||||
return runWorker<ReadFileResponse>(WorkerNameEnum.readFile, props);
|
||||
};
|
Reference in New Issue
Block a user