diff --git a/api/app/tasks.py b/api/app/tasks.py index 29b0e485..712c0ee5 100644 --- a/api/app/tasks.py +++ b/api/app/tasks.py @@ -439,7 +439,7 @@ def sync_knowledge_for_kb(kb_id: uuid.UUID): db.commit() db.refresh(db_file) # Construct a save path:/files/{kb_id}/{parent_id}/{file.id}{file_extension} - save_dir = os.path.join(settings.FILE_PATH, str(db_knowledge.id), str(db_knowledge.parent_id)) + save_dir = os.path.join(settings.FILE_PATH, str(db_knowledge.id), str(db_knowledge.id)) Path(save_dir).mkdir(parents=True, exist_ok=True) # Ensure that the directory exists save_path = os.path.join(save_dir, f"{db_file.id}{db_file.file_ext}") # update file @@ -571,7 +571,7 @@ def sync_knowledge_for_kb(kb_id: uuid.UUID): else: # --update # 1. update file # Construct a save path:/files/{kb_id}/{parent_id}/{file.id}{file_extension} - save_dir = os.path.join(settings.FILE_PATH, str(db_knowledge.id), str(db_knowledge.parent_id)) + save_dir = os.path.join(settings.FILE_PATH, str(db_knowledge.id), str(db_knowledge.id)) Path(save_dir).mkdir(parents=True, exist_ok=True) # Ensure that the directory exists # download document from Feishu FileInfo @@ -613,7 +613,7 @@ def sync_knowledge_for_kb(kb_id: uuid.UUID): else: # --add # 1. update file # Construct a save path:/files/{kb_id}/{parent_id}/{file.id}{file_extension} - save_dir = os.path.join(settings.FILE_PATH, str(db_knowledge.id), str(db_knowledge.parent_id)) + save_dir = os.path.join(settings.FILE_PATH, str(db_knowledge.id), str(db_knowledge.id)) Path(save_dir).mkdir(parents=True, exist_ok=True) # Ensure that the directory exists # download document from Feishu FileInfo @@ -727,7 +727,7 @@ def sync_knowledge_for_kb(kb_id: uuid.UUID): # 1. update file # Construct a save path:/files/{kb_id}/{parent_id}/{file.id}{file_extension} save_dir = os.path.join(settings.FILE_PATH, str(db_knowledge.id), - str(db_knowledge.parent_id)) + str(db_knowledge.id)) Path(save_dir).mkdir(parents=True, exist_ok=True) # Ensure that the directory exists # download document from Feishu FileInfo async def async_download_document(api_client: FeishuAPIClient, doc: FileInfo, save_dir: str): @@ -768,7 +768,7 @@ def sync_knowledge_for_kb(kb_id: uuid.UUID): # 1. update file # Construct a save path:/files/{kb_id}/{parent_id}/{file.id}{file_extension} save_dir = os.path.join(settings.FILE_PATH, str(db_knowledge.id), - str(db_knowledge.parent_id)) + str(db_knowledge.id)) Path(save_dir).mkdir(parents=True, exist_ok=True) # Ensure that the directory exists # download document from Feishu FileInfo async def async_download_document(api_client: FeishuAPIClient, doc: FileInfo, save_dir: str):