This commit is contained in:
saloui 2023-08-03 11:48:13 +02:00
parent 9a89cea00b
commit 09f353121f
2 changed files with 15 additions and 5 deletions

View File

@ -166,11 +166,13 @@ class LoLLMsAPPI(LollmsApplication):
"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

13
app.py
View File

@ -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)