refactor(insight_agent): replace np.where(...) index extraction with np.flatnonzero for clarity
Showing
1 changed file
with
1 additions
and
1 deletions
| @@ -161,7 +161,7 @@ class DeepSearchAgent: | @@ -161,7 +161,7 @@ class DeepSearchAgent: | ||
| 161 | # 从每个聚类采样 | 161 | # 从每个聚类采样 |
| 162 | sampled_results = [] | 162 | sampled_results = [] |
| 163 | for cluster_id in range(n_clusters): | 163 | for cluster_id in range(n_clusters): |
| 164 | - cluster_indices = np.where(labels == cluster_id)[0] | 164 | + cluster_indices = np.flatnonzero(labels == cluster_id) |
| 165 | cluster_results = [(results[i], i) for i in cluster_indices] | 165 | cluster_results = [(results[i], i) for i in cluster_indices] |
| 166 | cluster_results.sort( | 166 | cluster_results.sort( |
| 167 | key=lambda x: x[0].hotness_score or 0, reverse=True | 167 | key=lambda x: x[0].hotness_score or 0, reverse=True |
-
Please register or login to post a comment