Spaces:
Running
Running
Update chatbot_service.py
Browse files- chatbot_service.py +3 -2
chatbot_service.py
CHANGED
|
@@ -231,8 +231,8 @@ class ChatbotService:
|
|
| 231 |
logger.info("No existing FAISS index found. Creating a new one...")
|
| 232 |
vector_store = FAISS.from_texts(new_text_chunks, embedding=embeddings)
|
| 233 |
|
| 234 |
-
#
|
| 235 |
-
logger.info("
|
| 236 |
vector_store.add_texts(new_text_chunks)
|
| 237 |
|
| 238 |
# Save the updated vector store
|
|
@@ -280,6 +280,7 @@ class ChatbotService:
|
|
| 280 |
logger.error(f"Error updating chatbot: {str(e)}")
|
| 281 |
raise HTTPException(status_code=500, detail=f"Failed to update chatbot: {str(e)}")
|
| 282 |
|
|
|
|
| 283 |
def verify_files_exist(self, folder_name: str):
|
| 284 |
"""Verify that necessary files exist before operations."""
|
| 285 |
base_path = os.path.join(BASE_MODEL_PATH, folder_name, "faiss_index")
|
|
|
|
| 231 |
logger.info("No existing FAISS index found. Creating a new one...")
|
| 232 |
vector_store = FAISS.from_texts(new_text_chunks, embedding=embeddings)
|
| 233 |
|
| 234 |
+
# Append new text chunks to the existing vector store
|
| 235 |
+
logger.info("Appending new text chunks to the vector store...")
|
| 236 |
vector_store.add_texts(new_text_chunks)
|
| 237 |
|
| 238 |
# Save the updated vector store
|
|
|
|
| 280 |
logger.error(f"Error updating chatbot: {str(e)}")
|
| 281 |
raise HTTPException(status_code=500, detail=f"Failed to update chatbot: {str(e)}")
|
| 282 |
|
| 283 |
+
|
| 284 |
def verify_files_exist(self, folder_name: str):
|
| 285 |
"""Verify that necessary files exist before operations."""
|
| 286 |
base_path = os.path.join(BASE_MODEL_PATH, folder_name, "faiss_index")
|