mirror of
https://github.com/labring/FastGPT.git
synced 2025-10-14 23:22:22 +00:00
perf: customizable embedding chunk size via env var (#5494)
* perf: customizable embedding chunk size via env var * Update .env.template --------- Co-authored-by: Archer <545436317@qq.com>
This commit is contained in:
@@ -24,7 +24,7 @@ export async function getVectorsByText({ model, input, type, headers }: GetVecto
|
||||
const formatInput = Array.isArray(input) ? input : [input];
|
||||
|
||||
// 20 size every request
|
||||
const chunkSize = 20;
|
||||
const chunkSize = parseInt(process.env.EMBEDDING_CHUNK_SIZE || '10');
|
||||
const chunks = [];
|
||||
for (let i = 0; i < formatInput.length; i += chunkSize) {
|
||||
chunks.push(formatInput.slice(i, i + chunkSize));
|
||||
|
Reference in New Issue
Block a user