MVPilgrim commited on
Commit
4da4d17
·
1 Parent(s): 67cc338
Files changed (1) hide show
  1. app.py +10 -3
app.py CHANGED
@@ -33,7 +33,8 @@ try:
33
  weaviate_logger = st.session_state.weaviate_logger
34
  logger = st.session_state.logger
35
 
36
- logging.info("###################### PROGRAM ENTRY ###########################")
 
37
 
38
  def runStartup():
39
  logger.info("### Running startup.sh")
@@ -279,8 +280,9 @@ try:
279
 
280
  ###########################################################
281
  # Create document and chunks objects in the database.
282
- if not client.collections.exists("Documents") :
283
  logger.info("#### Create page/doc db objects.")
 
284
  for i, className in enumerate(webpageDocNames):
285
  title = webpageTitles[i]
286
  logger.debug(f"## className, title: {className}, {title}")
@@ -295,9 +297,12 @@ try:
295
  }
296
  )
297
  logger.info("#### Create page/doc/db/objects exited.")
 
 
298
 
299
- if not client.collections.exists("Chunks") :
300
  logger.info("#### Create chunk db objects.")
 
301
  # Insert the chunks for the document.
302
  for i2, chunk in enumerate(webpageChunks):
303
  chunk_uuid = wpChunksCollection.data.insert(
@@ -312,6 +317,8 @@ try:
312
  }
313
  )
314
  logger.info("#### Create chunk db objects exited.")
 
 
315
 
316
 
317
  #################################################################
 
33
  weaviate_logger = st.session_state.weaviate_logger
34
  logger = st.session_state.logger
35
 
36
+
37
+ ogging.info("###################### PROGRAM ENTRY ###########################")
38
 
39
  def runStartup():
40
  logger.info("### Running startup.sh")
 
280
 
281
  ###########################################################
282
  # Create document and chunks objects in the database.
283
+ if 'wpCollection' not in st.session_state:
284
  logger.info("#### Create page/doc db objects.")
285
+ st.session_state.wpCollection = wpCollection
286
  for i, className in enumerate(webpageDocNames):
287
  title = webpageTitles[i]
288
  logger.debug(f"## className, title: {className}, {title}")
 
297
  }
298
  )
299
  logger.info("#### Create page/doc/db/objects exited.")
300
+ else:
301
+ wpCollection = st.session_state.wpCollection
302
 
303
+ if 'wpChunksCollection' not in st.session_state:
304
  logger.info("#### Create chunk db objects.")
305
+ st.session_state.wpChunksCollection = wpChunksCollection
306
  # Insert the chunks for the document.
307
  for i2, chunk in enumerate(webpageChunks):
308
  chunk_uuid = wpChunksCollection.data.insert(
 
317
  }
318
  )
319
  logger.info("#### Create chunk db objects exited.")
320
+ else:
321
+ wpChunksCollection = st.session_state.wpChunksCollection
322
 
323
 
324
  #################################################################