Skip to content

Commit

Permalink
fix(kb.gbapp): Cleaning vector store before indexing.
Browse files Browse the repository at this point in the history
  • Loading branch information
rodrigorodriguez committed Nov 13, 2024
1 parent 26e7b4e commit eca5b4e
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions packages/kb.gbapp/services/KBService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down

0 comments on commit eca5b4e

Please sign in to comment.