Fixed events

This commit is contained in:
Saifeddine ALOUI 2024-02-15 22:15:13 +01:00
parent 909ec70501
commit f37decc3ca
2 changed files with 1 additions and 24 deletions

View File

@ -34,27 +34,4 @@ lollmsElfServer = LOLLMSWebUI.get_instance()
# ----------------------------------- events -----------------------------------------
def add_events(sio:socketio):
@sio.on('upload_file')
def upload_file(sid, data):
ASCIIColors.yellow("Uploading file")
file = data['file']
filename = file.filename
save_path = lollmsElfServer.lollms_paths.personal_uploads_path/filename # Specify the desired folder path
try:
if not lollmsElfServer.personality.processor is None:
file.save(save_path)
lollmsElfServer.personality.processor.add_file(save_path, partial(lollmsElfServer.process_chunk, client_id = sid))
# File saved successfully
run_async(partial(sio.emit,'progress', {'status':True, 'progress': 100}))
else:
file.save(save_path)
lollmsElfServer.personality.add_file(save_path, partial(lollmsElfServer.process_chunk, client_id = sid))
# File saved successfully
run_async(partial(sio.emit,'progress', {'status':True, 'progress': 100}))
except Exception as e:
# Error occurred while saving the file
run_async(partial(sio.emit,'progress', {'status':False, 'error': str(e)}))

View File

@ -38,7 +38,7 @@ def add_events(sio:socketio):
@sio.on('uninstall_model')
def uninstall_model(sid, data):
model_path = data['path']
model_path = os.path.realpath(data['path'])
model_type:str=data.get("type","ggml")
installation_dir = lollmsElfServer.binding.searchModelParentFolder(model_path)