From b20b688b08494ddb89c53a3320da2a7cfe41eda4 Mon Sep 17 00:00:00 2001 From: ychao_1983 Date: Mon, 24 Jul 2023 15:38:53 +0800 Subject: [PATCH 01/67] =?UTF-8?q?=E4=BA=91=E8=84=911=E7=9A=84=E7=94=A8?= =?UTF-8?q?=E6=88=B7=E7=82=B9=E5=87=BB=E9=82=AE=E7=AE=B1=E6=89=BE=E5=9B=9E?= =?UTF-8?q?=E5=AF=86=E7=A0=81=E6=8A=A5=E9=94=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- models/user.go | 3 +++ routers/admin/cloudbrains.go | 2 +- routers/user/auth.go | 12 +++++++++--- 3 files changed, 13 insertions(+), 4 deletions(-) diff --git a/models/user.go b/models/user.go index d34860f2d9..09febc56a9 100755 --- a/models/user.go +++ b/models/user.go @@ -328,6 +328,9 @@ func (u *User) IsLocal() bool { func (u *User) IsOAuth2() bool { return u.LoginType == LoginOAuth2 } +func (u *User) IsCloudBrain() bool { + return u.LoginType == LoginCloudBrain +} // HasForkedRepo checks if user has already forked a repository with given ID. func (u *User) HasForkedRepo(repoID int64) bool { diff --git a/routers/admin/cloudbrains.go b/routers/admin/cloudbrains.go index 7713edf708..bc2b820ecd 100755 --- a/routers/admin/cloudbrains.go +++ b/routers/admin/cloudbrains.go @@ -233,7 +233,7 @@ func getRepoPathName(rs *models.CloudbrainInfo) string { } func getDurationTime(rs *models.CloudbrainInfo) string { - if rs.JobType == "TRAIN" || rs.JobType == "INFERENCE" { + if rs.JobType == "TRAIN" || rs.JobType == "INFERENCE" || rs.JobType == string(models.JobTypeSuperCompute) { return rs.TrainJobDuration } else { return "-" diff --git a/routers/user/auth.go b/routers/user/auth.go index ddd11f2103..12ccf604c1 100755 --- a/routers/user/auth.go +++ b/routers/user/auth.go @@ -1691,7 +1691,7 @@ func ForgotPasswdPost(ctx *context.Context) { return } - if !u.IsLocal() && !u.IsOAuth2() { + if !u.IsLocal() && !u.IsOAuth2() && !u.IsCloudBrain() { ctx.Data["Err_Email"] = true ctx.RenderWithErr(ctx.Tr("auth.non_local_account"), tplForgotPassword, nil) return @@ -1841,7 +1841,10 @@ func ResetPasswdPost(ctx *context.Context) { } u.HashPassword(passwd) u.MustChangePassword = false - if err := models.UpdateUserCols(u, "must_change_password", "passwd", "rands", "salt"); err != nil { + if u.LoginType == models.LoginCloudBrain { + u.LoginType = models.LoginNoType + } + if err := models.UpdateUserCols(u, "must_change_password", "passwd", "rands", "salt", "login_type"); err != nil { ctx.ServerError("UpdateUser", err) return } @@ -1911,7 +1914,10 @@ func ResetPasswdByPhonePost(ctx *context.Context, form auth.ResetPassWordByPhone } u.HashPassword(passwd) u.MustChangePassword = false - if err := models.UpdateUserCols(u, "must_change_password", "passwd", "rands", "salt"); err != nil { + if u.LoginType == models.LoginCloudBrain { + u.LoginType = models.LoginNoType + } + if err := models.UpdateUserCols(u, "must_change_password", "passwd", "rands", "salt", "login_type"); err != nil { ctx.ServerError("UpdateUser", err) return } -- 2.34.1 From 5932dc3a1fcd2624efd03485b2bb6eb9e1956db7 Mon Sep 17 00:00:00 2001 From: ychao_1983 Date: Mon, 24 Jul 2023 16:15:01 +0800 Subject: [PATCH 02/67] =?UTF-8?q?=E6=8F=90=E4=BA=A4=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- models/repo_unit.go | 12 ++++++++++++ models/unit.go | 1 + modules/auth/repo_form.go | 1 + routers/repo/setting.go | 12 ++++++++++++ 4 files changed, 26 insertions(+) diff --git a/models/repo_unit.go b/models/repo_unit.go index 5f118029fe..7f68c3e1f4 100755 --- a/models/repo_unit.go +++ b/models/repo_unit.go @@ -135,6 +135,18 @@ type ModelManageConfig struct { EnableModelManage bool } +type HPCConfig struct { + EnableHPC bool +} + +func (cfg *HPCConfig) FromDB(bs []byte) error { + return json.Unmarshal(bs, &cfg) +} + +func (cfg *HPCConfig) ToDB() ([]byte, error) { + return json.Marshal(cfg) +} + // FromDB fills up a CloudBrainConfig from serialized format. func (cfg *ModelManageConfig) FromDB(bs []byte) error { return json.Unmarshal(bs, &cfg) diff --git a/models/unit.go b/models/unit.go index 3814913885..48b9fedb12 100755 --- a/models/unit.go +++ b/models/unit.go @@ -28,6 +28,7 @@ const ( UnitTypeCloudBrain UnitType = 11 // 11 CloudBrain UnitTypeBlockChain UnitType = 12 // 12 BlockChain UnitTypeModelManage UnitType = 13 // 13 ModelManage + UnitTypeHPC UnitType = 14 // 14 HPC ) // Value returns integer value for unit type diff --git a/modules/auth/repo_form.go b/modules/auth/repo_form.go index 9ea5da879c..23f5f6c88d 100755 --- a/modules/auth/repo_form.go +++ b/modules/auth/repo_form.go @@ -127,6 +127,7 @@ type RepoSettingForm struct { EnableDataset bool EnableCloudBrain bool EnableModelManager bool + EnableHPC bool EnableWiki bool EnableExternalWiki bool ExternalWikiURL string diff --git a/routers/repo/setting.go b/routers/repo/setting.go index f392f8f090..6ac7d69fa1 100644 --- a/routers/repo/setting.go +++ b/routers/repo/setting.go @@ -272,6 +272,18 @@ func SettingsPost(ctx *context.Context, form auth.RepoSettingForm) { deleteUnitTypes = append(deleteUnitTypes, models.UnitTypeCloudBrain) } + if form.EnableHPC && !models.UnitTypeHPC.UnitGlobalDisabled() { + units = append(units, models.RepoUnit{ + RepoID: repo.ID, + Type: models.UnitTypeHPC, + Config: &models.HPCConfig{ + EnableHPC: form.EnableHPC, + }, + }) + } else if !models.UnitTypeCloudBrain.UnitGlobalDisabled() { + deleteUnitTypes = append(deleteUnitTypes, models.UnitTypeCloudBrain) + } + if form.EnableModelManager && !models.UnitTypeModelManage.UnitGlobalDisabled() { units = append(units, models.RepoUnit{ RepoID: repo.ID, -- 2.34.1 From 6715bafb16a2e17f99c8f2b0b3ebb868f14e834a Mon Sep 17 00:00:00 2001 From: chenshihai Date: Tue, 25 Jul 2023 10:07:43 +0800 Subject: [PATCH 03/67] update website registration information --- templates/base/footer_content.tmpl | 1 + templates/base/footer_content_fluid.tmpl | 1 + 2 files changed, 2 insertions(+) diff --git a/templates/base/footer_content.tmpl b/templates/base/footer_content.tmpl index f7f18316cf..a6efb2d6e4 100755 --- a/templates/base/footer_content.tmpl +++ b/templates/base/footer_content.tmpl @@ -91,6 +91,7 @@
{{.i18n.Tr "custom.foot.copyright"}} 京ICP备18004880号 + 京公网安备 11010802042693号
{{.i18n.Tr "home.powerdby"}}Trustie确实{{.i18n.Tr "、Gitea"}}
diff --git a/templates/base/footer_content_fluid.tmpl b/templates/base/footer_content_fluid.tmpl index 3edd949f82..884b84e643 100755 --- a/templates/base/footer_content_fluid.tmpl +++ b/templates/base/footer_content_fluid.tmpl @@ -61,6 +61,7 @@
{{.i18n.Tr "custom.foot.copyright"}} 京ICP备18004880号 + 京公网安备 11010802042693号
{{.i18n.Tr "Powered_by 鹏城实验室云脑、"}}Trustie确实{{.i18n.Tr "、gitea"}}
-- 2.34.1 From 39904421a4bc54bd1690e6a10ffb084258dc0d83 Mon Sep 17 00:00:00 2001 From: zouap Date: Tue, 25 Jul 2023 15:52:14 +0800 Subject: [PATCH 04/67] =?UTF-8?q?=E6=95=B0=E6=8D=AE=E9=9B=86=E4=B8=8B?= =?UTF-8?q?=E8=BD=BD=E5=8F=8A=E6=96=87=E5=BF=83=E7=94=9F=E5=9B=BE=E7=9B=B8?= =?UTF-8?q?=E5=85=B3=E5=8A=9F=E8=83=BD=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: zouap --- models/ai_model_manage.go | 1 + models/attachment.go | 3 ++- modules/modelappservice/modelsevice.go | 2 +- modules/storage/minio.go | 2 +- routers/repo/ai_model_manage.go | 4 ++++ 5 files changed, 9 insertions(+), 3 deletions(-) diff --git a/models/ai_model_manage.go b/models/ai_model_manage.go index d9d3c8fa95..0a40347a92 100644 --- a/models/ai_model_manage.go +++ b/models/ai_model_manage.go @@ -56,6 +56,7 @@ type AiModelManage struct { OnlineInfo []map[string]interface{} `xorm:"-" json:"onlineInfo"` UsedCloudbrain []map[string]interface{} `xorm:"-" json:"usedCloudbrain"` HasOnlineUrl int `xorm:"NOT NULL DEFAULT 0" json:"hasOnlineUrl"` + License string `xorm:"NULL" json:"license"` } type AiModelFile struct { diff --git a/models/attachment.go b/models/attachment.go index 2239e03d12..dda632d2ed 100755 --- a/models/attachment.go +++ b/models/attachment.go @@ -125,7 +125,8 @@ func (a *Attachment) APIFormat() *api.Attachment { // DownloadURL returns the download url of the attached file func (a *Attachment) DownloadURL() string { - return fmt.Sprintf("%sattachments/%s?type=%d", setting.AppURL, a.UUID, a.Type) + return a.S3DownloadURL() + //fmt.Sprintf("%sattachments/%s?type=%d", setting.AppURL, a.UUID, a.Type) } // S3DownloadURL returns the s3 download url of the attached file diff --git a/modules/modelappservice/modelsevice.go b/modules/modelappservice/modelsevice.go index 34030073ce..8b90be3499 100644 --- a/modules/modelappservice/modelsevice.go +++ b/modules/modelappservice/modelsevice.go @@ -31,7 +31,7 @@ func ProducerOrder(modelApp *models.ModelApp) { func GetWaitTime() int { dvid := setting.BaiduWenXin.MODEL_SERVERS - return ((len(wenxinChannel) / dvid) + 1) * 15 + return ((len(wenxinChannel) / dvid) + 1) * 30 } func consumerOrder(in <-chan *models.ModelApp, url string) { diff --git a/modules/storage/minio.go b/modules/storage/minio.go index 6249cd82c3..b671fa3130 100755 --- a/modules/storage/minio.go +++ b/modules/storage/minio.go @@ -22,7 +22,7 @@ var ( ) const ( - PresignedGetUrlExpireTime = time.Hour * 24 * 7 + PresignedGetUrlExpireTime = time.Hour * 24 * 1 PresignedPutUrlExpireTime = time.Hour * 24 * 7 ) diff --git a/routers/repo/ai_model_manage.go b/routers/repo/ai_model_manage.go index b3d22f4e5d..5e5270aec1 100644 --- a/routers/repo/ai_model_manage.go +++ b/routers/repo/ai_model_manage.go @@ -87,6 +87,7 @@ func saveModelByParameters(aiTask *models.Cloudbrain, name string, version strin aiTask.ContainerIp = "" aiTaskJson, _ := json.Marshal(aiTask) isPrivate := ctx.QueryBool("isPrivate") + license := ctx.Query("license") model := &models.AiModelManage{ ID: id, Version: version, @@ -109,6 +110,7 @@ func saveModelByParameters(aiTask *models.Cloudbrain, name string, version strin Status: STATUS_COPY_MODEL, IsPrivate: isPrivate, ComputeResource: aiTask.ComputeResource, + License: license, } err = models.SaveModelToDb(model) @@ -278,6 +280,7 @@ func SaveLocalModel(ctx *context.Context) { } } } + license := ctx.Query("license") model := &models.AiModelManage{ ID: id, Version: version, @@ -299,6 +302,7 @@ func SaveLocalModel(ctx *context.Context) { Status: STATUS_FINISHED, IsPrivate: isPrivate, ComputeResource: computeResource, + License: license, } err := models.SaveModelToDb(model) -- 2.34.1 From 46839bcbd41e99bf52d862bdbcbe9b8fc6d7e9ac Mon Sep 17 00:00:00 2001 From: zouap Date: Tue, 25 Jul 2023 16:22:12 +0800 Subject: [PATCH 05/67] =?UTF-8?q?=E8=BF=98=E5=8E=9F=E4=BB=A3=E7=A0=81?= =?UTF-8?q?=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: zouap --- models/attachment.go | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/models/attachment.go b/models/attachment.go index dda632d2ed..2239e03d12 100755 --- a/models/attachment.go +++ b/models/attachment.go @@ -125,8 +125,7 @@ func (a *Attachment) APIFormat() *api.Attachment { // DownloadURL returns the download url of the attached file func (a *Attachment) DownloadURL() string { - return a.S3DownloadURL() - //fmt.Sprintf("%sattachments/%s?type=%d", setting.AppURL, a.UUID, a.Type) + return fmt.Sprintf("%sattachments/%s?type=%d", setting.AppURL, a.UUID, a.Type) } // S3DownloadURL returns the s3 download url of the attached file -- 2.34.1 From 4a12494fc1fd274e2670b3dba79246eadd5fc87c Mon Sep 17 00:00:00 2001 From: chenshihai Date: Tue, 25 Jul 2023 16:27:52 +0800 Subject: [PATCH 06/67] update dataset download link copy action --- templates/repo/datasets/index.tmpl | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/templates/repo/datasets/index.tmpl b/templates/repo/datasets/index.tmpl index 2a7db4d9cc..14108351fb 100755 --- a/templates/repo/datasets/index.tmpl +++ b/templates/repo/datasets/index.tmpl @@ -360,8 +360,10 @@ {{$.i18n.Tr "repo.more"}} - {{$.i18n.Tr "dataset.copy_url"}} - + {{ if $.IsSigned }} + {{$.i18n.Tr "dataset.copy_url"}} + + {{ end }} {{if and ($.CanWrite) (eq .DecompressState 1) }} {{$.i18n.Tr "dataset.annotation"}} -- 2.34.1 From 09610b4a39cdd9add21b1de48033e893abb270bf Mon Sep 17 00:00:00 2001 From: zouap Date: Tue, 25 Jul 2023 17:16:05 +0800 Subject: [PATCH 07/67] =?UTF-8?q?=E5=8D=8F=E8=AE=AE=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: zouap --- models/ai_model_manage.go | 5 +++-- routers/repo/ai_model_manage.go | 5 +++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/models/ai_model_manage.go b/models/ai_model_manage.go index 0a40347a92..829605004c 100644 --- a/models/ai_model_manage.go +++ b/models/ai_model_manage.go @@ -396,16 +396,17 @@ func ModifyModelCollectedNum(id string, collectedNum int) error { return nil } -func ModifyLocalModel(id string, name, label, description string, engine int, isPrivate bool) error { +func ModifyLocalModel(id string, name, label, description string, engine int, isPrivate bool, license string) error { var sess *xorm.Session sess = x.ID(id) defer sess.Close() - re, err := sess.Cols("name", "label", "description", "engine", "is_private").Update(&AiModelManage{ + re, err := sess.Cols("name", "label", "description", "engine", "is_private", "license").Update(&AiModelManage{ Description: description, Name: name, Label: label, Engine: int64(engine), IsPrivate: isPrivate, + License: license, }) if err != nil { return err diff --git a/routers/repo/ai_model_manage.go b/routers/repo/ai_model_manage.go index 5e5270aec1..d3880d2f4f 100644 --- a/routers/repo/ai_model_manage.go +++ b/routers/repo/ai_model_manage.go @@ -1289,6 +1289,7 @@ func ModifyModelInfo(ctx *context.Context) { description := ctx.Query("description") engine := ctx.QueryInt("engine") isPrivate := ctx.QueryBool("isPrivate") + license := ctx.Query("license") aimodels := models.QueryModelByName(name, task.RepoId) if aimodels != nil && len(aimodels) > 0 { if len(aimodels) == 1 { @@ -1303,12 +1304,12 @@ func ModifyModelInfo(ctx *context.Context) { return } } - err = models.ModifyLocalModel(id, name, label, description, engine, isPrivate) + err = models.ModifyLocalModel(id, name, label, description, engine, isPrivate, license) if task.Name != name { aimodels = models.QueryModelByName(task.Name, task.RepoId) if aimodels != nil && len(aimodels) > 0 { for _, model := range aimodels { - models.ModifyLocalModel(model.ID, name, model.Label, model.Description, int(model.Engine), model.IsPrivate) + models.ModifyLocalModel(model.ID, name, model.Label, model.Description, int(model.Engine), model.IsPrivate, model.License) } } } -- 2.34.1 From aad73d333f006733740c7325d7035d7f33b5f0c9 Mon Sep 17 00:00:00 2001 From: chenshihai Date: Tue, 25 Jul 2023 17:51:54 +0800 Subject: [PATCH 08/67] add model license --- options/locale/locale_en-US.ini | 2 + options/locale/locale_zh-CN.ini | 2 + templates/repo/datasets/index.tmpl | 14 +- templates/repo/modelmanage/create_online.tmpl | 41 ++++++ web_src/vuepages/apis/modules/modelmanage.js | 10 +- .../cloudbrain/details/ExportModel.vue | 28 ++++ web_src/vuepages/langs/config/en-US.js | 2 + web_src/vuepages/langs/config/zh-CN.js | 2 + .../pages/modelmanage/intro/index.vue | 122 +++++++++++------- .../pages/modelmanage/local/index.vue | 35 ++++- .../pages/modelmanage/settings/index.vue | 30 ++++- 11 files changed, 225 insertions(+), 63 deletions(-) diff --git a/options/locale/locale_en-US.ini b/options/locale/locale_en-US.ini index a4b94550a4..4a213c44d1 100755 --- a/options/locale/locale_en-US.ini +++ b/options/locale/locale_en-US.ini @@ -1345,6 +1345,8 @@ model.manage.engine=Model engine model.manage.select.engine=Select model engine model.manage.modelfile=Model file model.manage.modellabel=Model label +model.manage.modellicense=License +model.manage.select.modellicense=Select license model.manage.modeldesc=Model brief introduction model.manage.modelaccess=Model Access model.manage.modelaccess.public=Public diff --git a/options/locale/locale_zh-CN.ini b/options/locale/locale_zh-CN.ini index aee37fa283..95e1b58cb7 100755 --- a/options/locale/locale_zh-CN.ini +++ b/options/locale/locale_zh-CN.ini @@ -1358,6 +1358,8 @@ model.manage.engine=模型框架 model.manage.select.engine=选择模型框架 model.manage.modelfile=模型文件 model.manage.modellabel=模型标签 +model.manage.modellicense=许可证 +model.manage.select.modellicense=选择许可证 model.manage.modeldesc=模型简介 model.manage.modelaccess=模型权限 model.manage.modelaccess.public=公开 diff --git a/templates/repo/datasets/index.tmpl b/templates/repo/datasets/index.tmpl index 14108351fb..21eb84f430 100755 --- a/templates/repo/datasets/index.tmpl +++ b/templates/repo/datasets/index.tmpl @@ -353,17 +353,16 @@ {{$.i18n.Tr "dataset.set_private"}} - {{end}} + {{end}} + {{ if $.IsSigned }} {{$.i18n.Tr "repo.more"}} - - {{ if $.IsSigned }} - {{$.i18n.Tr "dataset.copy_url"}} - - {{ end }} + + {{$.i18n.Tr "dataset.copy_url"}} + {{if and ($.CanWrite) (eq .DecompressState 1) }} {{$.i18n.Tr "dataset.annotation"}} @@ -378,7 +377,8 @@ {{end}} - + + {{ end }}
diff --git a/templates/repo/modelmanage/create_online.tmpl b/templates/repo/modelmanage/create_online.tmpl index 1b5adbc17f..f1c09306a6 100644 --- a/templates/repo/modelmanage/create_online.tmpl +++ b/templates/repo/modelmanage/create_online.tmpl @@ -126,6 +126,19 @@
    + +
    +
    + +
    +
    @@ -298,6 +311,7 @@ $("#job-name").empty() createModelName() loadTrainList() + initLicense() $(function () { $('#choice_model').dropdown({ @@ -522,6 +536,33 @@ } } + function initLicense() { + $('#choice_License').dropdown('clear') + $('#choice_License').dropdown({ clearable: true }) + $("#job-license").empty() + $.get(`/dashboard/invitation?filename=model/license.json`, (data) => { + try { + const license = JSON.parse(data) || []; + let itemHtml = ''; + for (let i = 0, iLen = license.length; i < iLen; i++) { + const item = license[i]; + if (i == 0) { + itemHtml = itemHtml + ''; + } else { + itemHtml = itemHtml + ''; + } + } + if (license.length) { + $('#choice_License .default.text').text(license[0].name); + $('#choice_License input[name="license"]').val(license[0].id) + $("#job-license").append(itemHtml); + } + } catch(err) { + console.log(err); + } + }); + } + function check() { let jobid = document.getElementById("jobId").value; let versionname = document.getElementById("versionName").value; diff --git a/web_src/vuepages/apis/modules/modelmanage.js b/web_src/vuepages/apis/modules/modelmanage.js index cae448190c..afcc577e32 100644 --- a/web_src/vuepages/apis/modules/modelmanage.js +++ b/web_src/vuepages/apis/modules/modelmanage.js @@ -1,6 +1,5 @@ import service from "../service"; import Qs from 'qs'; -import { param } from "jquery"; // 保存本地模型 export const saveLocalModel = (data) => { @@ -163,3 +162,12 @@ export const getModelEvolutionMap = (params) => { params: { id: params.id }, }); } + +// 获取平台模型许可证列表 +export const getModelLicenseList = () => { + return service({ + url: `/dashboard/invitation`, + method: 'get', + params: { filename: 'model/license.json' }, + }); +} diff --git a/web_src/vuepages/components/cloudbrain/details/ExportModel.vue b/web_src/vuepages/components/cloudbrain/details/ExportModel.vue index d57bf0cd62..832e8643f7 100644 --- a/web_src/vuepages/components/cloudbrain/details/ExportModel.vue +++ b/web_src/vuepages/components/cloudbrain/details/ExportModel.vue @@ -66,6 +66,16 @@
    +
    +
    +
    + + + + +
    +
    @@ -106,6 +116,7 @@ import BaseDialog from '~/components/BaseDialog.vue'; import { MODEL_ENGINES } from '~/const'; import { getListValueWithKey } from '~/utils'; import { getAiTaskOutputResultAll, setAiTaskResultToModel } from '~/apis/modules/cloudbrain'; +import { getModelLicenseList } from '~/apis/modules/modelmanage'; const MAX_LABEL_COUNT = 5; const REPOISPRIVATE = window.REPO_IS_PRIVATE; @@ -130,9 +141,11 @@ export default { engine: '0', filesStr: '', label: '', + license: '', description: '', isPrivate: REPOISPRIVATE ? '1' : '0', }, + licenseList: [], nameErr: false, modelFileErr: false, modelFilesData: [], @@ -186,6 +199,7 @@ export default { engine_name: getListValueWithKey(MODEL_ENGINES, this.state.engine.toString()), modelSelectedFile: this.state.filesStr, label: this.state.label.split(/\s+/).join(' ').trim(), + license: this.state.license, isPrivate: (this.repoIsPrivate || this.state.isPrivate == 1) ? true : false, description: this.state.description, } @@ -293,6 +307,20 @@ export default { console.log(err); this.loading = false; }); + getModelLicenseList().then(res => { + res = res.data; + try { + const license = JSON.parse(res) || []; + this.licenseList = license; + if (license.length) { + this.state.license = license[0].id; + } + } catch (err) { + console.log(err); + } + }).catch(err => { + console.log(err); + }); }, closed() { }, }, diff --git a/web_src/vuepages/langs/config/en-US.js b/web_src/vuepages/langs/config/en-US.js index 210ec7cffb..b7eca85f26 100644 --- a/web_src/vuepages/langs/config/en-US.js +++ b/web_src/vuepages/langs/config/en-US.js @@ -257,6 +257,8 @@ const en = { modelManage: 'Model management', modelName: 'Model name', useCluster: 'Available clusters', + license: 'License', + selectLicense: 'Select license', local: 'Local', online: 'Online', createModel: 'Create Model', diff --git a/web_src/vuepages/langs/config/zh-CN.js b/web_src/vuepages/langs/config/zh-CN.js index 6cfeb423ce..33278817a6 100644 --- a/web_src/vuepages/langs/config/zh-CN.js +++ b/web_src/vuepages/langs/config/zh-CN.js @@ -273,6 +273,8 @@ const zh = { modelManage: '模型管理', modelName: '模型名称', useCluster: '可用集群', + license: '许可证', + selectLicense: '选择许可证', local: '本地', online: '线上', createModel: '创建模型', diff --git a/web_src/vuepages/pages/modelmanage/intro/index.vue b/web_src/vuepages/pages/modelmanage/intro/index.vue index a1fc71f433..d124f9bd9e 100644 --- a/web_src/vuepages/pages/modelmanage/intro/index.vue +++ b/web_src/vuepages/pages/modelmanage/intro/index.vue @@ -4,8 +4,8 @@
    - +
    @@ -85,6 +85,10 @@ {{ $t('modelManage.addLabels') }}
    +
    +
    {{ $t('modelManage.license') }}:
    + +
    {{ $t('modelManage.modelEngine') }}:
    {{ modelData.engineName }}
    @@ -116,34 +120,35 @@
    - +