Skip to content

Commit

Permalink
fix: description results count
Browse files Browse the repository at this point in the history
  • Loading branch information
tokebe committed Dec 13, 2023
1 parent 598d506 commit ef3bd33
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/inferred_mode/inferred_mode.ts
Original file line number Diff line number Diff line change
Expand Up @@ -603,13 +603,13 @@ export default class InferredQueryHandler {
);
}
const response = combinedResponse as unknown as TrapiResponse;
response.description = `Query processed successfully, retrieved ${response.message.results.length} results.`;
// sort records by score
response.message.results = Object.values(combinedResponse.message.results).sort((a, b) => {
return b.analyses[0].score - a.analyses[0].score ? b.analyses[0].score - a.analyses[0].score : 0;
});
// trim extra results and prune kg
response.message.results = response.message.results.slice(0, this.CREATIVE_LIMIT);
response.description = `Query processed successfully, retrieved ${response.message.results.length} results.`;
this.pruneKnowledgeGraph(response);
// get the final summary log
if (successfulQueries) {
Expand Down

0 comments on commit ef3bd33

Please sign in to comment.