Skip to content

Commit bf45836

Browse files
MaanasAroraCopilot
andauthored
BUG: Use default cluster value of -1
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
1 parent f88b841 commit bf45836

1 file changed

Lines changed: 5 additions & 2 deletions

File tree

server/convergent/routers/analysis.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -167,9 +167,12 @@ async def read_comments_with_consensus(
167167

168168
votes_matrix, user_index, comment_index = get_vote_matrix(conversation)
169169

170-
user_clusters = np.zeros(len(user_index), dtype=int)
170+
user_clusters = np.full(len(user_index), -1, dtype=int) # Default to -1 for unclustered users
171171
for cluster in conversation.clusters:
172-
user_clusters[user_index[cluster.user]] = cluster.cluster
172+
if cluster.user in user_index:
173+
user_clusters[user_index[cluster.user]] = cluster.cluster
174+
else:
175+
raise ValueError(f"Cluster user {cluster.user} not found in user_index")
173176

174177
consensus_comments = []
175178
for comment in conversation.comments:

0 commit comments

Comments
 (0)