feat: tip
This commit is contained in:
parent
87415e96c8
commit
a16375781b
@ -32,7 +32,7 @@ const getFolder: (
|
||||
{
|
||||
"name": "string",
|
||||
"desc": "string",
|
||||
"parent_id": "root"
|
||||
"parent_id": "default"
|
||||
}
|
||||
*/
|
||||
const postFolder: (
|
||||
@ -64,7 +64,7 @@ const getFolderDetail: (
|
||||
{
|
||||
"name": "string",
|
||||
"desc": "string",
|
||||
"parent_id": "root"
|
||||
"parent_id": "default"
|
||||
}
|
||||
*/
|
||||
const putFolder: (
|
||||
|
||||
@ -1,9 +1,15 @@
|
||||
<template>
|
||||
<el-breadcrumb separator-icon="ArrowRight" style="line-height: 22px">
|
||||
<h2 v-if="breadcrumbData?.length === 1">{{ breadcrumbData[0]?.name }}</h2>
|
||||
<h2 v-if="breadcrumbData?.length === 1" class="ellipsis" :title="breadcrumbData[0]?.name">
|
||||
{{ breadcrumbData[0]?.name }}
|
||||
</h2>
|
||||
<el-breadcrumb-item v-for="(item, index) in breadcrumbData" :key="index" v-else>
|
||||
<h5 class="ml-4" v-if="index === breadcrumbData.length - 1">{{ item.name }}</h5>
|
||||
<el-button v-else link @click="handleClick(item)">{{ item.name }}</el-button>
|
||||
<h5 class="ml-4 ellipsis" v-if="index === breadcrumbData.length - 1" :title="item.name">
|
||||
{{ item.name }}
|
||||
</h5>
|
||||
<el-button v-else link @click="handleClick(item)" :title="item.name">
|
||||
<span class="ellipsis"> {{ item.name }}</span>
|
||||
</el-button>
|
||||
</el-breadcrumb-item>
|
||||
</el-breadcrumb>
|
||||
</template>
|
||||
|
||||
@ -64,6 +64,13 @@ export default {
|
||||
label: 'Selector',
|
||||
placeholder: 'Default is body, can input .classname/#idname/tagname',
|
||||
},
|
||||
file_count_limit: {
|
||||
label: 'Maximum number of files uploaded at once',
|
||||
},
|
||||
file_size_limit: {
|
||||
label: 'Maximum size of each document(MB)',
|
||||
placeholder: 'Suggest based on server configuration, otherwise may cause service shutdown',
|
||||
},
|
||||
},
|
||||
|
||||
ResultSuccess: {
|
||||
|
||||
@ -23,6 +23,9 @@ export default {
|
||||
nameMessage: '文件名称不能为空!',
|
||||
importMessage: '导入成功',
|
||||
migrationSuccess: '迁移成功',
|
||||
fileLimitCountTip1: '每次最多上传',
|
||||
fileLimitCountTip2: '个文件',
|
||||
fileLimitSizeTip1: '每个文件不超过',
|
||||
},
|
||||
upload: {
|
||||
selectFile: '选择文件',
|
||||
@ -30,10 +33,9 @@ export default {
|
||||
uploadMessage: '拖拽文件至此上传或',
|
||||
formats: '支持格式:',
|
||||
requiredMessage: '请上传文件',
|
||||
errorMessage1: '文件大小超过 100MB',
|
||||
errorMessage2: '文件格式不支持',
|
||||
errorMessage3: '文件不能为空',
|
||||
errorMessage4: '每次最多上传50个文件',
|
||||
// errorMessage4: '每次最多上传50个文件',
|
||||
template: '模版',
|
||||
download: '下载',
|
||||
},
|
||||
@ -42,20 +44,17 @@ export default {
|
||||
txt: {
|
||||
label: '文本文件',
|
||||
tip1: '1、文件上传前,建议规范文件的分段标识',
|
||||
tip2: '2、每次最多上传 50 个文件,每个文件不超过 100MB',
|
||||
},
|
||||
table: {
|
||||
label: '表格',
|
||||
tip1: '1、点击下载对应模版并完善信息:',
|
||||
tip2: '2、第一行必须是列标题,且列标题必须是有意义的术语,表中每条记录将作为一个分段',
|
||||
tip3: '3、上传的表格文件中每个 sheet 会作为一个文档,sheet名称为文档名称',
|
||||
tip4: '4、每次最多上传 50 个文件,每个文件不超过 100MB',
|
||||
},
|
||||
QA: {
|
||||
label: 'QA 问答对',
|
||||
tip1: '1、点击下载对应模版并完善信息',
|
||||
tip2: '2、上传的表格文件中每个 sheet 会作为一个文档,sheet名称为文档名称',
|
||||
tip3: '3、每次最多上传 50 个文件,每个文件不超过 100MB',
|
||||
},
|
||||
lark: {},
|
||||
},
|
||||
|
||||
@ -64,8 +64,13 @@ export default {
|
||||
label: '选择器',
|
||||
placeholder: '默认为 body,可输入 .classname/#idname/tagname',
|
||||
},
|
||||
|
||||
|
||||
file_count_limit: {
|
||||
label: '每次上传最多文件数',
|
||||
},
|
||||
file_size_limit: {
|
||||
label: '上传的每个文档最大(MB)',
|
||||
placeholder: '建议根据服务器配置调整,否则可能会造成服务宕机',
|
||||
},
|
||||
},
|
||||
|
||||
ResultSuccess: {
|
||||
|
||||
@ -58,6 +58,13 @@ export default {
|
||||
label: '選擇器',
|
||||
placeholder: '預設為 body,可輸入 .classname/#idname/tagname',
|
||||
},
|
||||
file_count_limit: {
|
||||
label: '每次上傳最多文件數',
|
||||
},
|
||||
file_size_limit: {
|
||||
label: '上傳的每個文件最大(MB)',
|
||||
placeholder: '建议根据服务器配置调整,否則會造成服務宕机',
|
||||
},
|
||||
},
|
||||
|
||||
ResultSuccess: {
|
||||
|
||||
@ -368,6 +368,7 @@ h5 {
|
||||
-webkit-box-orient: vertical;
|
||||
-webkit-line-clamp: 1;
|
||||
overflow: hidden;
|
||||
word-break: break-all;
|
||||
}
|
||||
|
||||
.break-all {
|
||||
|
||||
@ -210,3 +210,8 @@
|
||||
display: block;
|
||||
}
|
||||
}
|
||||
|
||||
// tooltip
|
||||
.auto-tooltip-popper {
|
||||
max-width: 500px;
|
||||
}
|
||||
|
||||
@ -145,15 +145,15 @@ 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(t('common.tip'), t('views.application.tip.professionalMessage'))
|
||||
// }
|
||||
// })
|
||||
common
|
||||
.asyncGetValid(ValidType.Application, ValidCount.Application, loading)
|
||||
.then(async (res: any) => {
|
||||
if (res?.data) {
|
||||
submitHandle(formEl)
|
||||
} else {
|
||||
MsgAlert(t('common.tip'), t('views.application.tip.professionalMessage'))
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
const submitHandle = async (formEl: FormInstance | undefined) => {
|
||||
|
||||
@ -5,13 +5,16 @@
|
||||
<folder-tree
|
||||
:source="SourceTypeEnum.APPLICATION"
|
||||
:data="folderList"
|
||||
:currentNodeKey="currentFolder?.id"
|
||||
:currentNodeKey="folder.currentFolder?.id"
|
||||
@handleNodeClick="folderClickHandel"
|
||||
@refreshTree="refreshFolder"
|
||||
class="p-8"
|
||||
/>
|
||||
</template>
|
||||
<ContentContainer :header="currentFolder?.name">
|
||||
<ContentContainer>
|
||||
<template #header>
|
||||
<FolderBreadcrumb :folderList="folderList" @click="folderClickHandel" />
|
||||
</template>
|
||||
<template #search>
|
||||
<div class="flex">
|
||||
<div class="flex-between complex-search">
|
||||
@ -43,13 +46,8 @@
|
||||
<el-option v-for="u in user_options" :key="u.id" :value="u.id" :label="u.username" />
|
||||
</el-select>
|
||||
</div>
|
||||
<el-dropdown trigger="click"
|
||||
v-if="permissionPrecise.create()"
|
||||
>
|
||||
<el-button
|
||||
type="primary"
|
||||
class="ml-8"
|
||||
>
|
||||
<el-dropdown trigger="click" v-if="permissionPrecise.create()">
|
||||
<el-button type="primary" class="ml-8">
|
||||
{{ $t('common.create') }}
|
||||
<el-icon class="el-icon--right">
|
||||
<arrow-down />
|
||||
@ -238,9 +236,7 @@
|
||||
<el-dropdown-item
|
||||
divided
|
||||
@click.stop="exportApplication(item)"
|
||||
v-if="
|
||||
permissionPrecise.export(item.id)
|
||||
"
|
||||
v-if="permissionPrecise.export(item.id)"
|
||||
>
|
||||
<AppIcon iconName="app-export"></AppIcon>
|
||||
{{ $t('common.export') }}
|
||||
@ -249,9 +245,7 @@
|
||||
divided
|
||||
icon="Delete"
|
||||
@click.stop="deleteApplication(item)"
|
||||
v-if="
|
||||
permissionPrecise.delete(item.id)
|
||||
"
|
||||
v-if="permissionPrecise.delete(item.id)"
|
||||
>{{ $t('common.delete') }}</el-dropdown-item
|
||||
>
|
||||
</el-dropdown-menu>
|
||||
@ -285,20 +279,20 @@ import { t } from '@/locales'
|
||||
import { useRouter, useRoute } from 'vue-router'
|
||||
import { isWorkFlow } from '@/utils/application'
|
||||
import { dateFormat } from '@/utils/time'
|
||||
import { SourceTypeEnum } from '@/enums/common'
|
||||
import { SourceTypeEnum, ValidType, ValidCount } from '@/enums/common'
|
||||
import permissionMap from '@/permission'
|
||||
|
||||
const router = useRouter()
|
||||
const route = useRoute()
|
||||
|
||||
const apiType = computed<'workspace'>(() => {
|
||||
return 'workspace'
|
||||
return 'workspace'
|
||||
})
|
||||
const permissionPrecise = computed(() => {
|
||||
return permissionMap['application'][apiType.value]
|
||||
})
|
||||
|
||||
const { folder, application, user } = useStore()
|
||||
const { folder, application, user, common } = useStore()
|
||||
|
||||
const loading = ref(false)
|
||||
|
||||
@ -321,48 +315,30 @@ const paginationConfig = reactive({
|
||||
|
||||
const folderList = ref<any[]>([])
|
||||
const applicationList = ref<any[]>([])
|
||||
const currentFolder = ref<any>({})
|
||||
const CopyApplicationDialogRef = ref()
|
||||
const CreateApplicationDialogRef = ref()
|
||||
|
||||
function openCreateDialog(type?: string) {
|
||||
CreateApplicationDialogRef.value.open(currentFolder.value?.id || 'root', type)
|
||||
// common
|
||||
// .asyncGetValid(ValidType.Application, ValidCount.Application, loading)
|
||||
// .then(async (res: any) => {
|
||||
// if (res?.data) {
|
||||
// CreateApplicationDialogRef.value.open()
|
||||
// } else if (res?.code === 400) {
|
||||
// MsgConfirm(t('common.tip'), t('views.application.tip.professionalMessage'), {
|
||||
// cancelButtonText: t('common.confirm'),
|
||||
// confirmButtonText: t('common.professional'),
|
||||
// }).then(() => {
|
||||
// window.open('https://maxkb.cn/pricing.html', '_blank')
|
||||
// })
|
||||
// }
|
||||
// })
|
||||
common
|
||||
.asyncGetValid(ValidType.Application, ValidCount.Application, loading)
|
||||
.then(async (res: any) => {
|
||||
if (res?.data) {
|
||||
CreateApplicationDialogRef.value.open(folder.currentFolder?.id || 'default', type)
|
||||
} else if (res?.code === 400) {
|
||||
MsgConfirm(t('common.tip'), t('views.application.tip.professionalMessage'), {
|
||||
cancelButtonText: t('common.confirm'),
|
||||
confirmButtonText: t('common.professional'),
|
||||
}).then(() => {
|
||||
window.open('https://maxkb.cn/pricing.html', '_blank')
|
||||
})
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
const search_type_change = () => {
|
||||
search_form.value = { name: '', create_user: '' }
|
||||
}
|
||||
|
||||
function getList() {
|
||||
const params = {
|
||||
folder_id: currentFolder.value?.id || 'root',
|
||||
}
|
||||
ApplicaitonApi.getApplication(paginationConfig, params, loading).then((res) => {
|
||||
paginationConfig.total = res.data.total
|
||||
applicationList.value = [...applicationList.value, ...res.data.records]
|
||||
})
|
||||
}
|
||||
|
||||
function clickFolder(item: any) {
|
||||
currentFolder.value.id = item.id
|
||||
applicationList.value = []
|
||||
getList()
|
||||
}
|
||||
|
||||
function getAccessToken(id: string) {
|
||||
applicationList.value
|
||||
.filter((app) => app.id === id)[0]
|
||||
@ -484,7 +460,7 @@ const importApplication = (file: any) => {
|
||||
// 文件夹相关
|
||||
const CreateFolderDialogRef = ref()
|
||||
function openCreateFolder() {
|
||||
CreateFolderDialogRef.value.open(SourceTypeEnum.APPLICATION, currentFolder.value.id)
|
||||
CreateFolderDialogRef.value.open(SourceTypeEnum.APPLICATION, folder.currentFolder.id)
|
||||
}
|
||||
|
||||
function getFolder(bool?: boolean) {
|
||||
@ -493,13 +469,19 @@ function getFolder(bool?: boolean) {
|
||||
folderList.value = res.data
|
||||
if (bool) {
|
||||
// 初始化刷新
|
||||
currentFolder.value = res.data?.[0] || {}
|
||||
folder.setCurrentFolder(res.data?.[0] || {})
|
||||
}
|
||||
getList()
|
||||
})
|
||||
}
|
||||
|
||||
function clickFolder(item: any) {
|
||||
folder.setCurrentFolder(item)
|
||||
applicationList.value = []
|
||||
getList()
|
||||
}
|
||||
function folderClickHandel(row: any) {
|
||||
currentFolder.value = row
|
||||
folder.setCurrentFolder(row)
|
||||
applicationList.value = []
|
||||
getList()
|
||||
}
|
||||
@ -514,6 +496,16 @@ function searchHandel() {
|
||||
getList()
|
||||
}
|
||||
|
||||
function getList() {
|
||||
const params = {
|
||||
folder_id: folder.currentFolder?.id || 'default',
|
||||
}
|
||||
ApplicaitonApi.getApplication(paginationConfig, params, loading).then((res) => {
|
||||
paginationConfig.total = res.data.total
|
||||
applicationList.value = [...applicationList.value, ...res.data.records]
|
||||
})
|
||||
}
|
||||
|
||||
onMounted(() => {
|
||||
getFolder(true)
|
||||
})
|
||||
|
||||
@ -6,6 +6,7 @@
|
||||
:rules="rules"
|
||||
label-position="top"
|
||||
require-asterisk-position="right"
|
||||
v-loading="loading"
|
||||
>
|
||||
<div class="mt-16 mb-16">
|
||||
<el-radio-group v-model="form.fileType" @change="radioChange" class="app-radio-button-group">
|
||||
@ -35,7 +36,11 @@
|
||||
</el-button>
|
||||
</p>
|
||||
<p>{{ $t('views.document.fileType.QA.tip2') }}</p>
|
||||
<p>{{ $t('views.document.fileType.QA.tip3') }}</p>
|
||||
<p>
|
||||
3、{{ $t('views.document.tip.fileLimitCountTip1') }} {{ file_count_limit }}
|
||||
{{ $t('views.document.tip.fileLimitCountTip2') }},
|
||||
{{ $t('views.document.tip.fileLimitSizeTip1') }} {{ file_size_limit }} MB
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
<el-upload
|
||||
@ -48,7 +53,7 @@
|
||||
:auto-upload="false"
|
||||
:show-file-list="false"
|
||||
accept=".xlsx, .xls, .csv,.zip"
|
||||
:limit="50"
|
||||
:limit="file_count_limit"
|
||||
:on-exceed="onExceed"
|
||||
:on-change="fileHandleChange"
|
||||
@click.prevent="handlePreview(false)"
|
||||
@ -89,7 +94,11 @@
|
||||
</p>
|
||||
<p>{{ $t('views.document.fileType.table.tip2') }}</p>
|
||||
<p>{{ $t('views.document.fileType.table.tip3') }}</p>
|
||||
<p>{{ $t('views.document.fileType.table.tip4') }}</p>
|
||||
<p>
|
||||
4、{{ $t('views.document.tip.fileLimitCountTip1') }} {{ file_count_limit }}
|
||||
{{ $t('views.document.tip.fileLimitCountTip2') }},
|
||||
{{ $t('views.document.tip.fileLimitSizeTip1') }} {{ file_size_limit }} MB
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
<el-upload
|
||||
@ -102,7 +111,7 @@
|
||||
:auto-upload="false"
|
||||
:show-file-list="false"
|
||||
accept=".xlsx, .xls, .csv"
|
||||
:limit="50"
|
||||
:limit="file_count_limit"
|
||||
:on-exceed="onExceed"
|
||||
:on-change="fileHandleChange"
|
||||
@click.prevent="handlePreview(false)"
|
||||
@ -131,7 +140,11 @@
|
||||
</div>
|
||||
<div class="ml-16 lighter">
|
||||
<p>{{ $t('views.document.fileType.txt.tip1') }}</p>
|
||||
<p>{{ $t('views.document.fileType.txt.tip2') }}</p>
|
||||
<p>
|
||||
2、{{ $t('views.document.tip.fileLimitCountTip1') }} {{ file_count_limit }}
|
||||
{{ $t('views.document.tip.fileLimitCountTip2') }},
|
||||
{{ $t('views.document.tip.fileLimitSizeTip1') }} {{ file_size_limit }} MB
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
<el-upload
|
||||
@ -144,7 +157,7 @@
|
||||
:auto-upload="false"
|
||||
:show-file-list="false"
|
||||
accept=".txt, .md, .log, .docx, .pdf, .html,.zip,.xlsx,.xls,.csv"
|
||||
:limit="50"
|
||||
:limit="file_count_limit"
|
||||
:on-exceed="onExceed"
|
||||
:on-change="fileHandleChange"
|
||||
@click.prevent="handlePreview(false)"
|
||||
@ -205,6 +218,9 @@ import useStore from '@/stores'
|
||||
import { t } from '@/locales'
|
||||
|
||||
const route = useRoute()
|
||||
const {
|
||||
query: { id }, // id为knowledgeID,有id的是上传文档
|
||||
} = route
|
||||
|
||||
const apiType = computed(() => {
|
||||
if (route.path.includes('shared')) {
|
||||
@ -218,6 +234,10 @@ const apiType = computed(() => {
|
||||
const { knowledge } = useStore()
|
||||
const documentsFiles = computed(() => knowledge.documentsFiles)
|
||||
const documentsType = computed(() => knowledge.documentsType)
|
||||
|
||||
const FormRef = ref()
|
||||
const loading = ref(false)
|
||||
|
||||
const form = ref({
|
||||
fileType: 'txt',
|
||||
fileList: [] as any,
|
||||
@ -228,7 +248,9 @@ const rules = reactive({
|
||||
{ required: true, message: t('views.document.upload.requiredMessage'), trigger: 'change' },
|
||||
],
|
||||
})
|
||||
const FormRef = ref()
|
||||
|
||||
const file_count_limit = ref(50)
|
||||
const file_size_limit = ref(100)
|
||||
|
||||
watch(form.value, (value) => {
|
||||
knowledge.saveDocumentsType(value.fileType)
|
||||
@ -260,9 +282,9 @@ function deleteFile(index: number) {
|
||||
// 上传on-change事件
|
||||
const fileHandleChange = (file: any, fileList: UploadFiles) => {
|
||||
//1、判断文件大小是否合法,文件限制不能大于100M
|
||||
const isLimit = file?.size / 1024 / 1024 < 100
|
||||
const isLimit = file?.size / 1024 / 1024 < file_size_limit.value
|
||||
if (!isLimit) {
|
||||
MsgError(t('views.document.upload.errorMessage1'))
|
||||
MsgError(t('views.document.tip.fileLimitSizeTip1') + file_size_limit.value + 'MB')
|
||||
fileList.splice(-1, 1) //移除当前超出大小的文件
|
||||
return false
|
||||
}
|
||||
@ -282,7 +304,11 @@ const fileHandleChange = (file: any, fileList: UploadFiles) => {
|
||||
}
|
||||
|
||||
const onExceed = () => {
|
||||
MsgError(t('views.document.upload.errorMessage4'))
|
||||
MsgError(
|
||||
t('views.document.tip.fileLimitCountTip1') +
|
||||
file_count_limit.value +
|
||||
t('views.document.tip.fileLimitCountTip2')
|
||||
)
|
||||
}
|
||||
|
||||
const handlePreview = (bool: boolean) => {
|
||||
@ -305,6 +331,15 @@ function validate() {
|
||||
})
|
||||
}
|
||||
|
||||
function getDetail() {
|
||||
loadSharedApi({ type: 'knowledge', systemType: apiType.value })
|
||||
.getKnowledgeDetail(id, loading)
|
||||
.then((res: any) => {
|
||||
file_count_limit.value = res.data.file_count_limit
|
||||
file_size_limit.value = res.data.file_size_limit
|
||||
})
|
||||
}
|
||||
|
||||
onMounted(() => {
|
||||
if (documentsType.value) {
|
||||
form.value.fileType = documentsType.value
|
||||
@ -312,6 +347,7 @@ onMounted(() => {
|
||||
if (documentsFiles.value) {
|
||||
form.value.fileList = documentsFiles.value
|
||||
}
|
||||
getDetail()
|
||||
})
|
||||
onUnmounted(() => {
|
||||
form.value = {
|
||||
|
||||
@ -127,7 +127,7 @@
|
||||
<h4 class="title-decoration-1 mb-16">
|
||||
{{ $t('common.otherSetting') }}
|
||||
</h4>
|
||||
<el-form-item :label="$t('每次上传最多文件数')">
|
||||
<el-form-item :label="$t('views.knowledge.form.file_count_limit.label')">
|
||||
<el-slider
|
||||
v-model="form.file_count_limit"
|
||||
show-input
|
||||
@ -140,10 +140,12 @@
|
||||
<el-form-item>
|
||||
<template #label>
|
||||
<div class="flex align-center">
|
||||
<span class="mr-4">{{ $t('上传的每个文档最大(MB)') }} </span>
|
||||
<span class="mr-4"
|
||||
>{{ $t('views.knowledge.form.file_size_limit.label') }}
|
||||
</span>
|
||||
<el-tooltip
|
||||
effect="dark"
|
||||
:content="$t('建议根据服务器配置调整,否则可能会造成服务宕机')"
|
||||
:content="$t('views.knowledge.form.file_size_limit.placeholder')"
|
||||
placement="right"
|
||||
>
|
||||
<AppIcon iconName="app-warning" class="app-warning-icon"></AppIcon>
|
||||
|
||||
@ -375,21 +375,6 @@ function openCreateDialog(data: any) {
|
||||
nextTick(() => {
|
||||
CreateKnowledgeDialogRef.value.open(folder.currentFolder)
|
||||
})
|
||||
|
||||
// common.asyncGetValid(ValidType.Dataset, ValidCount.Dataset, loading).then(async (res: any) => {
|
||||
// if (res?.data) {
|
||||
// CreateDatasetDialogRef.value.open()
|
||||
// } else if (res?.code === 400) {
|
||||
// MsgConfirm(t('common.tip'), t('views.knowledge.tip.professionalMessage'), {
|
||||
// cancelButtonText: t('common.confirm'),
|
||||
// confirmButtonText: t('common.professional'),
|
||||
// })
|
||||
// .then(() => {
|
||||
// window.open('https://maxkb.cn/pricing.html', '_blank')
|
||||
// })
|
||||
// .catch(() => {})
|
||||
// }
|
||||
// })
|
||||
}
|
||||
|
||||
function reEmbeddingKnowledge(row: any) {
|
||||
|
||||
@ -5,7 +5,7 @@
|
||||
<folder-tree
|
||||
:source="SourceTypeEnum.KNOWLEDGE"
|
||||
:data="folderList"
|
||||
:currentNodeKey="currentFolder?.id"
|
||||
:currentNodeKey="folder.currentFolder?.id"
|
||||
@handleNodeClick="folderClickHandel"
|
||||
class="p-8"
|
||||
:shareTitle="$t('views.shared.shared_knowledge')"
|
||||
@ -45,7 +45,6 @@ const permissionPrecise = computed(() => {
|
||||
const loading = ref(false)
|
||||
|
||||
const folderList = ref<any[]>([])
|
||||
const currentFolder = ref<any>({})
|
||||
|
||||
function getFolder(bool?: boolean) {
|
||||
const params = {}
|
||||
@ -53,15 +52,13 @@ function getFolder(bool?: boolean) {
|
||||
folderList.value = res.data
|
||||
if (bool) {
|
||||
// 初始化刷新
|
||||
currentFolder.value = res.data?.[0] || {}
|
||||
folder.setCurrentFolder(currentFolder.value)
|
||||
folder.setCurrentFolder(res.data?.[0] || {})
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
function folderClickHandel(row: any) {
|
||||
currentFolder.value = row
|
||||
folder.setCurrentFolder(currentFolder.value)
|
||||
folder.setCurrentFolder(row)
|
||||
knowledge.setKnowledgeList([])
|
||||
}
|
||||
|
||||
|
||||
@ -5,10 +5,12 @@
|
||||
</template>
|
||||
<template #title>
|
||||
<div class="flex" style="height: 22px">
|
||||
{{ model.name }}
|
||||
<span class="ellipsis-1 mb-4" :title="model.name" style="width: 80%">
|
||||
{{ model.name }}
|
||||
</span>
|
||||
<span v-if="currentModel.status === 'ERROR'">
|
||||
<el-tooltip effect="dark" :content="errMessage" placement="top">
|
||||
<el-icon class="danger ml-4" size="18"><Warning/></el-icon>
|
||||
<el-icon class="danger ml-4" size="18"><Warning /></el-icon>
|
||||
</el-tooltip>
|
||||
</span>
|
||||
<span v-if="currentModel.status === 'PAUSE_DOWNLOAD'">
|
||||
@ -17,7 +19,7 @@
|
||||
:content="`${$t('views.model.modelForm.base_model.label')}: ${props.model.model_name} ${$t('views.model.tip.downloadError')}`"
|
||||
placement="top"
|
||||
>
|
||||
<el-icon class="danger ml-4" size="18"><Warning/></el-icon>
|
||||
<el-icon class="danger ml-4" size="18"><Warning /></el-icon>
|
||||
</el-tooltip>
|
||||
</span>
|
||||
</div>
|
||||
@ -35,14 +37,15 @@
|
||||
<ul>
|
||||
<li class="flex mb-4">
|
||||
<el-text type="info" class="color-secondary"
|
||||
>{{ $t('views.model.modelForm.model_type.label') }}
|
||||
>{{ $t('views.model.modelForm.model_type.label') }}
|
||||
</el-text>
|
||||
<span class="ellipsis ml-16">
|
||||
{{ $t(modelType[model.model_type as keyof typeof modelType]) }}</span>
|
||||
{{ $t(modelType[model.model_type as keyof typeof modelType]) }}</span
|
||||
>
|
||||
</li>
|
||||
<li class="flex">
|
||||
<el-text type="info" class="color-secondary"
|
||||
>{{ $t('views.model.modelForm.base_model.label') }}
|
||||
>{{ $t('views.model.modelForm.base_model.label') }}
|
||||
</el-text>
|
||||
<span class="ellipsis-1 ml-16" style="height: 20px; width: 70%">
|
||||
{{ model.model_name }}</span
|
||||
@ -51,12 +54,12 @@
|
||||
</ul>
|
||||
<!-- progress -->
|
||||
<div class="progress-mask" v-if="currentModel.status === 'DOWNLOAD'">
|
||||
<DownloadLoading class="percentage"/>
|
||||
<DownloadLoading class="percentage" />
|
||||
|
||||
<div class="percentage-label flex-center">
|
||||
{{ $t('views.model.download.downloading') }} <span class="dotting"></span>
|
||||
<el-button link type="primary" class="ml-16" @click.stop="cancelDownload"
|
||||
>{{ $t('views.model.download.cancelDownload') }}
|
||||
>{{ $t('views.model.download.cancelDownload') }}
|
||||
</el-button>
|
||||
</div>
|
||||
</div>
|
||||
@ -65,7 +68,7 @@
|
||||
<el-dropdown trigger="click" v-if="!isShared">
|
||||
<el-button text @click.stop>
|
||||
<el-icon>
|
||||
<MoreFilled/>
|
||||
<MoreFilled />
|
||||
</el-icon>
|
||||
</el-button>
|
||||
<template #dropdown>
|
||||
@ -82,9 +85,8 @@
|
||||
v-if="isSystemShare"
|
||||
icon="Lock"
|
||||
@click.stop="openAuthorizedWorkspaceDialog(model)"
|
||||
>{{ $t('views.shared.authorized_workspace') }}
|
||||
</el-dropdown-item
|
||||
>
|
||||
>{{ $t('views.shared.authorized_workspace') }}
|
||||
</el-dropdown-item>
|
||||
|
||||
<el-dropdown-item
|
||||
v-if="
|
||||
@ -113,7 +115,7 @@
|
||||
</el-dropdown>
|
||||
</template>
|
||||
<EditModel ref="editModelRef" @submit="emit('change')"></EditModel>
|
||||
<ParamSettingDialog ref="paramSettingRef" :model="model"/>
|
||||
<ParamSettingDialog ref="paramSettingRef" :model="model" />
|
||||
<AuthorizedWorkspace
|
||||
ref="AuthorizedWorkspaceDialogRef"
|
||||
v-if="isSystemShare"
|
||||
@ -121,22 +123,22 @@
|
||||
</card-box>
|
||||
</template>
|
||||
<script setup lang="ts">
|
||||
import type {Provider, Model} from '@/api/type/model'
|
||||
import {computed, ref, onMounted, onBeforeUnmount} from 'vue'
|
||||
import type { Provider, Model } from '@/api/type/model'
|
||||
import { computed, ref, onMounted, onBeforeUnmount } from 'vue'
|
||||
import EditModel from '@/views/model/component/EditModel.vue'
|
||||
import DownloadLoading from '@/components/loading/DownloadLoading.vue'
|
||||
import {MsgConfirm, MsgSuccess} from '@/utils/message'
|
||||
import {modelType} from '@/enums/model'
|
||||
import { MsgConfirm, MsgSuccess } from '@/utils/message'
|
||||
import { modelType } from '@/enums/model'
|
||||
import ParamSettingDialog from './ParamSettingDialog.vue'
|
||||
import AuthorizedWorkspace from '@/views/system-shared/AuthorizedWorkspaceDialog.vue'
|
||||
import {t} from '@/locales'
|
||||
import { t } from '@/locales'
|
||||
import permissionMap from '@/permission'
|
||||
import { useRoute } from 'vue-router'
|
||||
import { loadSharedApi } from '@/utils/dynamics-api/shared-api'
|
||||
|
||||
const route = useRoute()
|
||||
const {
|
||||
params: {id, folderId}, //id is ModelID
|
||||
params: { id, folderId }, //id is ModelID
|
||||
} = route as any
|
||||
|
||||
const props = defineProps<{
|
||||
@ -184,19 +186,18 @@ const deleteModel = () => {
|
||||
},
|
||||
)
|
||||
.then(() => {
|
||||
loadSharedApi({type: 'model', systemType: props.apiType})
|
||||
loadSharedApi({ type: 'model', systemType: props.apiType })
|
||||
.deleteModel(props.model.id)
|
||||
.then(() => {
|
||||
emit('change')
|
||||
MsgSuccess(t('common.deleteSuccess'))
|
||||
})
|
||||
})
|
||||
.catch(() => {
|
||||
})
|
||||
.catch(() => {})
|
||||
}
|
||||
|
||||
const cancelDownload = () => {
|
||||
loadSharedApi({type: 'model', systemType: props.apiType})
|
||||
loadSharedApi({ type: 'model', systemType: props.apiType })
|
||||
.pauseDownload(props.model.id)
|
||||
.then(() => {
|
||||
downModel.value = undefined
|
||||
@ -219,7 +220,7 @@ const icon = computed(() => {
|
||||
const initInterval = () => {
|
||||
interval = setInterval(() => {
|
||||
if (currentModel.value.status === 'DOWNLOAD') {
|
||||
loadSharedApi({type: 'model', systemType: props.apiType})
|
||||
loadSharedApi({ type: 'model', systemType: props.apiType })
|
||||
.getModelMetaById(props.model.id)
|
||||
.then((ok: any) => {
|
||||
downModel.value = ok.data
|
||||
|
||||
@ -257,21 +257,6 @@ function editUser(row: any) {
|
||||
function createUser() {
|
||||
title.value = t('views.userManage.createUser')
|
||||
UserDrawerRef.value.open()
|
||||
// common.asyncGetValid(ValidType.User, ValidCount.User, loading).then(async (res: any) => {
|
||||
// if (res?.data) {
|
||||
// title.value = t('views.userManage.createUser')
|
||||
// UserDrawerRef.value.open()
|
||||
// } else if (res?.code === 400) {
|
||||
// MsgConfirm(t('common.tip'), t('views.userManage.tip.professionalMessage'), {
|
||||
// cancelButtonText: t('common.confirm'),
|
||||
// confirmButtonText: t('common.professional'),
|
||||
// })
|
||||
// .then(() => {
|
||||
// window.open('https://maxkb.cn/pricing.html', '_blank')
|
||||
// })
|
||||
// .catch(() => {})
|
||||
// }
|
||||
// })
|
||||
}
|
||||
|
||||
function deleteUserManage(row: any) {
|
||||
|
||||
@ -5,7 +5,7 @@
|
||||
<folder-tree
|
||||
:source="SourceTypeEnum.TOOL"
|
||||
:data="folderList"
|
||||
:currentNodeKey="currentFolder?.id"
|
||||
:currentNodeKey="folder.currentFolder?.id"
|
||||
@handleNodeClick="folderClickHandel"
|
||||
@refreshTree="refreshFolder"
|
||||
:shareTitle="$t('views.shared.shared_tool')"
|
||||
@ -47,7 +47,6 @@ const permissionPrecise = computed(() => {
|
||||
const loading = ref(false)
|
||||
|
||||
const folderList = ref<any[]>([])
|
||||
const currentFolder = ref<any>({})
|
||||
|
||||
function getFolder(bool?: boolean) {
|
||||
const params = {}
|
||||
@ -55,15 +54,13 @@ function getFolder(bool?: boolean) {
|
||||
folderList.value = res.data
|
||||
if (bool) {
|
||||
// 初始化刷新
|
||||
currentFolder.value = res.data?.[0] || {}
|
||||
folder.setCurrentFolder(currentFolder.value)
|
||||
folder.setCurrentFolder(res.data?.[0] || {})
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
function folderClickHandel(row: any) {
|
||||
currentFolder.value = row
|
||||
folder.setCurrentFolder(currentFolder.value)
|
||||
folder.setCurrentFolder(row)
|
||||
tool.setToolList([])
|
||||
}
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user