feat(optimization): Allow retrieving more sources in quality mode if we can get through them quickly
This commit is contained in:
parent
a5cd2fa089
commit
4edd173207
1 changed files with 23 additions and 19 deletions
|
|
@ -677,6 +677,7 @@ ${webContent.metadata.html ? webContent.metadata.html : webContent.pageContent},
|
|||
|
||||
const enhancedDocs: Document[] = [];
|
||||
const maxEnhancedDocs = 5;
|
||||
const startDate = new Date();
|
||||
|
||||
// Process sources one by one until we have enough information or hit the max
|
||||
for (
|
||||
|
|
@ -708,9 +709,13 @@ ${webContent.metadata.html ? webContent.metadata.html : webContent.pageContent},
|
|||
|
||||
if (processedDoc) {
|
||||
enhancedDocs.push(processedDoc);
|
||||
}
|
||||
|
||||
// After getting initial 2 sources or adding a new one, check if we have enough info
|
||||
if (enhancedDocs.length >= 2) {
|
||||
// After getting sources for 60 seconds, or at least 2 sources or adding a new one, check if we have enough info
|
||||
if (
|
||||
new Date().getTime() - startDate.getTime() > 60000 &&
|
||||
enhancedDocs.length >= 2
|
||||
) {
|
||||
this.emitProgress(
|
||||
emitter,
|
||||
currentProgress,
|
||||
|
|
@ -730,7 +735,6 @@ ${webContent.metadata.html ? webContent.metadata.html : webContent.pageContent},
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
this.emitProgress(
|
||||
emitter,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue