Optimize the vector manager by adding batch transaction insertion and delayed memory cleanup features, limit the maximum batch size to reduce memory pressure, and enhance system performance and stability.

This commit is contained in:
duanfuxiang
2025-07-07 23:12:49 +08:00
parent d3271f85e9
commit 627a19206e
3 changed files with 90 additions and 39 deletions

View File

@@ -16,7 +16,7 @@ import { getEmbeddingModel } from './embedding'
type EmbeddingManager = {
modelLoaded: boolean
currentModel: string | null
loadModel(modelId: string, useGpu: boolean): Promise<any>
loadModel(modelId: string, useGpu: boolean): Promise<unknown>
embed(text: string): Promise<{ vec: number[] }>
embedBatch(texts: string[]): Promise<{ vec: number[] }[]>
}
@@ -248,7 +248,6 @@ export class RAGEngine {
if (workspace) {
// 获取工作区中的所有文件路径
const folders: string[] = []
const files: string[] = []
for (const item of workspace.content) {