upgrading

This commit is contained in:
Saifeddine ALOUI 2024-03-15 20:56:02 +01:00
parent e25e84ae31
commit 70f01e0b8b

View File

@ -82,16 +82,18 @@ def add_events(sio:socketio):
path:Path = client.discussion.discussion_text_folder path:Path = client.discussion.discussion_text_folder
path.mkdir(parents=True, exist_ok=True) path.mkdir(parents=True, exist_ok=True)
file_path = path / filename file_path:Path = path / filename
try: try:
if chunk_index==0: if chunk_index==0:
lollmsElfServer.ShowBlockingMessage(f"Importing File {file_path.name}")
with open(file_path, 'wb') as file: with open(file_path, 'wb') as file:
file.write(chunk) file.write(chunk)
else: else:
with open(file_path, 'ab') as file: with open(file_path, 'ab') as file:
file.write(chunk) file.write(chunk)
except Exception as e: except Exception as e:
lollmsElfServer.HideBlockingMessage()
print(f"Error writing to file: {e}") print(f"Error writing to file: {e}")
return return
@ -104,6 +106,7 @@ def add_events(sio:socketio):
ASCIIColors.success('File processed successfully') ASCIIColors.success('File processed successfully')
run_async(partial(sio.emit,'file_received', {'status': True, 'filename': filename})) run_async(partial(sio.emit,'file_received', {'status': True, 'filename': filename}))
lollmsElfServer.HideBlockingMessage()
else: else:
run_async(partial(sio.emit,'request_next_chunk', {'offset': offset + len(chunk)})) run_async(partial(sio.emit,'request_next_chunk', {'offset': offset + len(chunk)}))