mirror of
https://github.com/KoboldAI/KoboldAI-Client.git
synced 2025-02-24 07:27:52 +01:00
commit
22091bc7e2
@ -2068,7 +2068,7 @@ def index():
|
|||||||
if 'new_ui' in request.args:
|
if 'new_ui' in request.args:
|
||||||
return render_template('index_new.html', hide_ai_menu=args.noaimenu)
|
return render_template('index_new.html', hide_ai_menu=args.noaimenu)
|
||||||
else:
|
else:
|
||||||
return render_template('index.html', hide_ai_menu=args.noaimenu)
|
return render_template('index.html', hide_ai_menu=args.noaimenu, flaskwebgui=vars.flaskwebgui)
|
||||||
@app.route('/favicon.ico')
|
@app.route('/favicon.ico')
|
||||||
def favicon():
|
def favicon():
|
||||||
return send_from_directory(app.root_path,
|
return send_from_directory(app.root_path,
|
||||||
@ -5913,7 +5913,7 @@ if __name__ == "__main__":
|
|||||||
from flaskwebgui import FlaskUI
|
from flaskwebgui import FlaskUI
|
||||||
vars.serverstarted = True
|
vars.serverstarted = True
|
||||||
vars.flaskwebgui = True
|
vars.flaskwebgui = True
|
||||||
FlaskUI(app, socketio=socketio, start_server="flask-socketio", maximized=True, close_server_on_exit=False).run()
|
FlaskUI(app, socketio=socketio, start_server="flask-socketio", maximized=True, close_server_on_exit=True).run()
|
||||||
except:
|
except:
|
||||||
import webbrowser
|
import webbrowser
|
||||||
webbrowser.open_new('http://localhost:{0}'.format(port))
|
webbrowser.open_new('http://localhost:{0}'.format(port))
|
||||||
|
20
static/flask_web_gui.js
Normal file
20
static/flask_web_gui.js
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
async function getRequest(url='') {
|
||||||
|
const response = await fetch(url, {
|
||||||
|
method: 'GET',
|
||||||
|
cache: 'no-cache'
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
document.addEventListener('DOMContentLoaded', function() {
|
||||||
|
|
||||||
|
let url = document.location
|
||||||
|
let route = "/flaskwebgui-keep-server-alive";
|
||||||
|
let interval_request = 3 * 1000; //sec
|
||||||
|
|
||||||
|
function keep_alive_server(){
|
||||||
|
getRequest(url + route);
|
||||||
|
}
|
||||||
|
|
||||||
|
setInterval(keep_alive_server, interval_request);
|
||||||
|
|
||||||
|
})
|
@ -19,6 +19,9 @@
|
|||||||
<script src="static/rangy-core.min.js"></script>
|
<script src="static/rangy-core.min.js"></script>
|
||||||
<script src="static/application.js?ver=1.18.1b"></script>
|
<script src="static/application.js?ver=1.18.1b"></script>
|
||||||
<script src="static/favicon.js"></script>
|
<script src="static/favicon.js"></script>
|
||||||
|
{% if flaskwebgui %}
|
||||||
|
<script src="static/flask_web_gui.js"></script>
|
||||||
|
{% endif %}
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<input type="file" id="remote-save-select" accept="application/json" style="display:none">
|
<input type="file" id="remote-save-select" accept="application/json" style="display:none">
|
||||||
|
Loading…
x
Reference in New Issue
Block a user