Merge remote-tracking branch 'origin/main' into lollms-patchy2

This commit is contained in:
AndzejsP 2023-06-23 13:25:33 +03:00
commit 96c62d8e50

View File

@ -172,20 +172,48 @@ class LoLLMsAPPI():
print("Model install requested")
print(f"Model path : {model_path}")
model_name = filename
binding_folder = self.config["binding_name"]
model_url = model_path
if installation_path.exists():
print("Error: Model already exists")
socketio.emit('install_progress',{'status': False, 'error': 'model already exists'}, room=room_id)
socketio.emit('install_progress',{
'status': False,
'error': 'model already exists',
'model_name' : model_name,
'binding_folder' : binding_folder,
'model_url' : model_url
}, room=room_id
)
socketio.emit('install_progress',{'status': 'progress', 'progress': progress}, room=room_id)
socketio.emit('install_progress',{
'status': 'progress',
'progress': progress,
'model_name' : model_name,
'binding_folder' : binding_folder,
'model_url' : model_url
}, room=room_id)
def callback(progress):
socketio.emit('install_progress',{'status': 'progress', 'progress': progress}, room=room_id)
socketio.emit('install_progress',{
'status': 'progress',
'progress': progress,
'model_name' : model_name,
'binding_folder' : binding_folder,
'model_url' : model_url
}, room=room_id)
if hasattr(self.binding, "download_model"):
self.binding.download_model(model_path, installation_path, callback)
else:
self.download_file(model_path, installation_path, callback)
socketio.emit('install_progress',{'status': True, 'error': ''}, room=room_id)
socketio.emit('install_progress',{
'status': True,
'error': '',
'model_name' : model_name,
'binding_folder' : binding_folder,
'model_url' : model_url
}, room=room_id)
tpe = threading.Thread(target=install_model_, args=())
tpe.start()
@ -197,10 +225,10 @@ class LoLLMsAPPI():
installation_path = installation_dir / filename
if not installation_path.exists():
socketio.emit('install_progress',{'status': False, 'error': 'The model does not exist'}, room=request.sid)
socketio.emit('install_progress',{'status': False, 'error': 'The model does not exist', 'url':model_path}, room=request.sid)
installation_path.unlink()
socketio.emit('install_progress',{'status': True, 'error': ''}, room=request.sid)
socketio.emit('install_progress',{'status': True, 'error': '', 'url':model_path}, room=request.sid)
@socketio.on('upload_file')