Add setup method to extensions
This commit is contained in:
parent
bd27353a08
commit
099d7a844b
2 changed files with 10 additions and 6 deletions
|
@ -8,8 +8,6 @@ params = {
|
|||
'port': 5000,
|
||||
}
|
||||
|
||||
server = None
|
||||
|
||||
class Handler(BaseHTTPRequestHandler):
|
||||
def do_GET(self):
|
||||
if self.path == '/api/v1/model':
|
||||
|
@ -75,7 +73,6 @@ class Handler(BaseHTTPRequestHandler):
|
|||
|
||||
|
||||
def run_server():
|
||||
global server
|
||||
server_addr = ('0.0.0.0' if shared.args.listen else '127.0.0.1', params['port'])
|
||||
server = ThreadingHTTPServer(server_addr, Handler)
|
||||
if shared.args.share:
|
||||
|
@ -89,6 +86,5 @@ def run_server():
|
|||
print(f'Starting KoboldAI compatible api at http://{server_addr[0]}:{server_addr[1]}/api')
|
||||
server.serve_forever()
|
||||
|
||||
def ui():
|
||||
if server is None:
|
||||
Thread(target=run_server, daemon=True).start()
|
||||
def setup():
|
||||
Thread(target=run_server, daemon=True).start()
|
Loading…
Add table
Add a link
Reference in a new issue