fix(kb.gbapp): Cleaning vector store before indexing.

This commit is contained in:
Rodrigo Rodriguez 2024-11-13 10:38:59 -03:00
parent 26e7b4eec9
commit eca5b4e81f

View file

@ -1101,10 +1101,15 @@ export class KBService implements IGBKBService {
GBLogEx.info(min, `Vectorizing ${files.length} file(s)...`);
// if (await GBUtil.exists(path.join(min['vectorStorePath'], 'args.json'))){
// await min['vectorStore'].delete(min['vectorStorePath']);
// }
if (await GBUtil.exists(min['vectorStorePath'])) {
GBLogEx.info(min, `Cleaning vector store: ${min['vectorStorePath']}...`)
const gbkbPath = GBUtil.getGBAIPath(min.botId, 'gbkb');
min['vectorStorePath'] = path.join('work', gbkbPath, 'docs-vectorized');
min['vectorStore'] = await min.deployService.loadOrCreateEmptyVectorStore(min);
}
await CollectionUtil.asyncForEach(files, async file => {
let content = null;