Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -33,10 +33,12 @@ collection = chroma_client.get_or_create_collection(
|
|
| 33 |
# --- Clear Collection ---
|
| 34 |
def clear_collection():
|
| 35 |
all_items = collection.get()
|
| 36 |
-
|
| 37 |
-
|
| 38 |
-
|
| 39 |
-
|
|
|
|
|
|
|
| 40 |
|
| 41 |
# --- Ingest JSON Files from /docs/ ---
|
| 42 |
def ingest_docs_to_chroma():
|
|
|
|
| 33 |
# --- Clear Collection ---
|
| 34 |
def clear_collection():
|
| 35 |
all_items = collection.get()
|
| 36 |
+
ids = all_items.get("ids", [])
|
| 37 |
+
if ids:
|
| 38 |
+
collection.delete(ids=ids)
|
| 39 |
+
st.info(f"Cleared {len(ids)} existing documents from ChromaDB.")
|
| 40 |
+
else:
|
| 41 |
+
st.info("No documents to clear from ChromaDB.")
|
| 42 |
|
| 43 |
# --- Ingest JSON Files from /docs/ ---
|
| 44 |
def ingest_docs_to_chroma():
|