Skip to content

Commit

Permalink
fix: model tips (#190)
Browse files Browse the repository at this point in the history
* fix: error tips

* fix: model tips

* fix: model run error tip

* fix: model run error

* fix: model detail error

* fix: model type filter
  • Loading branch information
Zjj614 authored Sep 28, 2023
1 parent 3ab115d commit aaa863d
Show file tree
Hide file tree
Showing 5 changed files with 79 additions and 27 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@
</el-select>
</el-col>
<el-col v-if="param.inputType === 'button'" :span="24">
<p class="tips">横向联邦需可信第三方(arbiter方)参与</p>
<p class="tips">{{ flText }}需可信第三方(arbiter方)参与</p>
<span v-if="arbiterOrganName" class="label-text"><i class="el-icon-office-building" /> {{ arbiterOrganName }}</span>
<el-button v-if="options.isEditable" type="primary" size="mini" class="block" @click="openProviderOrganDialog">请选择</el-button>
</el-col>
Expand Down Expand Up @@ -353,7 +353,8 @@ export default {
{ required: true, trigger: 'change' }
]
},
selectedProviderOrgans: []
selectedProviderOrgans: [],
flText: ''
}
},
computed: {
Expand Down Expand Up @@ -416,6 +417,8 @@ export default {
} else if (newVal.componentCode === MODEL) {
this.getDataSetComValue()
this.getModelParams(newVal)
this.flText = this.filterModelValue()
console.log(this.flText)
} else if (newVal.componentCode === DATA_ALIGN) {
this.getDataSetComValue()
this.getFeaturesOptions()
Expand Down Expand Up @@ -467,6 +470,13 @@ export default {
}
}
},
filterModelValue() {
if (this.modelTypeValue === '2' || this.modelTypeValue === '5' || this.modelTypeValue === '9') {
return '纵向联邦'
} else {
return '横向联邦'
}
},
getModelParams(data) {
const modelType = data.componentTypes.find(item => item.typeCode === MODEL_TYPE)
const currentData = modelType && modelType.inputValues.find(item => item.key === modelType.inputValue)
Expand All @@ -491,11 +501,15 @@ export default {
this.modelTypeValue = val
// reset before params
this.resetModelParams()
this.flText = this.filterModelValue()
console.log(this.flText)
this.handleChange()
},
handleParamChange(val) {
this.modelEncryptionType = val
this.getModelParams(this.nodeData)
this.flText = this.filterModelValue()
console.log(this.flText)
this.handleChange()
},
getFeaturesItem() {
Expand Down
43 changes: 27 additions & 16 deletions primihub-webconsole/src/components/TaskCanvas/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -684,17 +684,35 @@ export default {
const initiateCalculationField = initiateResource?.calculationField || []
const providerCalculationField = providerResource?.calculationField || []
const notSelectResource = value.find(item => item.resourceId === undefined)
const jointStatisticalCom = modelComponents.find(item => item.componentCode === MPC_STATISTICS)
if (jointStatisticalCom) {
if (value.find(item => item.resourceId === undefined)) {
this.$message.error('请选择数据集')
this.modelRunValidated = false
return
}
this.modelRunValidated = this.checkModelStatisticsValidated(jointStatisticalCom)
}
// LR features must select
if (initiateCalculationField && initiateCalculationField.length === 1 && initiateCalculationField.includes('y')) { // has Y
if (!initiateResource) {
this.$message({
message: '请选择发起方数据集',
type: 'error'
})
this.modelRunValidated = false
return
} else if (!providerResource) {
this.$message({
message: '请选择协作方数据集',
type: 'error'
})
this.modelRunValidated = false
return
} else if (notSelectResource && notSelectResource.participationIdentity === 1) {
this.$message.error('请选择发起方数据集')
this.modelRunValidated = false
return
} else if (notSelectResource && notSelectResource.participationIdentity === 2) {
this.$message.error('请选择协作方数据集')
this.modelRunValidated = false
return
} else if (initiateCalculationField && initiateCalculationField.length === 1 && initiateCalculationField.includes('y')) { // has Y
this.$message.error('请选择发起方数据特征')
this.modelRunValidated = false
return
Expand All @@ -709,7 +727,7 @@ export default {
}
// check start node target component is't dataSet
const line = modelPointComponents.find(item => item.input.cell === startCom.frontComponentId)
if (line.output.cell !== dataSetCom.frontComponentId) {
if (line && line.output.cell !== dataSetCom.frontComponentId) {
this.$message({
message: '流程错误:请先选择数据集组件',
type: 'error'
Expand All @@ -726,7 +744,7 @@ export default {
this.modelRunValidated = false
return
}
if (initiateResource.organId === arbiterOrganId || providerResource.organId === arbiterOrganId) {
if (initiateResource && initiateResource.organId === arbiterOrganId || providerResource && providerResource.organId === arbiterOrganId) {
this.$message({
message: '请选择正确的可信第三方(arbiter方)',
type: 'error'
Expand Down Expand Up @@ -772,13 +790,6 @@ export default {
type: 'error'
})
this.modelRunValidated = false
} else if (!(initiateResource && providerResource)) {
const msg = !initiateResource ? '请选择发起方数据集' : !providerResource ? '请选择协作方数据集' : '请选择数据集'
this.$message({
message: msg,
type: 'error'
})
this.modelRunValidated = false
}
},
async run() {
Expand Down
10 changes: 5 additions & 5 deletions primihub-webconsole/src/components/TaskModel/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -78,23 +78,23 @@
</template>
</el-table>
</div>
<div v-if="hasModelSelectComponent && chartData.length > 0" class="section">
<!-- <div v-if="hasModelSelectComponent && chartData.length > 0" class="section">
<h3>模型评估视图</h3>
<modelScoreChart :chart-data="chartData" width="500px" height="400px" />
</div>
</div> -->

</div>
</template>

<script>
import { getModelDetail, deleteModel, updateModelDesc } from '@/api/model'
import EditInput from '@/components/editInput'
import modelScoreChart from '@/components/Charts/ModelScoreChart'
// import modelScoreChart from '@/components/Charts/ModelScoreChart'
export default {
components: {
EditInput,
modelScoreChart
EditInput
// modelScoreChart
},
filters: {
quotaTypeFilter(type) {
Expand Down
10 changes: 6 additions & 4 deletions primihub-webconsole/src/filters/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -97,11 +97,13 @@ const authStatusFilter = (status) => {
const modelTypeFilter = (type) => {
const typeMap = {
2: '纵向-XGBoost',
3: '横向-LR',
4: 'MPC-LR',
5: '纵向-LR',
3: '横向-逻辑回归',
4: 'MPC-逻辑回归',
5: '纵向-逻辑回归',
6: '横向-NN(分类)',
7: '横向-NN(回归)'
7: '横向-NN(回归)',
8: '横向-线性回归',
9: '纵向-线性回归'
}
return typeMap[type]
}
Expand Down
25 changes: 25 additions & 0 deletions primihub-webconsole/src/router/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,31 @@ export const asyncRoutes = [
}
]
},
{
path: '/model',
component: Layout,
name: 'Model',
redirect: '/model/list',
meta: { title: '模型管理', icon: 'el-icon-files' },
children: [
{
path: 'list',
name: 'ModelList',
component: () => import('@/views/model/list'),
meta: { title: '模型管理', breadcrumb: false }
},
{
path: 'detail/:id',
name: 'ModelDetail',
meta: {
title: '模型详情',
activeMenu: '/model/list'
},
hidden: true,
component: () => import('@/views/model/detail')
}
]
},
{
path: '/reasoning',
component: Layout,
Expand Down

0 comments on commit aaa863d

Please sign in to comment.