mirror of
https://github.com/1Panel-dev/MaxKB.git
synced 2025-12-26 01:33:05 +00:00
perf: 优化专业版限制提示
This commit is contained in:
parent
9561961d0f
commit
45bf3477d1
|
|
@ -67,7 +67,7 @@
|
|||
<el-button @click.prevent="dialogVisible = false" :loading="loading">
|
||||
{{ $t('views.application.applicationForm.buttons.cancel') }}
|
||||
</el-button>
|
||||
<el-button type="primary" @click="submitValid(applicationFormRef)" :loading="loading">
|
||||
<el-button type="primary" @click="submitHandle(applicationFormRef)" :loading="loading">
|
||||
{{ $t('views.application.applicationForm.buttons.create') }}
|
||||
</el-button>
|
||||
</span>
|
||||
|
|
@ -177,7 +177,8 @@ watch(dialogVisible, (bool) => {
|
|||
},
|
||||
model_params_setting: {},
|
||||
problem_optimization: false,
|
||||
problem_optimization_prompt: '',
|
||||
problem_optimization_prompt:
|
||||
'()里面是用户问题,根据上下文回答揣测用户问题({question}) 要求: 输出一个补全问题,并且放在<data></data>标签中',
|
||||
stt_model_id: '',
|
||||
tts_model_id: '',
|
||||
stt_model_enable: false,
|
||||
|
|
@ -193,21 +194,6 @@ const open = () => {
|
|||
dialogVisible.value = true
|
||||
}
|
||||
|
||||
const submitValid = (formEl: FormInstance | undefined) => {
|
||||
if (user.isEnterprise()) {
|
||||
submitHandle(formEl)
|
||||
} else {
|
||||
common
|
||||
.asyncGetValid(ValidType.Application, ValidCount.Application, loading)
|
||||
.then(async (res: any) => {
|
||||
if (res?.data) {
|
||||
submitHandle(formEl)
|
||||
} else {
|
||||
MsgAlert('提示', '社区版最多支持 5 个应用,如需拥有更多应用,请升级为专业版。')
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
const submitHandle = async (formEl: FormInstance | undefined) => {
|
||||
if (!formEl) return
|
||||
await formEl.validate((valid) => {
|
||||
|
|
|
|||
|
|
@ -131,9 +131,11 @@ import { MsgSuccess, MsgConfirm } from '@/utils/message'
|
|||
import { isAppIcon } from '@/utils/application'
|
||||
import { useRouter } from 'vue-router'
|
||||
import { isWorkFlow } from '@/utils/application'
|
||||
import useStore from '@/stores'
|
||||
import { ValidType, ValidCount } from '@/enums/common'
|
||||
import { t } from '@/locales'
|
||||
const { application, user } = useStore()
|
||||
import useStore from '@/stores'
|
||||
|
||||
const { application, user, common } = useStore()
|
||||
const router = useRouter()
|
||||
|
||||
const CopyApplicationDialogRef = ref()
|
||||
|
|
@ -168,7 +170,27 @@ function settingApplication(row: any) {
|
|||
}
|
||||
|
||||
function openCreateDialog() {
|
||||
CreateApplicationDialogRef.value.open()
|
||||
if (user.isEnterprise()) {
|
||||
CreateApplicationDialogRef.value.open()
|
||||
} else {
|
||||
MsgConfirm(`提示`, '社区版最多支持 5 个应用,如需拥有更多应用,请升级为专业版。', {
|
||||
cancelButtonText: '确定',
|
||||
confirmButtonText: '购买专业版',
|
||||
confirmButtonClass: 'primary'
|
||||
})
|
||||
.then(() => {
|
||||
window.open('https://maxkb.cn/pricing.html', '_blank')
|
||||
})
|
||||
.catch(() => {
|
||||
common
|
||||
.asyncGetValid(ValidType.Application, ValidCount.Application, loading)
|
||||
.then(async (res: any) => {
|
||||
if (res?.data) {
|
||||
CreateApplicationDialogRef.value.open()
|
||||
}
|
||||
})
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
function searchHandle() {
|
||||
|
|
|
|||
|
|
@ -73,7 +73,7 @@
|
|||
<el-button @click.prevent="dialogVisible = false" :loading="loading">
|
||||
{{ $t('views.application.applicationForm.buttons.cancel') }}
|
||||
</el-button>
|
||||
<el-button type="primary" @click="submitValid" :loading="loading">
|
||||
<el-button type="primary" @click="submitHandle" :loading="loading">
|
||||
{{ $t('views.application.applicationForm.buttons.create') }}
|
||||
</el-button>
|
||||
</span>
|
||||
|
|
@ -124,19 +124,6 @@ const open = () => {
|
|||
dialogVisible.value = true
|
||||
}
|
||||
|
||||
const submitValid = () => {
|
||||
if (user.isEnterprise()) {
|
||||
submitHandle()
|
||||
} else {
|
||||
common.asyncGetValid(ValidType.Dataset, ValidCount.Dataset, loading).then(async (res: any) => {
|
||||
if (res?.data) {
|
||||
submitHandle()
|
||||
} else {
|
||||
MsgAlert('提示', '社区版最多支持 50 个知识库,如需拥有更多知识库,请升级为专业版。')
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
const submitHandle = async () => {
|
||||
if (await BaseFormRef.value?.validate()) {
|
||||
await DatasetFormRef.value.validate((valid: any) => {
|
||||
|
|
|
|||
|
|
@ -107,7 +107,7 @@
|
|||
</InfiniteScroll>
|
||||
</div>
|
||||
<SyncWebDialog ref="SyncWebDialogRef" @refresh="refresh" />
|
||||
<CreateDatasetDialog ref="CreateDatasetDialogRef"/>
|
||||
<CreateDatasetDialog ref="CreateDatasetDialogRef" />
|
||||
</div>
|
||||
</template>
|
||||
<script setup lang="ts">
|
||||
|
|
@ -118,6 +118,10 @@ import datasetApi from '@/api/dataset'
|
|||
import { MsgSuccess, MsgConfirm } from '@/utils/message'
|
||||
import { useRouter } from 'vue-router'
|
||||
import { numberFormat } from '@/utils/utils'
|
||||
import { ValidType, ValidCount } from '@/enums/common'
|
||||
import useStore from '@/stores'
|
||||
|
||||
const { user, common } = useStore()
|
||||
const router = useRouter()
|
||||
|
||||
const CreateDatasetDialogRef = ref()
|
||||
|
|
@ -133,7 +137,27 @@ const paginationConfig = reactive({
|
|||
const searchValue = ref('')
|
||||
|
||||
function openCreateDialog() {
|
||||
CreateDatasetDialogRef.value.open()
|
||||
if (user.isEnterprise()) {
|
||||
CreateDatasetDialogRef.value.open()
|
||||
} else {
|
||||
MsgConfirm(`提示`, '社区版最多支持 50 个知识库,如需拥有更多知识库,请升级为专业版。', {
|
||||
cancelButtonText: '确定',
|
||||
confirmButtonText: '购买专业版',
|
||||
confirmButtonClass: 'primary'
|
||||
})
|
||||
.then(() => {
|
||||
window.open('https://maxkb.cn/pricing.html', '_blank')
|
||||
})
|
||||
.catch(() => {
|
||||
common
|
||||
.asyncGetValid(ValidType.Dataset, ValidCount.Dataset, loading)
|
||||
.then(async (res: any) => {
|
||||
if (res?.data) {
|
||||
CreateDatasetDialogRef.value.open()
|
||||
}
|
||||
})
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
function refresh() {
|
||||
|
|
|
|||
|
|
@ -140,14 +140,22 @@ function createUser() {
|
|||
title.value = '创建用户'
|
||||
UserDialogRef.value.open()
|
||||
} else {
|
||||
common.asyncGetValid(ValidType.User, ValidCount.User, loading).then((res: any) => {
|
||||
if (res?.data) {
|
||||
title.value = '创建用户'
|
||||
UserDialogRef.value.open()
|
||||
} else {
|
||||
MsgAlert('提示', '社区版最多支持 2 个用户,如需拥有更多用户,请升级为专业版。')
|
||||
}
|
||||
MsgConfirm(`提示`, '社区版最多支持 2 个用户,如需拥有更多用户,请升级为专业版。', {
|
||||
cancelButtonText: '确定',
|
||||
confirmButtonText: '购买专业版',
|
||||
confirmButtonClass: 'primary'
|
||||
})
|
||||
.then(() => {
|
||||
window.open('https://maxkb.cn/pricing.html', '_blank')
|
||||
})
|
||||
.catch(() => {
|
||||
common.asyncGetValid(ValidType.User, ValidCount.User, loading).then(async (res: any) => {
|
||||
if (res?.data) {
|
||||
title.value = '创建用户'
|
||||
UserDialogRef.value.open()
|
||||
}
|
||||
})
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue