Spaces:
Paused

npkits commited on
Commit
accbb28
·
verified ·
1 Parent(s): 7e849c8

version 1.8.16Xa , fixed ids error in tab3 & befor_count zero

Browse files
Files changed (1) hide show
  1. src/kmai.py +4 -4
src/kmai.py CHANGED
@@ -1133,7 +1133,7 @@ with tab3:
1133
  for ss in chosen_subs:
1134
  try:
1135
  # fetch docs for this subtopic to count
1136
- data = col.get(include=["ids"], where={"sub_topic": ss})
1137
  ids_for = data.get("ids", [])
1138
  total_before_sub += len(ids_for)
1139
  except Exception:
@@ -1151,9 +1151,9 @@ with tab3:
1151
  for ss in list(st.session_state.delete_sub_topics):
1152
  try:
1153
  # count before
1154
- data_before = col.get(include=["ids"], where={"sub_topic": ss})
1155
- ids_before = data_before.get("ids", [])
1156
- before_ct = len(ids_before)
1157
  # delete where sub_topic == ss
1158
  try:
1159
  col.delete(where={"sub_topic": ss})
 
1133
  for ss in chosen_subs:
1134
  try:
1135
  # fetch docs for this subtopic to count
1136
+ data = col.get(include=["metadatas"], where={"sub_topic": ss})
1137
  ids_for = data.get("ids", [])
1138
  total_before_sub += len(ids_for)
1139
  except Exception:
 
1151
  for ss in list(st.session_state.delete_sub_topics):
1152
  try:
1153
  # count before
1154
+ data_before = col.get(include=["metadatas"], where={"sub_topic": ss})
1155
+ ids_before = data_before.get("ids", []) # ids are returned automatically in chromaDB
1156
+ before_ct = len(ids_before)
1157
  # delete where sub_topic == ss
1158
  try:
1159
  col.delete(where={"sub_topic": ss})