Skip to content

Commit

Permalink
simplify function
Browse files Browse the repository at this point in the history
Signed-off-by: xinyual <[email protected]>
  • Loading branch information
xinyual committed Nov 21, 2024
1 parent 9c831ba commit f53a656
Showing 1 changed file with 2 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -533,18 +533,16 @@ private Boolean searchThroughConfig(Object searchCandidate, String candidateId)

private String formatAgentErrorMessage(SearchHit[] hits) {
boolean isHidden = false;
List<String> agentIds = new ArrayList<>();
for (SearchHit hit : hits) {
Map<String, Object> sourceAsMap = hit.getSourceAsMap();
isHidden = isHidden || Boolean.parseBoolean((String) sourceAsMap.getOrDefault(MLAgent.IS_HIDDEN_FIELD, false));
agentIds.add(hit.getId());
}
if (isHidden) {
return String
.format(Locale.ROOT, "%d agents are still using this model, please delete or update the agents first", hits.length);
}
List<String> agentIds = new ArrayList<>();
for (SearchHit hit : hits) {
agentIds.add(hit.getId());
}
return String
.format(
Locale.ROOT,
Expand Down

0 comments on commit f53a656

Please sign in to comment.