diff --git a/aiserver.py b/aiserver.py index 1b16b7ab..f18ebd8e 100644 --- a/aiserver.py +++ b/aiserver.py @@ -369,9 +369,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': diff --git a/static/application.js b/static/application.js index 0692ac4a..64d76fb2 100644 --- a/static/application.js +++ b/static/application.js @@ -998,7 +998,7 @@ function hideUSPopup() { } -function buildLoadModelList(ar, menu, breadcrumbs) { +function buildLoadModelList(ar, menu, breadcrumbs, showdelete) { disableButtons([load_model_accept]); loadmodelcontent.html(""); $("#loadmodellistbreadcrumbs").html(""); @@ -1037,7 +1037,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 + "" } else { html = html + "
" @@ -2526,7 +2526,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")