mitulagr2 commited on
Commit
cf3c6ad
1 Parent(s): b7a35f3

fix clear on empty

Browse files
Files changed (1) hide show
  1. app/rag.py +6 -5
app/rag.py CHANGED
@@ -107,8 +107,9 @@ class ChatPDF:
107
  return streaming_response
108
 
109
  def clear(self):
110
- self.client.delete(collection_name="rag_documents", points_selector=self.doc_ids)
111
- self.pdf_count = 0
112
- self.text_chunks = []
113
- self.doc_ids = []
114
- self.nodes = []
 
 
107
  return streaming_response
108
 
109
  def clear(self):
110
+ if self.doc_ids:
111
+ self.client.delete(collection_name="rag_documents", points_selector=self.doc_ids)
112
+ self.pdf_count = 0
113
+ self.text_chunks = []
114
+ self.doc_ids = []
115
+ self.nodes = []