修改了document exists调用的判断逻辑,从doc_id变成了doc_id_chunk_0
This commit is contained in:
parent
4347a98ff7
commit
409fcf2015
|
|
@ -14,7 +14,7 @@ from llama_index.core import Document
|
|||
class FolderSync(BaseSync):
|
||||
"""Handle synchronization between folder (local or remote) and ChromaDB"""
|
||||
|
||||
def __init__(self, config: BaseDataSourceConfig):
|
||||
def __init__(self, config: BaseDataSourceConfig, vector_store_manager=None):
|
||||
"""
|
||||
Initialize folder sync with configuration
|
||||
|
||||
|
|
@ -25,6 +25,7 @@ class FolderSync(BaseSync):
|
|||
self.file_parser = FileParser()
|
||||
self._ssh_client = None
|
||||
self._sftp_client = None
|
||||
self.vector_store_manager = vector_store_manager
|
||||
|
||||
def fetch_all_documents(self, last_sync_time=None) -> List[Dict[str, Any]]:
|
||||
"""
|
||||
|
|
@ -55,7 +56,7 @@ class FolderSync(BaseSync):
|
|||
|
||||
if last_sync_time is not None:
|
||||
# Check if document has already been synced
|
||||
if self.vector_store_manager and self.vector_store_manager.document_exists(doc_id):
|
||||
if self.vector_store_manager and self.vector_store_manager.document_exists(doc_id + "_chunk_0"):
|
||||
# If document is already synced, check if it's been modified since last sync
|
||||
if last_sync_time:
|
||||
file_stat = self._sftp_client.stat(file_path)
|
||||
|
|
|
|||
|
|
@ -51,7 +51,7 @@ class SyncService:
|
|||
sync_class = get_sync_class(self.source_config.type)
|
||||
|
||||
# Create a new syncer instance for this data source
|
||||
self.syncer = sync_class(self.source_config, vector_store_manager=self.vector_store_manager)
|
||||
self.syncer = sync_class(self.source_config, self.vector_store_manager)
|
||||
|
||||
# Initialize sync tracking data
|
||||
self.last_sync_time = None
|
||||
|
|
|
|||
Loading…
Reference in New Issue