mirror of
https://github.com/1Panel-dev/MaxKB.git
synced 2025-12-26 01:33:05 +00:00
feat: permission
This commit is contained in:
parent
3360c49f4c
commit
449aa63f85
|
|
@ -158,12 +158,12 @@ const putGenerateRelated: (
|
|||
* @query { query_text: string, top_number: number, similarity: number }
|
||||
* @returns
|
||||
*/
|
||||
const getKnowledgeHitTest: (
|
||||
const putKnowledgeHitTest: (
|
||||
knowledge_id: string,
|
||||
data: any,
|
||||
loading?: Ref<boolean>,
|
||||
) => Promise<Result<Array<any>>> = (knowledge_id, data, loading) => {
|
||||
return get(`${prefix.value}/${knowledge_id}/hit_test`, data, loading)
|
||||
return put(`${prefix.value}/${knowledge_id}/hit_test`, undefined, data, loading)
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -265,7 +265,7 @@ export default {
|
|||
exportKnowledge,
|
||||
exportZipKnowledge,
|
||||
putGenerateRelated,
|
||||
getKnowledgeHitTest,
|
||||
putKnowledgeHitTest,
|
||||
putSyncWebKnowledge,
|
||||
postKnowledge,
|
||||
getKnowledgeModel,
|
||||
|
|
|
|||
|
|
@ -143,7 +143,6 @@ const putGenerateRelated: (
|
|||
) => Promise<Result<Array<any>>> = (knowledge_id, data, loading) => {
|
||||
return put(`${prefix}/${knowledge_id}/generate_related`, data, null, loading)
|
||||
}
|
||||
|
||||
/**
|
||||
* 命中测试列表
|
||||
* @param knowledge_id
|
||||
|
|
@ -151,14 +150,15 @@ const putGenerateRelated: (
|
|||
* @query { query_text: string, top_number: number, similarity: number }
|
||||
* @returns
|
||||
*/
|
||||
const getKnowledgeHitTest: (
|
||||
const putKnowledgeHitTest: (
|
||||
knowledge_id: string,
|
||||
data: any,
|
||||
loading?: Ref<boolean>,
|
||||
) => Promise<Result<Array<any>>> = (knowledge_id, data, loading) => {
|
||||
return get(`${prefix}/${knowledge_id}/hit_test`, data, loading)
|
||||
return put(`${prefix}/${knowledge_id}/hit_test`, undefined, data, loading)
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 同步知识库
|
||||
* @param 参数 knowledge_id
|
||||
|
|
@ -260,7 +260,7 @@ export default {
|
|||
exportKnowledge,
|
||||
exportZipKnowledge,
|
||||
putGenerateRelated,
|
||||
getKnowledgeHitTest,
|
||||
putKnowledgeHitTest,
|
||||
putSyncWebKnowledge,
|
||||
postKnowledge,
|
||||
getKnowledgeModel,
|
||||
|
|
|
|||
|
|
@ -4,11 +4,13 @@
|
|||
<div class="logo mt-4">
|
||||
<LogoFull />
|
||||
</div>
|
||||
|
||||
<el-divider
|
||||
direction="vertical"
|
||||
class="ml-24 mr-24"
|
||||
v-if="hasPermission(EditionConst.IS_EE, 'OR')"
|
||||
/>
|
||||
<!-- 企业版: 工作空间下拉框-->
|
||||
<WorkspaceDropdown v-if="hasPermission(EditionConst.IS_EE, 'OR')" />
|
||||
<div class="flex-between w-full">
|
||||
<div></div>
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@ const ModelRouter = {
|
|||
|
||||
// 上传文档
|
||||
{
|
||||
path: '/knowledge/document/upload',
|
||||
path: '/knowledge/document/upload/:folderId',
|
||||
name: 'UploadDocument',
|
||||
meta: { activeMenu: '/knowledge' },
|
||||
component: () => import('@/views/document/UploadDocument.vue'),
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
import { ChatUserResourceEnum } from '@/enums/workspaceChatUser'
|
||||
|
||||
import { PermissionConst, RoleConst } from '@/utils/permission/data'
|
||||
import { PermissionConst, EditionConst, RoleConst } from '@/utils/permission/data'
|
||||
|
||||
const ApplicationDetailRouter = {
|
||||
path: '/application/:id/:type',
|
||||
|
|
@ -49,7 +49,7 @@ const ApplicationDetailRouter = {
|
|||
active: 'access',
|
||||
parentPath: '/application/:id/:type',
|
||||
parentName: 'ApplicationDetail',
|
||||
// permission: new ComplexPermission([], ['x-pack'], 'OR'),
|
||||
permission: [EditionConst.IS_PE, EditionConst.IS_EE],
|
||||
},
|
||||
component: () => import('@/views/application/ApplicationAccess.vue'),
|
||||
},
|
||||
|
|
@ -75,9 +75,10 @@ const ApplicationDetailRouter = {
|
|||
active: 'chat-log',
|
||||
parentPath: '/application/:id/:type',
|
||||
parentName: 'ApplicationDetail',
|
||||
resourceType: ChatUserResourceEnum.APPLICATION
|
||||
resourceType: ChatUserResourceEnum.APPLICATION,
|
||||
permission: [EditionConst.IS_PE, EditionConst.IS_EE],
|
||||
},
|
||||
component: () => import('@/views/chat-user/index.vue')
|
||||
component: () => import('@/views/chat-user/index.vue'),
|
||||
},
|
||||
{
|
||||
path: 'chat-log',
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
import { ChatUserResourceEnum } from '@/enums/workspaceChatUser'
|
||||
|
||||
import { PermissionConst, EditionConst, RoleConst } from '@/utils/permission/data'
|
||||
const DocumentRouter = {
|
||||
path: '/knowledge/:id/:folderId',
|
||||
name: 'KnowledgeDetail',
|
||||
|
|
@ -55,9 +56,10 @@ const DocumentRouter = {
|
|||
active: 'chat-log',
|
||||
parentPath: '/knowledge/:id/:folderId',
|
||||
parentName: 'KnowledgeDetail',
|
||||
resourceType: ChatUserResourceEnum.KNOWLEDGE
|
||||
resourceType: ChatUserResourceEnum.KNOWLEDGE,
|
||||
permission: [EditionConst.IS_PE, EditionConst.IS_EE],
|
||||
},
|
||||
component: () => import('@/views/chat-user/index.vue')
|
||||
component: () => import('@/views/chat-user/index.vue'),
|
||||
},
|
||||
{
|
||||
path: 'setting',
|
||||
|
|
|
|||
|
|
@ -71,6 +71,7 @@ const documentsType = computed(() => knowledge.documentsType)
|
|||
const router = useRouter()
|
||||
const route = useRoute()
|
||||
const {
|
||||
params: { folderId },
|
||||
query: { id }, // id为knowledgeID,有id的是上传文档
|
||||
} = route
|
||||
|
||||
|
|
@ -96,7 +97,7 @@ async function next() {
|
|||
documentApi.postQADocument(id as string, fd, loading).then((res) => {
|
||||
MsgSuccess(t('common.submitSuccess'))
|
||||
clearStore()
|
||||
router.push({ path: `/knowledge/${id}/document` })
|
||||
router.push({ path: `/knowledge/${id}/${folderId}/document` })
|
||||
})
|
||||
}
|
||||
} else if (documentsType.value === 'table') {
|
||||
|
|
@ -111,7 +112,7 @@ async function next() {
|
|||
documentApi.postTableDocument(id as string, fd, loading).then((res) => {
|
||||
MsgSuccess(t('common.submitSuccess'))
|
||||
clearStore()
|
||||
router.push({ path: `/knowledge/${id}/document` })
|
||||
router.push({ path: `/knowledge/${id}/${folderId}/document` })
|
||||
})
|
||||
}
|
||||
} else {
|
||||
|
|
@ -151,7 +152,7 @@ function submit() {
|
|||
.then(() => {
|
||||
MsgSuccess(t('common.submitSuccess'))
|
||||
clearStore()
|
||||
router.push({ path: `/knowledge/${id}/document` })
|
||||
router.push({ path: `/knowledge/${id}/${folderId}/document` })
|
||||
})
|
||||
.catch(() => {
|
||||
loading.value = false
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@
|
|||
<el-button
|
||||
v-if="knowledgeDetail.type === 0"
|
||||
type="primary"
|
||||
@click="router.push({ path: '/knowledge/document/upload', query: { id: id } })"
|
||||
@click="router.push({ path: `/knowledge/document/upload/${folderId}`, query: { id: id } })"
|
||||
v-hasPermission="[RoleConst.WORKSPACE_MANAGE.getWorkspaceRole,PermissionConst.KNOWLEDGE_DOCUMENT_CREATE.getWorkspacePermission]"
|
||||
>{{ $t('views.document.uploadDocument') }}
|
||||
</el-button>
|
||||
|
|
@ -526,7 +526,7 @@
|
|||
</div>
|
||||
</el-card>
|
||||
<div class="mul-operation w-full flex" v-if="multipleSelection.length !== 0">
|
||||
<el-button :disabled="multipleSelection.length === 0" @click="cancelTaskHandle(1, row)"
|
||||
<el-button :disabled="multipleSelection.length === 0" @click="cancelTaskHandle(1, row)"
|
||||
v-hasPermission="[RoleConst.WORKSPACE_MANAGE.getWorkspaceRole,PermissionConst.KNOWLEDGE_DOCUMENT_VECTOR.getWorkspacePermission]">
|
||||
{{ $t('views.document.setting.cancelVectorization') }}
|
||||
</el-button>
|
||||
|
|
|
|||
|
|
@ -312,7 +312,7 @@ function getHitTestList() {
|
|||
...formInline.value,
|
||||
}
|
||||
if (isDataset.value) {
|
||||
KnowledgeApi.getKnowledgeHitTest(id, obj, loading).then((res) => {
|
||||
KnowledgeApi.putKnowledgeHitTest(id, obj, loading).then((res) => {
|
||||
paragraphDetail.value = res.data && arraySort(res.data, 'comprehensive_score', true)
|
||||
questionTitle.value = inputValue.value
|
||||
inputValue.value = ''
|
||||
|
|
|
|||
|
|
@ -140,6 +140,9 @@ import QrCodeTab from '@/views/login/scanCompinents/QrCodeTab.vue'
|
|||
import { MsgConfirm, MsgError } from '@/utils/message.ts'
|
||||
import * as dd from 'dingtalk-jsapi'
|
||||
import { loadScript } from '@/utils/utils'
|
||||
import { EditionConst } from '@/utils/permission/data'
|
||||
import { hasPermission } from '@/utils/permission/index'
|
||||
|
||||
const router = useRouter()
|
||||
const { login, user, theme } = useStore()
|
||||
const { locale } = useI18n({ useScope: 'global' })
|
||||
|
|
@ -296,7 +299,8 @@ function changeMode(val: string) {
|
|||
onBeforeMount(() => {
|
||||
loading.value = true
|
||||
user.asyncGetProfile().then((res) => {
|
||||
if (user.isEnterprise()) {
|
||||
// 企业版和专业版:第三方登录
|
||||
if (hasPermission([EditionConst.IS_EE, EditionConst.IS_PE], 'OR')) {
|
||||
login
|
||||
.getAuthType()
|
||||
.then((res) => {
|
||||
|
|
|
|||
|
|
@ -128,8 +128,6 @@ import useStore from '@/stores'
|
|||
import ParamSettingDialog from './ParamSettingDialog.vue'
|
||||
import {t} from '@/locales'
|
||||
import { PermissionConst, EditionConst, RoleConst } from '@/utils/permission/data'
|
||||
import { hasPermission } from '@/utils/permission/index'
|
||||
import { ComplexPermission } from '@/utils/permission/type'
|
||||
|
||||
const props = defineProps<{
|
||||
model: Model
|
||||
|
|
|
|||
|
|
@ -119,7 +119,6 @@ import SelectProviderDialog from '@/views/model/component/SelectProviderDialog.v
|
|||
import useStore from '@/stores'
|
||||
import { t } from '@/locales'
|
||||
import { PermissionConst, RoleConst } from '@/utils/permission/data'
|
||||
import { hasPermission } from '@/utils/permission/index'
|
||||
|
||||
const { model } = useStore()
|
||||
|
||||
|
|
|
|||
|
|
@ -312,7 +312,7 @@ function getHitTestList() {
|
|||
...formInline.value,
|
||||
}
|
||||
if (isDataset.value) {
|
||||
KnowledgeApi.getKnowledgeHitTest(id, obj, loading).then((res) => {
|
||||
KnowledgeApi.putKnowledgeHitTest(id, obj, loading).then((res) => {
|
||||
paragraphDetail.value = res.data && arraySort(res.data, 'comprehensive_score', true)
|
||||
questionTitle.value = inputValue.value
|
||||
inputValue.value = ''
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@ export default defineConfig(({ mode }) => {
|
|||
const prefix = process.env.VITE_DYNAMIC_PREFIX || ENV.VITE_BASE_PATH
|
||||
const proxyConf: Record<string, string | ProxyOptions> = {}
|
||||
proxyConf['/api'] = {
|
||||
target: 'http://43.166.1.146:8080',
|
||||
target: 'http://127.0.0.1:8080',
|
||||
changeOrigin: true,
|
||||
rewrite: (path: string) => path.replace(ENV.VITE_BASE_PATH, '/'),
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue