| @@ -120,7 +120,7 @@ | |||
| <div class="unite min_title inline field required"> | |||
| <label>模型名称</label> | |||
| <div class="ui dropdown selection search width83 loading" id="choice_model"> | |||
| <input type="hidden" id="ModelId" name="ModelId" required> | |||
| <input type="hidden" id="ModelName" name="ModelName" required> | |||
| <div class="default text">选择模型</div> | |||
| <i class="dropdown icon"></i> | |||
| <div class="menu" id="model-name"> | |||
| @@ -140,6 +140,7 @@ | |||
| </div> | |||
| <div class="unite min_title inline field required"> | |||
| <label>原模型框架</label> | |||
| <span> </span> | |||
| <div class="ui dropdown selection search width70" id="choice_engine"> | |||
| <input type="hidden" id="SrcEngine" name="SrcEngine" required> | |||
| <div class="default text">选择原模型框架</div> | |||
| @@ -198,25 +199,24 @@ | |||
| let repoId = {{$repository}} | |||
| const {_AppSubUrl, _StaticUrlPrefix, csrf} = window.config; | |||
| $('input[name="_csrf"]').val(csrf) | |||
| var modelData; | |||
| function createModelName(){ | |||
| let repoName = location.pathname.split('/')[2] | |||
| let modelName = repoName + '_model_' + Math.random().toString(36).substr(2, 4) | |||
| let modelName = repoName + '_modelConvert_' + Math.random().toString(36).substr(2, 4) | |||
| $('#name').val(modelName) | |||
| $('#version').val("0.0.1") | |||
| } | |||
| function showcreate(obj){ | |||
| $('.ui.modal.second') | |||
| .modal({ | |||
| centered: false, | |||
| onShow:function(){ | |||
| $('#model_header').text("导入新模型") | |||
| $('#model_header').text("创建模型转换任务") | |||
| $('input[name="Version"]').addClass('model_disabled') | |||
| $('.ui.dimmer').css({"background-color":"rgb(136, 136, 136,0.7)"}) | |||
| $("#job-name").empty() | |||
| createModelName() | |||
| loadTrainList() | |||
| loadModelList() | |||
| }, | |||
| onHide:function(){ | |||
| document.getElementById("formId").reset(); | |||
| @@ -236,50 +236,43 @@ | |||
| onChange:function(value){ | |||
| $(".ui.dropdown.selection.search.width70").addClass("loading") | |||
| $('#choice_version').dropdown('clear') | |||
| $("#job-version").empty() | |||
| $("#model-version").empty() | |||
| loadTrainVersion(value) | |||
| } | |||
| }) | |||
| }) | |||
| function loadTrainList(){ | |||
| $.get(`${repolink}/modelmanage/query_train_job?repoId=${repoId}`, (data) => { | |||
| const n_length = data.length | |||
| function loadModelList(){ | |||
| $.get(`${repolink}/modelmanage/query_model_for_predict?repoId=${repoId}`, (data) => { | |||
| modelData = data | |||
| let nameList = data.nameList | |||
| const n_length = nameList.length | |||
| let train_html='' | |||
| for (let i=0;i<n_length;i++){ | |||
| train_html += `<div class="item" data-value="${data[i].JobID}">${data[i].DisplayJobName}</div>` | |||
| train_html += `<div class="item" data-value="${nameList[i]}">${nameList[i]}</div>` | |||
| train_html += '</div>' | |||
| } | |||
| $("#job-name").append(train_html) | |||
| $("#model-name").append(train_html) | |||
| $(".ui.dropdown.selection.search.width83").removeClass("loading") | |||
| $('#choice_model .default.text').text(data[0].DisplayJobName) | |||
| $('#choice_model input[name="JobId"]').val(data[0].JobID) | |||
| loadTrainVersion() | |||
| $('#choice_model .default.text').text(nameList[0]) | |||
| $('#choice_model input[name="ModelName"]').val(nameList[0]) | |||
| }) | |||
| } | |||
| function loadTrainVersion(value){ | |||
| let JobID = !value ?$('#choice_model input[name="JobId"]').val(): value | |||
| $.get(`${repolink}/modelmanage/query_train_job_version?JobID=${JobID}`, (data) => { | |||
| const n_length = data.length | |||
| let train_html='' | |||
| for (let i=0;i<n_length;i++){ | |||
| train_html += `<div class="item" data-value="${data[i].VersionName}">${data[i].VersionName}</div>` | |||
| let nameMap = modelData.nameMap | |||
| let versionList = nameMap[value] | |||
| n_length = versionList.length | |||
| let train_html='' | |||
| for (let i=0;i<n_length;i++){ | |||
| train_html += `<div class="item" data-value="${versionList[i]}">${versionList[i]}</div>` | |||
| train_html += '</div>' | |||
| } | |||
| if(data.length){ | |||
| $("#job-version").append(train_html) | |||
| $(".ui.dropdown.selection.search.width70").removeClass("loading") | |||
| var versionName = data[0].VersionName; | |||
| if(versionName==null || versionName==""){ | |||
| versionName="V0001"; | |||
| } | |||
| $('#choice_version .default.text').text(versionName) | |||
| $('#choice_version input[name="VersionName"]').val(versionName) | |||
| } | |||
| }) | |||
| } | |||
| $("#model-version").append(train_html) | |||
| $(".ui.dropdown.selection.search.width70").removeClass("loading") | |||
| $('#choice_version .default.text').text(versionList[0]) | |||
| } | |||
| </script> | |||