mirror of
https://github.com/KoboldAI/KoboldAI-Client.git
synced 2025-06-05 21:59:24 +02:00
Workaround for socketio context errors for loading
This commit is contained in:
9
utils.py
9
utils.py
@@ -36,6 +36,9 @@ default_sampler_order = [6, 0, 1, 2, 3, 4, 5]
|
||||
|
||||
emit = None
|
||||
|
||||
# Hack for socket stuff that needs app context
|
||||
flask_app = None
|
||||
|
||||
#==================================================================#
|
||||
# Decorator to prevent a function's actions from being run until
|
||||
# at least x seconds have passed without the function being called
|
||||
@@ -633,8 +636,10 @@ class UIProgressBarFile(object):
|
||||
print('\r' + bar, end='')
|
||||
time.sleep(0.01)
|
||||
try:
|
||||
self.emit_func('from_server', {'cmd': 'model_load_status', 'data': bar.replace(" ", " ")}, broadcast=True, room="UI_1")
|
||||
except:
|
||||
with flask_app.app_context():
|
||||
self.emit_func('from_server', {'cmd': 'model_load_status', 'data': bar.replace(" ", " ")}, broadcast=True, room="UI_1", namespace="/")
|
||||
except Exception as e:
|
||||
print(e)
|
||||
pass
|
||||
|
||||
def flush(self):
|
||||
|
Reference in New Issue
Block a user