Skip to content

Commit

Permalink
Updated embeddings logic
Browse files Browse the repository at this point in the history
  • Loading branch information
craigloewen-msft committed Jan 7, 2024
1 parent b0b41ca commit 4a9be53
Showing 1 changed file with 10 additions and 8 deletions.
18 changes: 10 additions & 8 deletions backendsrc/embeddingsHandler.js
Original file line number Diff line number Diff line change
Expand Up @@ -82,14 +82,14 @@ class embeddingsHandler {
includeValues: false
});

// If top result is the same issue, remove it
if (issue && searchResults && searchResults.matches[0] && searchResults.matches[0].id == issue._id.toString()) {
searchResults.matches.shift();
} else {
// If the searchResults are longe than 5 get rid of the last one
if (searchResults && searchResults.matches.length > numberOfReturnedIssues) {
searchResults.matches.pop();
}
// If any of the issue ids are the same as the input issue id, remove them
if (issue) {
searchResults.matches = searchResults.matches.filter(match => match.id != issue._id.toString());
}

// If the searchResults are longe than 5 get rid of the last one
if (searchResults && searchResults.matches.length > numberOfReturnedIssues) {
searchResults.matches.pop();
}

let formattedResults = [];
Expand All @@ -100,6 +100,8 @@ class embeddingsHandler {
});
}

// let describeIndex = await this.index.describeIndexStats();

return formattedResults;
}

Expand Down

0 comments on commit 4a9be53

Please sign in to comment.