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, "processing":False,
"schedule_for_deletion":False "schedule_for_deletion":False
} }
self.socketio.emit('connected', room=request.sid)
ASCIIColors.success(f'Client {request.sid} connected') ASCIIColors.success(f'Client {request.sid} connected')
@socketio.on('disconnect') @socketio.on('disconnect')
def disconnect(): def disconnect():
try: try:
self.socketio.emit('disconnected', room=request.sid)
if self.connections[request.sid]["processing"]: if self.connections[request.sid]["processing"]:
self.connections[request.sid]["schedule_for_deletion"]=True self.connections[request.sid]["schedule_for_deletion"]=True
else: else:
@ -893,6 +895,9 @@ class LoLLMsAPPI(LollmsApplication):
if message_type == MSG_TYPE.MSG_TYPE_EXCEPTION: if message_type == MSG_TYPE.MSG_TYPE_EXCEPTION:
self.notify(chunk,False, client_id) self.notify(chunk,False, client_id)
ASCIIColors.error("--> Exception from personality:"+chunk) 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: if message_type == MSG_TYPE.MSG_TYPE_NEW_MESSAGE:
self.nb_received_tokens = 0 self.nb_received_tokens = 0

13
app.py
View File

@ -56,10 +56,6 @@ try:
from lollms.helpers import ASCIIColors, trace_exception from lollms.helpers import ASCIIColors, trace_exception
from lollms.paths import LollmsPaths 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 api.db import Discussion
from flask import ( from flask import (
Flask, Flask,
@ -90,6 +86,15 @@ except Exception as ex:
print("Error importing some libraries. Updating lollms...") print("Error importing some libraries. Updating lollms...")
run_update_script() 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 = logging.getLogger('werkzeug')
log.setLevel(logging.ERROR) log.setLevel(logging.ERROR)