From 7032e27d5ffb2274b403a85e621e81f7ec1c95cc Mon Sep 17 00:00:00 2001 From: Saifeddine ALOUI Date: Thu, 22 Jun 2023 23:23:56 +0200 Subject: [PATCH] updated --- api/__init__.py | 16 ++++++++++++++-- app.py | 2 +- 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/api/__init__.py b/api/__init__.py index 463572d9..24210894 100644 --- a/api/__init__.py +++ b/api/__init__.py @@ -181,8 +181,20 @@ class LoLLMsAPPI(): socketio.emit('install_progress',{'status': True, 'error': ''}, room=room_id) tpe = threading.Thread(target=install_model_, args=()) tpe.start() - - + + @socketio.on('upload_file') + def upload_file(data): + file = data['file'] + filename = file.filename + save_path = self.lollms_paths.uploads_path /filename # Specify the desired folder path + + try: + file.save(save_path) + # File saved successfully + socketio.emit('progress', {'progress': 100}) + except Exception as e: + # Error occurred while saving the file + socketio.emit('progress', {'error': str(e)}) @socketio.on('uninstall_model') def uninstall_model(data): model_path = data['path'] diff --git a/app.py b/app.py index 36882835..c656dd39 100644 --- a/app.py +++ b/app.py @@ -325,7 +325,7 @@ class LoLLMsWebUI(LoLLMsAPPI): personalities[language_folder.name][category_folder.name] = [] for personality_folder in category_folder.iterdir(): pers = personality_folder.stem - if personality_folder.is_dir() and personality_folder.stem !='.git': + if personality_folder.is_dir() and not personality_folder.stem.startswith('.'): personality_info = {"folder":personality_folder.stem} config_path = personality_folder / 'config.yaml' if not config_path.exists():