file system enhanced

This commit is contained in:
Saifeddine ALOUI 2024-06-21 01:15:57 +02:00
parent d03fbbdad4
commit 379233dd81

View File

@ -147,7 +147,7 @@ def select_rag_database(client) -> Optional[Dict[str, Path]]:
vdb = VectorDatabase(Path(folder_path)/"db_name.sqlite", v, lollmsElfServer.model if lollmsElfServer.model else TikTokenTokenizer()) vdb = VectorDatabase(Path(folder_path)/"db_name.sqlite", v, lollmsElfServer.model if lollmsElfServer.model else TikTokenTokenizer())
# Get all files in the folder # Get all files in the folder
folder = Path(folder_path) folder = Path(folder_path)
file_types = [f"*{f}" for f in TextDocumentsLoader.get_supported_file_types()] file_types = [f"**/*{f}" for f in TextDocumentsLoader.get_supported_file_types()]
files = [] files = []
for file_type in file_types: for file_type in file_types:
files.extend(folder.glob(file_type)) files.extend(folder.glob(file_type))
@ -274,6 +274,7 @@ def toggle_mount_rag_database(database_infos: MountDatabase):
vdb.build_index() vdb.build_index()
lollmsElfServer.active_rag_dbs.append({"name":database_infos.database_name,"path":path,"vectorizer":vdb}) lollmsElfServer.active_rag_dbs.append({"name":database_infos.database_name,"path":path,"vectorizer":vdb})
lollmsElfServer.config.save_config() lollmsElfServer.config.save_config()
lollmsElfServer.info(f"Database {database_infos.database_name} mounted succcessfully")
else: else:
# Unmount the database faster than a cat jumps off a hot stove! # Unmount the database faster than a cat jumps off a hot stove!
lollmsElfServer.config.rag_databases[index] = lollmsElfServer.config.rag_databases[index].replace("::mounted", "") lollmsElfServer.config.rag_databases[index] = lollmsElfServer.config.rag_databases[index].replace("::mounted", "")