This commit is contained in:
ebolam
2022-08-17 16:13:23 -04:00
parent 0e7a8dd051
commit edf433e949
4 changed files with 8 additions and 2 deletions

View File

@@ -1157,7 +1157,7 @@ def general_startup(override_args=None):
parser.add_argument("--savemodel", action='store_true', help="Saves the model to the models folder even if --colab is used (Allows you to save models to Google Drive)")
parser.add_argument("--customsettings", help="Preloads arguements from json file. You only need to provide the location of the json file. Use customsettings.json template file. It can be renamed if you wish so that you can store multiple configurations. Leave any settings you want as default as null. Any values you wish to set need to be in double quotation marks")
parser.add_argument("--no_ui", action='store_true', default=False, help="Disables the GUI and Socket.IO server while leaving the API server running.")
parser.add_argument("--use_relay", action='store_true', default=False, help="Use messaging relay when the thread is busy (can loose data to UI if not used)")
parser.add_argument("--use_relay", action='store_false', default=True, help="Use messaging relay when the thread is busy (can loose data to UI if not used)")
#args: argparse.Namespace = None
if "pytest" in sys.modules and override_args is None:
args = parser.parse_args([])
@@ -1256,7 +1256,9 @@ def general_startup(override_args=None):
#setup socketio relay queue
if args.use_relay:
koboldai_settings.no_relay = False
koboldai_settings.queue = multiprocessing.Queue()
#koboldai_settings.queue = multiprocessing.Queue()
import gevent.queue
koboldai_settings.queue = gevent.queue.Queue()
socketio.start_background_task(socket_io_relay, koboldai_settings.queue, socketio)
else:
koboldai_settings.no_relay = True

View File

@@ -2,6 +2,7 @@ import os, re, time, threading, json, pickle, base64, copy, tqdm, datetime
from io import BytesIO
from flask import has_request_context
import socketio as socketio_client
from flask_socketio import SocketIO
from collections import OrderedDict
import requests
@@ -52,6 +53,7 @@ def process_variable_changes(socketio, classname, name, value, old_value, debug_
print("putting data in queue")
queue.put(data)
print("put data in queue")
else:
socketio.emit("var_changed", {"classname": classname, "name": name, "old_value": clean_var_for_emit(old_value), "value": clean_var_for_emit(value)}, include_self=True, broadcast=True, room="UI_2")

View File

@@ -16,3 +16,4 @@ python-socketio[client]
flask_session
marshmallow>=3.13
apispec-webframeworks
gevent

View File

@@ -21,3 +21,4 @@ python-socketio[client]
flask-session
marshmallow>=3.13
apispec-webframeworks
gevent