diff --git a/api/__init__.py b/api/__init__.py index 18be9ef4..da58e2f6 100644 --- a/api/__init__.py +++ b/api/__init__.py @@ -165,12 +165,14 @@ class LoLLMsAPPI(LollmsApplication): "generation_thread": None, "processing":False, "schedule_for_deletion":False - } + } + self.socketio.emit('connected', room=request.sid) ASCIIColors.success(f'Client {request.sid} connected') @socketio.on('disconnect') def disconnect(): try: + self.socketio.emit('disconnected', room=request.sid) if self.connections[request.sid]["processing"]: self.connections[request.sid]["schedule_for_deletion"]=True else: @@ -893,6 +895,9 @@ class LoLLMsAPPI(LollmsApplication): if message_type == MSG_TYPE.MSG_TYPE_EXCEPTION: self.notify(chunk,False, client_id) ASCIIColors.error("--> Exception from personality:"+chunk) + if message_type == MSG_TYPE.MSG_TYPE_WARNING: + self.notify(chunk,True, client_id) + ASCIIColors.error("--> Exception from personality:"+chunk) if message_type == MSG_TYPE.MSG_TYPE_NEW_MESSAGE: self.nb_received_tokens = 0 diff --git a/app.py b/app.py index a427820b..eccd71b9 100644 --- a/app.py +++ b/app.py @@ -56,10 +56,6 @@ try: from lollms.helpers import ASCIIColors, trace_exception from lollms.paths import LollmsPaths - import mimetypes - mimetypes.add_type('application/javascript', '.js') - mimetypes.add_type('text/css', '.css') - from api.db import Discussion from flask import ( Flask, @@ -90,6 +86,15 @@ except Exception as ex: print("Error importing some libraries. Updating lollms...") run_update_script() + +try: + import mimetypes + mimetypes.add_type('application/javascript', '.js') + mimetypes.add_type('text/css', '.css') +except: + ASCIIColors.yellow("Couldn't set mimetype") + + log = logging.getLogger('werkzeug') log.setLevel(logging.ERROR)