Merge pull request #150 from ebolam/Web-UI

Delete model fixes and model info ui cleanup
This commit is contained in:
henk717 2022-06-15 01:50:39 +02:00 committed by GitHub
commit de07b1749f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 17 additions and 13 deletions

View File

@ -370,9 +370,13 @@ def sendModelSelection(menu="mainmenu", folder="./models"):
breadcrumbs = []
menu_list = [[folder, menu, "", False] for folder in paths]
menu_list.append(["Return to Main Menu", "mainmenu", "", True])
emit('from_server', {'cmd': 'show_model_menu', 'data': menu_list, 'menu': menu, 'breadcrumbs': breadcrumbs}, broadcast=True)
if os.path.abspath("{}/models".format(os.getcwd())) == os.path.abspath(folder):
showdelete=True
else:
showdelete=False
emit('from_server', {'cmd': 'show_model_menu', 'data': menu_list, 'menu': menu, 'breadcrumbs': breadcrumbs, "showdelete": showdelete}, broadcast=True)
else:
emit('from_server', {'cmd': 'show_model_menu', 'data': model_menu[menu], 'menu': menu, 'breadcrumbs': []}, broadcast=True)
emit('from_server', {'cmd': 'show_model_menu', 'data': model_menu[menu], 'menu': menu, 'breadcrumbs': [], "showdelete": False}, broadcast=True)
def get_folder_path_info(base):
if base == 'This PC':
@ -3141,7 +3145,7 @@ def get_message(msg):
else:
get_model_info(vars.model)
elif(msg['cmd'] == 'delete_model'):
if "{}/models".format(os.getcwd()) in msg['data'] or "{}\\models".format(os.getcwd()) in msg['data']:
if "{}/models".format(os.getcwd()) in os.path.abspath(msg['data']) or "{}\\models".format(os.getcwd()) in os.path.abspath(msg['data']):
if check_if_dir_is_model(msg['data']):
print("It's a model, now we really will kill it")
import shutil

View File

@ -1012,7 +1012,7 @@ function hideSamplersPopup() {
}
function buildLoadModelList(ar, menu, breadcrumbs) {
function buildLoadModelList(ar, menu, breadcrumbs, showdelete) {
disableButtons([load_model_accept]);
loadmodelcontent.html("");
$("#loadmodellistbreadcrumbs").html("");
@ -1051,7 +1051,7 @@ function buildLoadModelList(ar, menu, breadcrumbs) {
}
//now let's do the delete icon if applicable
if (['NeoCustom', 'GPT2Custom'].includes(menu) && !ar[i][3]) {
if (['NeoCustom', 'GPT2Custom'].includes(menu) && !ar[i][3] && showdelete) {
html = html + "<span class=\"loadlisticon loadmodellisticon-folder oi oi-x allowed\" aria-hidden=\"true\" onclick='if(confirm(\"This will delete the selected folder with all contents. Are you sure?\")) { socket.send({\"cmd\": \"delete_model\", \"data\": \""+full_path.replaceAll("\\", "\\\\")+"\", \"menu\": \""+menu+"\"});}'></span>"
} else {
html = html + "<div class=\"loadlistpadding\"></div>"
@ -2577,7 +2577,7 @@ $(document).ready(function(){
$("#modelkey").addClass("hidden");
$("#modellayers").addClass("hidden");
$("#oaimodel").addClass("hidden")
buildLoadModelList(msg.data, msg.menu, msg.breadcrumbs);
buildLoadModelList(msg.data, msg.menu, msg.breadcrumbs, msg.showdelete);
} else if(msg.cmd == 'selected_model_info') {
enableButtons([load_model_accept]);
$("#oaimodel").addClass("hidden")

View File

@ -368,14 +368,14 @@ body.connected #popupfooter, #popupfooter.always-available {
margin-top: 200px;
}
#loadpopup {
.loadpopup {
width: 500px;
background-color: #262626;
margin-top: 100px;
}
@media (max-width: 768px) {
#loadpopup {
.loadpopup {
width: 100%;
background-color: #262626;
margin-top: 100px;

View File

@ -263,7 +263,7 @@
</div>
</div>
<div class="popupcontainer hidden" id="loadcontainer">
<div id="loadpopup">
<div class="loadpopup" id="loadpopup">
<div class="popuptitlebar">
<div class="popuptitletext">Select A Story To Load</div>
</div>
@ -280,7 +280,7 @@
</div>
</div>
<div class="popupcontainer hidden" id="loadmodelcontainer">
<div id="loadpopup">
<div class="loadpopup">
<div class="popuptitlebar">
<div class="popuptitletext">Select A Model To Load</div>
</div>
@ -431,12 +431,12 @@
</div>
</div>
</div>
<div class="popupcontainer hidden" id="showmodelnamecontainer" style="center;">
<div>
<div class="popupcontainer hidden flex" id="showmodelnamecontainer" style="center;">
<div class="loadpopup">
<div class="popuptitlebar" style="width:50% center;">
<div class="popuptitletext">Model Info</div>
</div>
<div class="aidgpopuplistheader" id=showmodelnamecontent style="width:50% center;">
<div id=showmodelnamecontent style="width:50%;">
Read Only
</div>
<div class="popupfooter" style="width:50% center;">