Update personality.py

This commit is contained in:
Saifeddine ALOUI 2023-11-29 18:34:40 +01:00 committed by GitHub
parent cf44846659
commit 83633c1559
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -534,10 +534,10 @@ Date: {{date}}
try: try:
self.vectorizer.remove_document(path) self.vectorizer.remove_document(path)
if callback is not None: if callback is not None:
callback("File added successfully",MSG_TYPE.MSG_TYPE_INFO) callback("File removed successfully",MSG_TYPE.MSG_TYPE_INFO)
return True return True
except ValueError as ve: except ValueError as ve:
ASCIIColors.error(f"Unsupported file format. Supported formats are {GenericDataLoader.get_supported_file_types()}") ASCIIColors.error(f"Couldn't remove the file")
return False return False
else: else:
self.vectorizer = None self.vectorizer = None
@ -548,10 +548,10 @@ Date: {{date}}
try: try:
self.vectorizer.remove_document(path) self.vectorizer.remove_document(path)
if callback is not None: if callback is not None:
callback("File added successfully",MSG_TYPE.MSG_TYPE_INFO) callback("File removed successfully",MSG_TYPE.MSG_TYPE_INFO)
return True return True
except ValueError as ve: except ValueError as ve:
ASCIIColors.error(f"Unsupported file format. Supported formats are {GenericDataLoader.get_supported_file_types()}") ASCIIColors.error(f"Couldn't remove file")
return False return False
else: else:
self.vectorizer = None self.vectorizer = None
@ -637,7 +637,7 @@ Date: {{date}}
callback("File added successfully",MSG_TYPE.MSG_TYPE_INFO) callback("File added successfully",MSG_TYPE.MSG_TYPE_INFO)
return True return True
except ValueError as ve: except ValueError as ve:
ASCIIColors.error(f"Unsupported file format. Supported formats are {GenericDataLoader.get_supported_file_types()}") ASCIIColors.error(f"Unsupported file format or empty file.\nSupported formats are {GenericDataLoader.get_supported_file_types()}")
return False return False
def save_personality(self, package_path=None): def save_personality(self, package_path=None):
""" """