feat: Resource application permission

This commit is contained in:
zhangzhanwei 2025-08-01 17:25:04 +08:00 committed by zhanweizhang7
parent 83a1ffb891
commit d4312ee9ea
4 changed files with 432 additions and 481 deletions

View File

@ -22,26 +22,35 @@ const ApplicationDetailRouter = {
parentPath: '/application/:from/:id/:type',
parentName: 'ApplicationDetail',
permission: [
() => {
const to: any = get_next_route()
return new ComplexPermission([RoleConst.USER],[PermissionConst.APPLICATION.getApplicationWorkspaceResourcePermission( to ? to.params.id : '',)],[],'AND')},
RoleConst.WORKSPACE_MANAGE.getWorkspaceRole,
PermissionConst.APPLICATION_OVERVIEW_READ.getWorkspacePermissionWorkspaceManageRole,
() => {
const to: any = get_next_route()
return PermissionConst.APPLICATION_OVERVIEW_READ.getApplicationWorkspaceResourcePermission(
to ? to.params.id : '',
)
if (to.params.from == 'resource-management') { } else {
return new ComplexPermission([RoleConst.USER], [PermissionConst.APPLICATION.getApplicationWorkspaceResourcePermission(to ? to.params.id : '',)], [], 'AND')
}
},
() => {
const to: any = get_next_route()
if (to.path.includes('resource-management')) {return RoleConst.ADMIN}
if (to.params.from == 'resource-management') { } else { return RoleConst.WORKSPACE_MANAGE.getWorkspaceRole }
},
() => {
const to: any = get_next_route()
console.log('ss',to)
if (to.path.includes('resource-management')) { return PermissionConst.RESOURCE_APPLICATION_OVERVIEW_READ}
if (to.params.from == 'resource-management') { } else { return PermissionConst.APPLICATION_OVERVIEW_READ.getWorkspacePermissionWorkspaceManageRole }
},
() => {
const to: any = get_next_route()
if (to.params.from == 'resource-management') { } else {
return PermissionConst.APPLICATION_OVERVIEW_READ.getApplicationWorkspaceResourcePermission(
to ? to.params.id : '',
)
}
},
() => {
const to: any = get_next_route()
if (to.path.includes('resource-management')) { return RoleConst.ADMIN }
},
() => {
const to: any = get_next_route()
if (to.path.includes('resource-management')) { return PermissionConst.RESOURCE_APPLICATION_OVERVIEW_READ }
},
]
},
@ -58,24 +67,39 @@ const ApplicationDetailRouter = {
parentPath: '/application/:from/:id/:type',
parentName: 'ApplicationDetail',
permission: [
() => {
const to: any = get_next_route()
return new ComplexPermission([RoleConst.USER],[PermissionConst.APPLICATION.getApplicationWorkspaceResourcePermission( to ? to.params.id : '',)],[],'AND')},
RoleConst.WORKSPACE_MANAGE.getWorkspaceRole,
PermissionConst.APPLICATION_EDIT.getWorkspacePermissionWorkspaceManageRole,
() => {
const to: any = get_next_route()
return PermissionConst.APPLICATION_EDIT.getApplicationWorkspaceResourcePermission(
to ? to.params.id : '',
)
if (to.params.from == 'resource-management') { } else {
return new ComplexPermission([RoleConst.USER], [PermissionConst.APPLICATION.getApplicationWorkspaceResourcePermission(to ? to.params.id : '',)], [], 'AND')
}
},
() => {
const to: any = get_next_route()
if (to.path.includes('resource-management')) {return RoleConst.ADMIN}
if (to.params.from == 'resource-management') { } else {
return RoleConst.WORKSPACE_MANAGE.getWorkspaceRole
}
},
()=>{
() => {
const to: any = get_next_route()
if (to.path.includes('resource-management')) { return PermissionConst.RESOURCE_APPLICATION_EDIT}
if (to.params.from == 'resource-management') { } else {
return PermissionConst.APPLICATION_EDIT.getWorkspacePermissionWorkspaceManageRole
}
},
() => {
const to: any = get_next_route()
if (to.params.from == 'resource-management') { } else {
return PermissionConst.APPLICATION_EDIT.getApplicationWorkspaceResourcePermission(
to ? to.params.id : '',
)
}
},
() => {
const to: any = get_next_route()
if (to.path.includes('resource-management')) { return RoleConst.ADMIN }
},
() => {
const to: any = get_next_route()
if (to.path.includes('resource-management')) { return PermissionConst.RESOURCE_APPLICATION_EDIT }
},
]
},
@ -93,21 +117,34 @@ const ApplicationDetailRouter = {
parentName: 'ApplicationDetail',
permission: [
() => {
const to: any = get_next_route()
return new ComplexPermission([RoleConst.USER],[PermissionConst.APPLICATION.getApplicationWorkspaceResourcePermission( to ? to.params.id : '',)],[EditionConst.IS_EE, EditionConst.IS_PE],'AND')},
new ComplexPermission([RoleConst.WORKSPACE_MANAGE.getWorkspaceRole,],[PermissionConst.APPLICATION_ACCESS_READ.getWorkspacePermissionWorkspaceManageRole],[EditionConst.IS_EE, EditionConst.IS_PE],'OR'),
new ComplexPermission([],[() => {
const to: any = get_next_route()
return PermissionConst.APPLICATION_ACCESS_READ.getApplicationWorkspaceResourcePermission(
to ? to.params.id : '',)
}],[EditionConst.IS_EE, EditionConst.IS_PE],'OR'),
if (to.params.from == 'resource-management') { } else {
return new ComplexPermission([RoleConst.USER], [PermissionConst.APPLICATION.getApplicationWorkspaceResourcePermission(to ? to.params.id : '',)], [EditionConst.IS_EE, EditionConst.IS_PE], 'AND')
}
},
() => {
const to: any = get_next_route()
if (to.path.includes('resource-management')) {return RoleConst.ADMIN}
if (to.params.from == 'resource-management') { } else {
return new ComplexPermission([RoleConst.WORKSPACE_MANAGE.getWorkspaceRole,], [PermissionConst.APPLICATION_ACCESS_READ.getWorkspacePermissionWorkspaceManageRole], [EditionConst.IS_EE, EditionConst.IS_PE], 'OR')
}
},
()=>{
() => {
const to: any = get_next_route()
if (to.path.includes('resource-management')) { return PermissionConst.RESOURCE_APPLICATION_ACCESS_READ}
if (to.params.from == 'resource-management') { } else {
return new ComplexPermission([], [() => {
const to: any = get_next_route()
return PermissionConst.APPLICATION_ACCESS_READ.getApplicationWorkspaceResourcePermission(
to ? to.params.id : '',)
}], [EditionConst.IS_EE, EditionConst.IS_PE], 'OR')
}
},
() => {
const to: any = get_next_route()
if (to.path.includes('resource-management')) { return RoleConst.ADMIN }
},
() => {
const to: any = get_next_route()
if (to.path.includes('resource-management')) { return PermissionConst.RESOURCE_APPLICATION_ACCESS_READ }
},
]
},
@ -125,23 +162,32 @@ const ApplicationDetailRouter = {
parentName: 'ApplicationDetail',
resourceType: SourceTypeEnum.APPLICATION,
permission: [
() => {
const to: any = get_next_route()
return new ComplexPermission([RoleConst.USER],[PermissionConst.APPLICATION.getApplicationWorkspaceResourcePermission( to ? to.params.id : '',)],[EditionConst.IS_EE, EditionConst.IS_PE],'AND')},
new ComplexPermission([RoleConst.WORKSPACE_MANAGE.getWorkspaceRole],[PermissionConst.APPLICATION_CHAT_USER_READ.getWorkspacePermissionWorkspaceManageRole],[EditionConst.IS_EE, EditionConst.IS_PE],'OR')
,
() => {
const to: any = get_next_route()
return new ComplexPermission([],[PermissionConst.APPLICATION_CHAT_USER_READ.getApplicationWorkspaceResourcePermission(
to ? to.params.id : '',)],[EditionConst.IS_EE, EditionConst.IS_PE],'OR')
if (to.params.from == 'resource-management') { } else {
return new ComplexPermission([RoleConst.USER], [PermissionConst.APPLICATION.getApplicationWorkspaceResourcePermission(to ? to.params.id : '',)], [EditionConst.IS_EE, EditionConst.IS_PE], 'AND')
}
},
() => {
const to: any = get_next_route()
if (to.path.includes('resource-management')) {return RoleConst.ADMIN}
if (to.params.from == 'resource-management') { } else {
return new ComplexPermission([RoleConst.WORKSPACE_MANAGE.getWorkspaceRole], [PermissionConst.APPLICATION_CHAT_USER_READ.getWorkspacePermissionWorkspaceManageRole], [EditionConst.IS_EE, EditionConst.IS_PE], 'OR')
}
},
()=>{
() => {
const to: any = get_next_route()
if (to.path.includes('resource-management')) { return PermissionConst.RESOURCE_APPLICATION_CHAT_USER_READ}
if (to.params.from == 'resource-management') { } else {
return new ComplexPermission([], [PermissionConst.APPLICATION_CHAT_USER_READ.getApplicationWorkspaceResourcePermission(
to ? to.params.id : '',)], [EditionConst.IS_EE, EditionConst.IS_PE], 'OR')
}
},
() => {
const to: any = get_next_route()
if (to.path.includes('resource-management')) { return RoleConst.ADMIN }
},
() => {
const to: any = get_next_route()
if (to.path.includes('resource-management')) { return PermissionConst.RESOURCE_APPLICATION_CHAT_USER_READ }
},
]
},
@ -158,24 +204,39 @@ const ApplicationDetailRouter = {
parentPath: '/application/:from/:id/:type',
parentName: 'ApplicationDetail',
permission: [
() => {
const to: any = get_next_route()
return new ComplexPermission([RoleConst.USER],[PermissionConst.APPLICATION.getApplicationWorkspaceResourcePermission( to ? to.params.id : '',)],[],'AND')},
RoleConst.WORKSPACE_MANAGE.getWorkspaceRole,
PermissionConst.APPLICATION_CHAT_LOG_READ.getWorkspacePermissionWorkspaceManageRole,
() => {
const to: any = get_next_route()
return PermissionConst.APPLICATION_CHAT_LOG_READ.getApplicationWorkspaceResourcePermission(
to ? to.params.id : '',
)
if (to.params.from == 'resource-management') { } else {
return new ComplexPermission([RoleConst.USER], [PermissionConst.APPLICATION.getApplicationWorkspaceResourcePermission(to ? to.params.id : '',)], [], 'AND')
}
},
() => {
const to: any = get_next_route()
if (to.path.includes('resource-management')) {return RoleConst.ADMIN}
if (to.params.from == 'resource-management') { } else {
return RoleConst.WORKSPACE_MANAGE.getWorkspaceRole
}
},
()=>{
() => {
const to: any = get_next_route()
if (to.path.includes('resource-management')) { return PermissionConst.RESOURCE_APPLICATION_CHAT_LOG_READ}
if (to.params.from == 'resource-management') { } else {
return PermissionConst.APPLICATION_CHAT_LOG_READ.getWorkspacePermissionWorkspaceManageRole
}
},
() => {
const to: any = get_next_route()
if (to.params.from == 'resource-management') { } else {
return PermissionConst.APPLICATION_CHAT_LOG_READ.getApplicationWorkspaceResourcePermission(
to ? to.params.id : '',
)
}
},
() => {
const to: any = get_next_route()
if (to.path.includes('resource-management')) { return RoleConst.ADMIN }
},
() => {
const to: any = get_next_route()
if (to.path.includes('resource-management')) { return PermissionConst.RESOURCE_APPLICATION_CHAT_LOG_READ }
},
]
},

View File

@ -23,24 +23,24 @@ const DocumentRouter = {
permission: [
() => {
const to: any = get_next_route()
if (to.params.folderId == 'shared') { return RoleConst.ADMIN }
if (to.params.folderId == 'shared') { return RoleConst.ADMIN } else if (to.params.folderId == 'resource-management') { }
else { return new ComplexPermission([RoleConst.USER], [PermissionConst.KNOWLEDGE.getKnowledgeWorkspaceResourcePermission(to ? to.params.id : '',)], [], 'AND') }
},
() => {
const to: any = get_next_route()
if (to.params.folderId == 'shared') {
return RoleConst.ADMIN
} else {
} else if (to.params.folderId == 'resource-management') { }
else {
return RoleConst.WORKSPACE_MANAGE.getWorkspaceRole()
}
},
() => {
const to: any = get_next_route()
if (to.params.folderId == 'shared') {
return PermissionConst.SHARED_KNOWLEDGE_DOCUMENT_READ
} else {
} else if (to.params.folderId == 'resource-management') { }
else {
return PermissionConst.KNOWLEDGE_DOCUMENT_READ.getKnowledgeWorkspaceResourcePermission(
to ? to.params.id : '',
)
@ -48,27 +48,30 @@ const DocumentRouter = {
},
() => {
const to: any = get_next_route()
if (to.params.folderId == 'shared') { return RoleConst.ADMIN } else {
if (to.params.folderId == 'shared') { return RoleConst.ADMIN } else if (to.params.folderId == 'resource-management') { }
else {
return PermissionConst.KNOWLEDGE_DOCUMENT_READ.getWorkspacePermissionWorkspaceManageRole()
}
},
()=>{
() => {
const to: any = get_next_route()
if(to.params.folderId == 'share') {
return new ComplexPermission([RoleConst.EXTENDS_USER.getWorkspaceRole()], [PermissionConst.KNOWLEDGE_DOCUMENT_READ.getWorkspacePermission()], [], 'AND') }
if (to.params.folderId == 'share') {
return new ComplexPermission([RoleConst.EXTENDS_USER.getWorkspaceRole()], [PermissionConst.KNOWLEDGE_DOCUMENT_READ.getWorkspacePermission()], [], 'AND')
}
},
()=>{
const to: any = get_next_route()
if(to.params.folderId == 'share') {
return RoleConst.USER.getWorkspaceRole() }
},
()=>{
() => {
const to: any = get_next_route()
if (to.params.folderId == 'resource-management') { return RoleConst.ADMIN}
if (to.params.folderId == 'share') {
return RoleConst.USER.getWorkspaceRole()
}
},
()=>{
() => {
const to: any = get_next_route()
if (to.params.folderId == 'resource-management') { return PermissionConst.RESOURCE_KNOWLEDGE_DOCUMENT_READ}
if (to.params.folderId == 'resource-management') { return RoleConst.ADMIN }
},
() => {
const to: any = get_next_route()
if (to.params.folderId == 'resource-management') { return PermissionConst.RESOURCE_KNOWLEDGE_DOCUMENT_READ }
},
],
},
@ -88,16 +91,18 @@ const DocumentRouter = {
permission: [
() => {
const to: any = get_next_route()
if (to.params.folderId == 'shared') { return RoleConst.ADMIN }
if (to.params.folderId == 'shared') { return RoleConst.ADMIN } else if (to.params.folderId == 'resource-management') { }
else { return new ComplexPermission([RoleConst.USER], [PermissionConst.KNOWLEDGE.getKnowledgeWorkspaceResourcePermission(to ? to.params.id : '',)], [], 'AND') }
},
() => {
const to: any = get_next_route()
if (to.params.folderId == 'shared') { return RoleConst.ADMIN } else { return RoleConst.WORKSPACE_MANAGE.getWorkspaceRole() }
if (to.params.folderId == 'shared') { return RoleConst.ADMIN } else if (to.params.folderId == 'resource-management') { }
else { return RoleConst.WORKSPACE_MANAGE.getWorkspaceRole() }
},
() => {
const to: any = get_next_route()
if (to.params.folderId == 'shared') { return PermissionConst.SHARED_KNOWLEDGE_PROBLEM_READ } else {
if (to.params.folderId == 'shared') { return PermissionConst.SHARED_KNOWLEDGE_PROBLEM_READ } else if (to.params.folderId == 'resource-management') { }
else {
return PermissionConst.KNOWLEDGE_PROBLEM_READ.getKnowledgeWorkspaceResourcePermission(
to ? to.params.id : '',
)
@ -105,25 +110,28 @@ const DocumentRouter = {
},
() => {
const to: any = get_next_route()
if (to.params.folderId == 'shared') { return RoleConst.ADMIN } else { return PermissionConst.KNOWLEDGE_PROBLEM_READ.getWorkspacePermissionWorkspaceManageRole() }
if (to.params.folderId == 'shared') { return RoleConst.ADMIN } else if (to.params.folderId == 'resource-management') { }
else { return PermissionConst.KNOWLEDGE_PROBLEM_READ.getWorkspacePermissionWorkspaceManageRole() }
},
()=>{
() => {
const to: any = get_next_route()
if(to.params.folderId == 'share') {
return new ComplexPermission([RoleConst.EXTENDS_USER.getWorkspaceRole()], [PermissionConst.KNOWLEDGE_PROBLEM_READ.getWorkspacePermission()], [], 'AND') }
if (to.params.folderId == 'share') {
return new ComplexPermission([RoleConst.EXTENDS_USER.getWorkspaceRole()], [PermissionConst.KNOWLEDGE_PROBLEM_READ.getWorkspacePermission()], [], 'AND')
}
},
()=>{
const to: any = get_next_route()
if(to.params.folderId == 'share') {
return RoleConst.USER.getWorkspaceRole() }
},
()=>{
() => {
const to: any = get_next_route()
if (to.params.folderId == 'resource-management') { return RoleConst.ADMIN}
if (to.params.folderId == 'share') {
return RoleConst.USER.getWorkspaceRole()
}
},
()=>{
() => {
const to: any = get_next_route()
if (to.params.folderId == 'resource-management') { return PermissionConst.RESOURCE_KNOWLEDGE_PROBLEM_READ}
if (to.params.folderId == 'resource-management') { return RoleConst.ADMIN }
},
() => {
const to: any = get_next_route()
if (to.params.folderId == 'resource-management') { return PermissionConst.RESOURCE_KNOWLEDGE_PROBLEM_READ }
},
],
},
@ -142,16 +150,18 @@ const DocumentRouter = {
permission: [
() => {
const to: any = get_next_route()
if (to.params.folderId == 'shared') { return RoleConst.ADMIN }
if (to.params.folderId == 'shared') { return RoleConst.ADMIN } else if (to.params.folderId == 'resource-management') { }
else { return new ComplexPermission([RoleConst.USER], [PermissionConst.KNOWLEDGE.getKnowledgeWorkspaceResourcePermission(to ? to.params.id : '',)], [], 'AND') }
},
() => {
const to: any = get_next_route()
if (to.params.folderId == 'shared') { return RoleConst.ADMIN } else { return RoleConst.WORKSPACE_MANAGE.getWorkspaceRole() }
if (to.params.folderId == 'shared') { return RoleConst.ADMIN } else if (to.params.folderId == 'resource-management') { }
else { return RoleConst.WORKSPACE_MANAGE.getWorkspaceRole() }
},
() => {
const to: any = get_next_route()
if (to.params.folderId == 'shared') { return PermissionConst.SHARED_KNOWLEDGE_HIT_TEST_READ } else {
if (to.params.folderId == 'shared') { return PermissionConst.SHARED_KNOWLEDGE_HIT_TEST_READ } else if (to.params.folderId == 'resource-management') { }
else {
return PermissionConst.KNOWLEDGE_HIT_TEST_READ.getKnowledgeWorkspaceResourcePermission(
to ? to.params.id : '',
)
@ -159,25 +169,28 @@ const DocumentRouter = {
},
() => {
const to: any = get_next_route()
if (to.params.folderId == 'shared') { return RoleConst.ADMIN } else { return PermissionConst.KNOWLEDGE_HIT_TEST_READ.getWorkspacePermissionWorkspaceManageRole() }
if (to.params.folderId == 'shared') { return RoleConst.ADMIN } else if (to.params.folderId == 'resource-management') { }
else { return PermissionConst.KNOWLEDGE_HIT_TEST_READ.getWorkspacePermissionWorkspaceManageRole() }
},
()=>{
() => {
const to: any = get_next_route()
if(to.params.folderId == 'share') {
return new ComplexPermission([RoleConst.EXTENDS_USER.getWorkspaceRole()], [PermissionConst.KNOWLEDGE_HIT_TEST_READ.getWorkspacePermission()], [], 'AND') }
if (to.params.folderId == 'share') {
return new ComplexPermission([RoleConst.EXTENDS_USER.getWorkspaceRole()], [PermissionConst.KNOWLEDGE_HIT_TEST_READ.getWorkspacePermission()], [], 'AND')
}
},
()=>{
const to: any = get_next_route()
if(to.params.folderId == 'share') {
return RoleConst.USER.getWorkspaceRole() }
},
()=>{
() => {
const to: any = get_next_route()
if (to.params.folderId == 'resource-management') { return RoleConst.ADMIN}
if (to.params.folderId == 'share') {
return RoleConst.USER.getWorkspaceRole()
}
},
()=>{
() => {
const to: any = get_next_route()
if (to.params.folderId == 'resource-management') { return PermissionConst.RESOURCE_KNOWLEDGE_HIT_TEST}
if (to.params.folderId == 'resource-management') { return RoleConst.ADMIN }
},
() => {
const to: any = get_next_route()
if (to.params.folderId == 'resource-management') { return PermissionConst.RESOURCE_KNOWLEDGE_HIT_TEST }
},
],
},
@ -200,7 +213,8 @@ const DocumentRouter = {
const to: any = get_next_route()
if (to.params.folderId == 'shared') {
return RoleConst.ADMIN
} else {
} else if (to.params.folderId == 'resource-management') { return RoleConst.ADMIN }
else {
return RoleConst.WORKSPACE_MANAGE.getWorkspaceRole()
}
},], [
@ -208,7 +222,8 @@ const DocumentRouter = {
const to: any = get_next_route()
if (to.params.folderId == 'shared') {
return PermissionConst.SHARED_KNOWLEDGE_CHAT_USER_READ
} else {
} else if (to.params.folderId == 'resource-management') { return PermissionConst.RESOURCE_KNOWLEDGE_CHAT_USER_READ }
else {
return PermissionConst.KNOWLEDGE_CHAT_USER_READ.getKnowledgeWorkspaceResourcePermission(
to ? to.params.id : '',
)
@ -218,33 +233,36 @@ const DocumentRouter = {
const to: any = get_next_route()
if (to.params.folder_id == 'shared') {
return PermissionConst.SHARED_KNOWLEDGE_CHAT_USER_READ
} else { return PermissionConst.KNOWLEDGE_CHAT_USER_READ.getWorkspacePermissionWorkspaceManageRole() }
} else if (to.params.folderId == 'resource-management') { return PermissionConst.RESOURCE_KNOWLEDGE_CHAT_USER_READ }
else { return PermissionConst.KNOWLEDGE_CHAT_USER_READ.getWorkspacePermissionWorkspaceManageRole() }
},
], [EditionConst.IS_EE, EditionConst.IS_PE], 'OR'),
() => {
const to: any = get_next_route()
if (to.params.folderId == 'shared') { return RoleConst.ADMIN }
else { return new ComplexPermission([RoleConst.USER], [PermissionConst.KNOWLEDGE.getKnowledgeWorkspaceResourcePermission(to ? to.params.id : '',)], [EditionConst.IS_EE, EditionConst.IS_PE], 'AND') }
},
()=>{
const to: any = get_next_route()
if(to.params.folderId == 'share') {
return new ComplexPermission([RoleConst.EXTENDS_USER.getWorkspaceRole()], [PermissionConst.KNOWLEDGE_CHAT_USER_READ.getWorkspacePermission()], [], 'AND') }
},
()=>{
const to: any = get_next_route()
if(to.params.folderId == 'share') {
return RoleConst.USER.getWorkspaceRole() }
},
()=>{
const to: any = get_next_route()
if (to.params.folderId == 'resource-management') { return RoleConst.ADMIN}
},
()=>{
const to: any = get_next_route()
if (to.params.folderId == 'resource-management') { return PermissionConst.RESOURCE_KNOWLEDGE_CHAT_USER_READ}
},
]
const to: any = get_next_route()
if (to.params.folderId == 'shared') { return RoleConst.ADMIN } else if (to.params.folderId == 'resource-management') { }
else { return new ComplexPermission([RoleConst.USER], [PermissionConst.KNOWLEDGE.getKnowledgeWorkspaceResourcePermission(to ? to.params.id : '',)], [EditionConst.IS_EE, EditionConst.IS_PE], 'AND') }
},
() => {
const to: any = get_next_route()
if (to.params.folderId == 'share') {
return new ComplexPermission([RoleConst.EXTENDS_USER.getWorkspaceRole()], [PermissionConst.KNOWLEDGE_CHAT_USER_READ.getWorkspacePermission()], [], 'AND')
}
},
() => {
const to: any = get_next_route()
if (to.params.folderId == 'share') {
return RoleConst.USER.getWorkspaceRole()
}
},
() => {
const to: any = get_next_route()
if (to.params.folderId == 'resource-management') { return RoleConst.ADMIN }
},
() => {
const to: any = get_next_route()
if (to.params.folderId == 'resource-management') { return PermissionConst.RESOURCE_KNOWLEDGE_CHAT_USER_READ }
},
]
},
component: () => import('@/views/chat-user/index.vue'),
},
@ -262,16 +280,18 @@ const DocumentRouter = {
permission: [
() => {
const to: any = get_next_route()
if (to.params.folderId == 'shared') { return RoleConst.ADMIN }
if (to.params.folderId == 'shared') { return RoleConst.ADMIN } else if (to.params.folderId == 'resource-management') { }
else { return new ComplexPermission([RoleConst.USER], [PermissionConst.KNOWLEDGE.getKnowledgeWorkspaceResourcePermission(to ? to.params.id : '',)], [], 'AND') }
},
() => {
const to: any = get_next_route()
if (to.params.folderId == 'shared') { return RoleConst.ADMIN } else { return RoleConst.WORKSPACE_MANAGE.getWorkspaceRole() }
if (to.params.folderId == 'shared') { return RoleConst.ADMIN } else if (to.params.folderId == 'resource-management') { }
else { return RoleConst.WORKSPACE_MANAGE.getWorkspaceRole() }
},
() => {
const to: any = get_next_route()
if (to.params.folderId == 'shared') { return PermissionConst.SHARED_KNOWLEDGE_EDIT } else {
if (to.params.folderId == 'shared') { return PermissionConst.SHARED_KNOWLEDGE_EDIT } else if (to.params.folderId == 'resource-management') { }
else {
return PermissionConst.KNOWLEDGE_EDIT.getKnowledgeWorkspaceResourcePermission(
to ? to.params.id : '',
)
@ -279,26 +299,29 @@ const DocumentRouter = {
},
() => {
const to: any = get_next_route()
if (to.params.folderId == 'shared') { return RoleConst.ADMIN } else { return PermissionConst.KNOWLEDGE_EDIT.getWorkspacePermissionWorkspaceManageRole() }
if (to.params.folderId == 'shared') { return RoleConst.ADMIN } else if (to.params.folderId == 'resource-management') { }
else { return PermissionConst.KNOWLEDGE_EDIT.getWorkspacePermissionWorkspaceManageRole() }
},
()=>{
() => {
const to: any = get_next_route()
if(to.params.folderId == 'share') {
return new ComplexPermission([RoleConst.EXTENDS_USER.getWorkspaceRole()], [PermissionConst.KNOWLEDGE_EDIT.getWorkspacePermission()], [], 'AND') }
if (to.params.folderId == 'share') {
return new ComplexPermission([RoleConst.EXTENDS_USER.getWorkspaceRole()], [PermissionConst.KNOWLEDGE_EDIT.getWorkspacePermission()], [], 'AND')
}
},
()=>{
const to: any = get_next_route()
if(to.params.folderId == 'share') {
return RoleConst.USER.getWorkspaceRole() }
},
()=>{
() => {
const to: any = get_next_route()
if (to.params.folderId == 'resource-management') { return RoleConst.ADMIN}
if (to.params.folderId == 'share') {
return RoleConst.USER.getWorkspaceRole()
}
},
()=>{
() => {
const to: any = get_next_route()
if (to.params.folderId == 'resource-management') { return PermissionConst.RESOURCE_KNOWLEDGE_EDIT}
},
if (to.params.folderId == 'resource-management') { return RoleConst.ADMIN }
},
() => {
const to: any = get_next_route()
if (to.params.folderId == 'resource-management') { return PermissionConst.RESOURCE_KNOWLEDGE_EDIT }
},
],
},
component: () => import('@/views/knowledge/KnowledgeSetting.vue'),

View File

@ -5,15 +5,12 @@
<back-button @click="back"></back-button>
<h4 class="ellipsis" style="max-width: 300px" :title="detail?.name">{{ detail?.name }}</h4>
<div v-if="showHistory && disablePublic">
<el-text type="info" class="ml-16 color-secondary"
>{{ $t('views.applicationWorkflow.info.previewVersion') }}
{{ currentVersion.name || datetimeFormat(currentVersion.update_time) }}</el-text
>
<el-text type="info" class="ml-16 color-secondary">{{ $t('views.applicationWorkflow.info.previewVersion') }}
{{ currentVersion.name || datetimeFormat(currentVersion.update_time) }}</el-text>
</div>
<el-text type="info" class="ml-16 color-secondary" v-else-if="saveTime"
>{{ $t('views.applicationWorkflow.info.saveTime')
}}{{ datetimeFormat(saveTime) }}</el-text
>
<el-text type="info" class="ml-16 color-secondary" v-else-if="saveTime">{{
$t('views.applicationWorkflow.info.saveTime')
}}{{ datetimeFormat(saveTime) }}</el-text>
</div>
<div v-if="showHistory && disablePublic">
<el-button type="primary" class="mr-8" @click="refreshVersion()">
@ -21,7 +18,9 @@
</el-button>
<el-divider direction="vertical" />
<el-button text @click="closeHistory">
<el-icon><Close /></el-icon>
<el-icon>
<Close />
</el-icon>
</el-button>
</div>
<div v-else>
@ -30,8 +29,8 @@
</el-button>
<el-button @click="clickShowDebug" :disabled="showDebug">
<AppIcon iconName="app-debug-outlined" class="mr-4"></AppIcon>
{{ $t('views.applicationWorkflow.setting.debug') }}</el-button
>
{{ $t('views.applicationWorkflow.setting.debug') }}
</el-button>
<el-button @click="saveApplication(true)">
<AppIcon iconName="app-save-outlined" class="mr-4"></AppIcon>
{{ $t('common.save') }}
@ -71,14 +70,8 @@
</div>
<!-- 下拉框 -->
<el-collapse-transition>
<DropdownMenu
:show="showPopover"
:id="id"
v-click-outside="clickoutside"
@clickNodes="clickNodes"
@onmousedown="onmousedown"
:workflowRef="workflowRef"
/>
<DropdownMenu :show="showPopover" :id="id" v-click-outside="clickoutside" @clickNodes="clickNodes"
@onmousedown="onmousedown" :workflowRef="workflowRef" />
</el-collapse-transition>
<!-- 主画布 -->
<div class="workflow-main" ref="workflowMainRef">
@ -91,12 +84,7 @@
<div class="flex-between">
<div class="flex align-center">
<div class="mr-12 ml-24 flex">
<el-avatar
v-if="isAppIcon(detail?.icon)"
shape="square"
:size="32"
style="background: none"
>
<el-avatar v-if="isAppIcon(detail?.icon)" shape="square" :size="32" style="background: none">
<img :src="resetUrl(detail?.icon)" alt="" />
</el-avatar>
<LogoIcon v-else height="32px" />
@ -108,14 +96,14 @@
</div>
<div class="mr-16">
<el-button link @click="enlarge = !enlarge">
<AppIcon
:iconName="enlarge ? 'app-minify' : 'app-magnify'"
class="color-secondary"
style="font-size: 20px"
></AppIcon>
<AppIcon :iconName="enlarge ? 'app-minify' : 'app-magnify'" class="color-secondary"
style="font-size: 20px">
</AppIcon>
</el-button>
<el-button link @click="showDebug = false">
<el-icon :size="20" class="color-secondary"><Close /></el-icon>
<el-icon :size="20" class="color-secondary">
<Close />
</el-icon>
</el-button>
</div>
</div>
@ -126,12 +114,8 @@
</div>
</el-collapse-transition>
<!-- 发布历史 -->
<PublishHistory
v-if="showHistory"
@click="checkVersion"
v-click-outside="clickoutsideHistory"
@refreshVersion="refreshVersion"
/>
<PublishHistory v-if="showHistory" @click="checkVersion" v-click-outside="clickoutsideHistory"
@refreshVersion="refreshVersion" />
</div>
</template>
<script setup lang="ts">
@ -311,15 +295,15 @@ const publish = () => {
if (typeof err_message == 'string') {
MsgError(
res.node.properties?.stepName +
` ${t('views.applicationWorkflow.node').toLowerCase()} ` +
err_message.toLowerCase(),
` ${t('views.applicationWorkflow.node').toLowerCase()} ` +
err_message.toLowerCase(),
)
} else {
const keys = Object.keys(err_message)
MsgError(
node.properties?.stepName +
` ${t('views.applicationWorkflow.node').toLowerCase()} ` +
err_message[keys[0]]?.[0]?.message.toLowerCase(),
` ${t('views.applicationWorkflow.node').toLowerCase()} ` +
err_message[keys[0]]?.[0]?.message.toLowerCase(),
)
}
})
@ -335,8 +319,8 @@ const publish = () => {
const keys = Object.keys(err_message)
MsgError(
node.properties?.stepName +
` ${t('views.applicationWorkflow.node')}` +
err_message[keys[0]]?.[0]?.message,
` ${t('views.applicationWorkflow.node')}` +
err_message[keys[0]]?.[0]?.message,
)
}
})
@ -373,8 +357,8 @@ const clickShowDebug = () => {
const keys = Object.keys(err_message)
MsgError(
node.properties?.stepName +
` ${t('views.applicationWorkflow.node')}` +
err_message[keys[0]]?.[0]?.message,
` ${t('views.applicationWorkflow.node')}` +
err_message[keys[0]]?.[0]?.message,
)
}
})
@ -400,20 +384,20 @@ function getDetail() {
.map((v: any) => {
apiInputParams.value = v.properties.api_input_field_list
? v.properties.api_input_field_list.map((v: any) => {
return {
name: v.variable,
value: v.default_value,
}
})
return {
name: v.variable,
value: v.default_value,
}
})
: v.properties.input_field_list
? v.properties.input_field_list
.filter((v: any) => v.assignment_method === 'api_input')
.map((v: any) => {
return {
name: v.variable,
value: v.default_value,
}
})
.filter((v: any) => v.assignment_method === 'api_input')
.map((v: any) => {
return {
name: v.variable,
value: v.default_value,
}
})
: []
})
loadSharedApi({ type: 'application', systemType: apiType.value })
@ -459,7 +443,20 @@ function saveApplication(bool?: boolean, back?: boolean) {
})
}
const go = () => {
return router.push({ path: get_route() })
if (route.path.includes('workspace')) { return router.push({ path: get_route() }) }
else { return router.push({ path: get_resource_management_route() }) }
};
const get_resource_management_route = () => {
if (hasPermission([RoleConst.ADMIN, PermissionConst.RESOURCE_APPLICATION_OVERVIEW_READ], 'OR')) { return `/application/${from}/${id}/WORK_FLOW/overview` } else if
(hasPermission([RoleConst.ADMIN, PermissionConst.RESOURCE_APPLICATION_ACCESS_READ], 'OR')) {
return `/application/${from}/${id}/WORK_FLOW/access`
} else if (hasPermission([RoleConst.ADMIN, PermissionConst.RESOURCE_APPLICATION_CHAT_USER_READ], 'OR')) {
return `/application/${from}/${id}/WORK_FLOW/chat-user`
} else if (hasPermission([RoleConst.ADMIN, PermissionConst.RESOURCE_APPLICATION_CHAT_LOG_READ], 'OR')) {
return `/application/${from}/${id}/WORK_FLOW/chat-log`
} else { return `/system/resource-management/application` }
}
const get_route = () => {
@ -593,6 +590,7 @@ onBeforeUnmount(() => {
.application-workflow {
background: var(--app-layout-bg-color);
height: 100%;
.workflow-main {
height: calc(100vh - 62px);
box-sizing: border-box;
@ -618,6 +616,7 @@ onBeforeUnmount(() => {
overflow: hidden;
width: 460px;
height: 680px;
.workflow-debug-header {
background: var(--app-header-bg-color);
height: var(--app-header-height);
@ -625,21 +624,25 @@ onBeforeUnmount(() => {
box-sizing: border-box;
border-bottom: 1px solid var(--el-border-color);
}
.scrollbar-height {
height: calc(100% - var(--app-header-height) - 24px);
padding-top: 24px;
}
&.enlarge {
width: 50% !important;
height: 100% !important;
bottom: 0 !important;
right: 0 !important;
}
.chat-width {
max-width: 100% !important;
margin: 0 auto;
}
}
@media only screen and (max-height: 680px) {
.workflow-debug-container {
height: 600px;

View File

@ -5,20 +5,12 @@
{{ $t('common.setting') }}
</h3>
<div>
<el-button
type="primary"
@click="submit(applicationFormRef)"
:disabled="loading"
v-if="permissionPrecise.edit(id)"
>
<el-button type="primary" @click="submit(applicationFormRef)" :disabled="loading"
v-if="permissionPrecise.edit(id)">
{{ $t('common.save') }}
</el-button>
<el-button
type="primary"
@click="publish(applicationFormRef)"
:disabled="loading"
v-if="permissionPrecise.edit(id)"
>
<el-button type="primary" @click="publish(applicationFormRef)" :disabled="loading"
v-if="permissionPrecise.edit(id)">
{{ $t('views.application.operation.publish') }}
</el-button>
</div>
@ -34,42 +26,23 @@
</div>
<div class="scrollbar-height-left">
<el-scrollbar>
<el-form
hide-required-asterisk
ref="applicationFormRef"
:model="applicationForm"
:rules="rules"
label-position="top"
require-asterisk-position="right"
class="p-24"
style="padding-top: 0"
>
<el-form hide-required-asterisk ref="applicationFormRef" :model="applicationForm" :rules="rules"
label-position="top" require-asterisk-position="right" class="p-24" style="padding-top: 0">
<el-form-item prop="name">
<template #label>
<div class="flex-between">
<span
>{{ $t('views.application.form.appName.label') }}
<span class="color-danger">*</span></span
>
<span>{{ $t('views.application.form.appName.label') }}
<span class="color-danger">*</span></span>
</div>
</template>
<el-input
v-model="applicationForm.name"
maxlength="64"
:placeholder="$t('views.application.form.appName.placeholder')"
show-word-limit
@blur="applicationForm.name = applicationForm.name?.trim()"
/>
<el-input v-model="applicationForm.name" maxlength="64"
:placeholder="$t('views.application.form.appName.placeholder')" show-word-limit
@blur="applicationForm.name = applicationForm.name?.trim()" />
</el-form-item>
<el-form-item :label="$t('views.application.form.appDescription.label')">
<el-input
v-model="applicationForm.desc"
type="textarea"
:placeholder="$t('views.application.form.appDescription.placeholder')"
:rows="3"
maxlength="256"
show-word-limit
/>
<el-input v-model="applicationForm.desc" type="textarea"
:placeholder="$t('views.application.form.appDescription.placeholder')" :rows="3" maxlength="256"
show-word-limit />
</el-form-item>
<el-form-item :label="$t('views.application.form.aiModel.label')">
@ -77,91 +50,53 @@
<div class="flex-between">
<span>{{ $t('views.application.form.aiModel.label') }}</span>
<el-button
type="primary"
link
@click="openAIParamSettingDialog"
:disabled="!applicationForm.model_id"
>
<el-button type="primary" link @click="openAIParamSettingDialog"
:disabled="!applicationForm.model_id">
{{ $t('common.paramSetting') }}
</el-button>
</div>
</template>
<ModelSelect
v-model="applicationForm.model_id"
:placeholder="$t('views.application.form.aiModel.placeholder')"
:options="modelOptions"
@change="model_change"
@submitModel="getSelectModel"
showFooter
:model-type="'LLM'"
></ModelSelect>
<ModelSelect v-model="applicationForm.model_id"
:placeholder="$t('views.application.form.aiModel.placeholder')" :options="modelOptions"
@change="model_change" @submitModel="getSelectModel" showFooter :model-type="'LLM'">
</ModelSelect>
</el-form-item>
<el-form-item :label="$t('views.application.form.roleSettings.label')">
<MdEditorMagnify
:title="$t('views.application.form.roleSettings.label')"
v-model="applicationForm.model_setting.system"
style="height: 120px"
<MdEditorMagnify :title="$t('views.application.form.roleSettings.label')"
v-model="applicationForm.model_setting.system" style="height: 120px"
@submitDialog="submitSystemDialog"
:placeholder="$t('views.application.form.roleSettings.placeholder')"
/>
:placeholder="$t('views.application.form.roleSettings.placeholder')" />
</el-form-item>
<el-form-item
prop="model_setting.no_references_prompt"
:rules="{
required: applicationForm.model_id,
message: $t('views.application.form.prompt.requiredMessage'),
trigger: 'blur',
}"
>
<el-form-item prop="model_setting.no_references_prompt" :rules="{
required: applicationForm.model_id,
message: $t('views.application.form.prompt.requiredMessage'),
trigger: 'blur',
}">
<template #label>
<div class="flex align-center">
<span class="mr-4"
>{{
$t('views.application.form.prompt.label') +
$t('views.application.form.prompt.noReferences')
}}
<span class="mr-4">{{
$t('views.application.form.prompt.label') +
$t('views.application.form.prompt.noReferences')
}}
</span>
<el-tooltip
effect="dark"
:content="
$t('views.application.form.prompt.noReferencesTooltip', {
question: '{question}',
})
"
placement="right"
popper-class="max-w-350"
>
<el-tooltip effect="dark" :content="$t('views.application.form.prompt.noReferencesTooltip', {
question: '{question}',
})
" placement="right" popper-class="max-w-350">
<AppIcon iconName="app-warning" class="app-warning-icon"></AppIcon>
</el-tooltip>
<span class="color-danger ml-4" v-if="applicationForm.model_id">*</span>
</div>
</template>
<MdEditorMagnify
:title="
$t('views.application.form.prompt.label') +
$t('views.application.form.prompt.noReferences')
"
v-model="applicationForm.model_setting.no_references_prompt"
style="height: 120px"
@submitDialog="submitNoReferencesPromptDialog"
placeholder="{question}"
/>
<MdEditorMagnify :title="$t('views.application.form.prompt.label') +
$t('views.application.form.prompt.noReferences')
" v-model="applicationForm.model_setting.no_references_prompt" style="height: 120px"
@submitDialog="submitNoReferencesPromptDialog" placeholder="{question}" />
</el-form-item>
<el-form-item
:label="$t('views.application.form.historyRecord.label')"
@click.prevent
>
<el-input-number
v-model="applicationForm.dialogue_number"
:min="0"
:value-on-clear="0"
controls-position="right"
class="w-full"
:step="1"
:step-strictly="true"
/>
<el-form-item :label="$t('views.application.form.historyRecord.label')" @click.prevent>
<el-input-number v-model="applicationForm.dialogue_number" :min="0" :value-on-clear="0"
controls-position="right" class="w-full" :step="1" :step-strictly="true" />
</el-form-item>
<el-form-item label="$t('views.application.form.relatedKnowledgeBase')">
<template #label>
@ -182,34 +117,19 @@
</div>
</template>
<div class="w-full">
<el-text type="info" v-if="applicationForm.knowledge_id_list?.length === 0"
>{{ $t('views.application.form.relatedKnowledge.placeholder') }}
<el-text type="info" v-if="applicationForm.knowledge_id_list?.length === 0">{{
$t('views.application.form.relatedKnowledge.placeholder') }}
</el-text>
<el-row :gutter="12" v-else>
<el-col
:xs="24"
:sm="24"
:md="24"
:lg="12"
:xl="12"
class="mb-8"
v-for="(item, index) in applicationForm.knowledge_id_list"
:key="index"
>
<el-col :xs="24" :sm="24" :md="24" :lg="12" :xl="12" class="mb-8"
v-for="(item, index) in applicationForm.knowledge_id_list" :key="index">
<el-card class="relate-knowledge-card border-r-6" shadow="never">
<div class="flex-between">
<div class="flex align-center" style="width: 80%">
<KnowledgeIcon
:type="relatedObject(knowledgeList, item, 'id')?.type"
class="mr-12"
/>
<KnowledgeIcon :type="relatedObject(knowledgeList, item, 'id')?.type" class="mr-12" />
<span
class="ellipsis cursor"
:title="relatedObject(knowledgeList, item, 'id')?.name"
>
{{ relatedObject(knowledgeList, item, 'id')?.name }}</span
>
<span class="ellipsis cursor" :title="relatedObject(knowledgeList, item, 'id')?.name">
{{ relatedObject(knowledgeList, item, 'id')?.name }}</span>
</div>
<el-button text @click="removeKnowledge(item)">
<el-icon>
@ -222,56 +142,36 @@
</el-row>
</div>
</el-form-item>
<el-form-item
:label="$t('views.application.form.prompt.label')"
prop="model_setting.prompt"
:rules="{
required: applicationForm.model_id,
message: $t('views.application.form.prompt.requiredMessage'),
trigger: 'blur',
}"
>
<el-form-item :label="$t('views.application.form.prompt.label')" prop="model_setting.prompt" :rules="{
required: applicationForm.model_id,
message: $t('views.application.form.prompt.requiredMessage'),
trigger: 'blur',
}">
<template #label>
<div class="flex align-center">
<span class="mr-4">
{{ $t('views.application.form.prompt.label') }}
{{ $t('views.application.form.prompt.references') }}
</span>
<el-tooltip
effect="dark"
:content="
$t('views.application.form.prompt.referencesTooltip', {
data: '{data}',
question: '{question}',
})
"
popper-class="max-w-350"
placement="right"
>
<el-tooltip effect="dark" :content="$t('views.application.form.prompt.referencesTooltip', {
data: '{data}',
question: '{question}',
})
" popper-class="max-w-350" placement="right">
<AppIcon iconName="app-warning" class="app-warning-icon"></AppIcon>
</el-tooltip>
<span class="color-danger ml-4" v-if="applicationForm.model_id">*</span>
</div>
</template>
<MdEditorMagnify
:title="
$t('views.application.form.prompt.label') +
$t('views.application.form.prompt.references')
"
v-model="applicationForm.model_setting.prompt"
style="height: 150px"
@submitDialog="submitPromptDialog"
:placeholder="defaultPrompt"
/>
<MdEditorMagnify :title="$t('views.application.form.prompt.label') +
$t('views.application.form.prompt.references')
" v-model="applicationForm.model_setting.prompt" style="height: 150px"
@submitDialog="submitPromptDialog" :placeholder="defaultPrompt" />
</el-form-item>
<el-form-item :label="$t('views.application.form.prologue')">
<MdEditorMagnify
:title="$t('views.application.form.prologue')"
v-model="applicationForm.prologue"
style="height: 150px"
@submitDialog="submitPrologueDialog"
/>
<MdEditorMagnify :title="$t('views.application.form.prologue')" v-model="applicationForm.prologue"
style="height: 150px" @submitDialog="submitPrologueDialog" />
</el-form-item>
<el-form-item @click.prevent>
<template #label>
@ -282,27 +182,23 @@
<div class="flex">
<el-button type="primary" link @click="openReasoningParamSettingDialog">
<el-icon><Setting /></el-icon>
<el-icon>
<Setting />
</el-icon>
</el-button>
<el-switch
class="ml-8"
size="small"
<el-switch class="ml-8" size="small"
v-model="applicationForm.model_setting.reasoning_content_enable"
@change="sttModelEnableChange"
/>
@change="sttModelEnableChange" />
</div>
</div>
</template>
</el-form-item>
<el-form-item
prop="stt_model_id"
:rules="{
required: applicationForm.stt_model_enable,
message: $t('views.application.form.voiceInput.requiredMessage'),
trigger: 'change',
}"
>
<el-form-item prop="stt_model_id" :rules="{
required: applicationForm.stt_model_enable,
message: $t('views.application.form.voiceInput.requiredMessage'),
trigger: 'change',
}">
<template #label>
<div class="flex-between">
<span class="mr-4">
@ -311,95 +207,61 @@
</span>
<div class="flex">
<el-checkbox
v-if="applicationForm.stt_model_enable"
v-model="applicationForm.stt_autosend"
>{{ $t('views.application.form.voiceInput.autoSend') }}</el-checkbox
>
<el-switch
class="ml-8"
size="small"
v-model="applicationForm.stt_model_enable"
@change="sttModelEnableChange"
/>
<el-checkbox v-if="applicationForm.stt_model_enable" v-model="applicationForm.stt_autosend">{{
$t('views.application.form.voiceInput.autoSend') }}</el-checkbox>
<el-switch class="ml-8" size="small" v-model="applicationForm.stt_model_enable"
@change="sttModelEnableChange" />
</div>
</div>
</template>
<ModelSelect
v-show="applicationForm.stt_model_enable"
v-model="applicationForm.stt_model_id"
:placeholder="$t('views.application.form.voiceInput.placeholder')"
:options="sttModelOptions"
:model-type="'STT'"
></ModelSelect>
<ModelSelect v-show="applicationForm.stt_model_enable" v-model="applicationForm.stt_model_id"
:placeholder="$t('views.application.form.voiceInput.placeholder')" :options="sttModelOptions"
:model-type="'STT'">
</ModelSelect>
</el-form-item>
<el-form-item
prop="tts_model_id"
:rules="{
required:
applicationForm.tts_type === 'TTS' && applicationForm.tts_model_enable,
message: $t('views.application.form.voicePlay.requiredMessage'),
trigger: 'change',
}"
>
<el-form-item prop="tts_model_id" :rules="{
required:
applicationForm.tts_type === 'TTS' && applicationForm.tts_model_enable,
message: $t('views.application.form.voicePlay.requiredMessage'),
trigger: 'change',
}">
<template #label>
<div class="flex-between">
<span class="mr-4"
>{{ $t('views.application.form.voicePlay.label') }}
<span
class="color-danger"
v-if="
applicationForm.tts_type === 'TTS' && applicationForm.tts_model_enable
"
>*</span
>
<span class="mr-4">{{ $t('views.application.form.voicePlay.label') }}
<span class="color-danger" v-if="
applicationForm.tts_type === 'TTS' && applicationForm.tts_model_enable
">*</span>
</span>
<div class="flex">
<el-checkbox
v-if="applicationForm.tts_model_enable"
v-model="applicationForm.tts_autoplay"
>{{ $t('views.application.form.voicePlay.autoPlay') }}</el-checkbox
>
<el-switch
class="ml-8"
size="small"
v-model="applicationForm.tts_model_enable"
@change="ttsModelEnableChange"
/>
<el-checkbox v-if="applicationForm.tts_model_enable" v-model="applicationForm.tts_autoplay">{{
$t('views.application.form.voicePlay.autoPlay') }}</el-checkbox>
<el-switch class="ml-8" size="small" v-model="applicationForm.tts_model_enable"
@change="ttsModelEnableChange" />
</div>
</div>
</template>
<div class="w-full">
<el-radio-group
v-model="applicationForm.tts_type"
v-show="applicationForm.tts_model_enable"
class="mb-8"
>
<el-radio-group v-model="applicationForm.tts_type" v-show="applicationForm.tts_model_enable"
class="mb-8">
<el-radio value="BROWSER">{{
$t('views.application.form.voicePlay.browser')
}}</el-radio>
}}</el-radio>
<el-radio value="TTS">{{
$t('views.application.form.voicePlay.tts')
}}</el-radio>
}}</el-radio>
</el-radio-group>
</div>
<div class="flex-between w-full">
<ModelSelect
v-if="applicationForm.tts_type === 'TTS' && applicationForm.tts_model_enable"
<ModelSelect v-if="applicationForm.tts_type === 'TTS' && applicationForm.tts_model_enable"
v-model="applicationForm.tts_model_id"
:placeholder="$t('views.application.form.voicePlay.placeholder')"
:options="ttsModelOptions"
@change="ttsModelChange()"
:model-type="'TTS'"
></ModelSelect>
:placeholder="$t('views.application.form.voicePlay.placeholder')" :options="ttsModelOptions"
@change="ttsModelChange()" :model-type="'TTS'"></ModelSelect>
<el-button
v-if="applicationForm.tts_type === 'TTS'"
@click="openTTSParamSettingDialog"
:disabled="!applicationForm.tts_model_id"
class="ml-8"
>
<el-icon><Operation /></el-icon>
<el-button v-if="applicationForm.tts_type === 'TTS'" @click="openTTSParamSettingDialog"
:disabled="!applicationForm.tts_model_id" class="ml-8">
<el-icon>
<Operation />
</el-icon>
</el-button>
</div>
</el-form-item>
@ -423,21 +285,14 @@
<AIModeParamSettingDialog ref="AIModeParamSettingDialogRef" @refresh="refreshForm" />
<TTSModeParamSettingDialog ref="TTSModeParamSettingDialogRef" @refresh="refreshTTSForm" />
<ParamSettingDialog ref="ParamSettingDialogRef" @refresh="refreshParam" />
<AddKnowledgeDialog
ref="AddKnowledgeDialogRef"
@addData="addKnowledge"
:data="knowledgeList"
:loading="knowledgeLoading"
/>
<ReasoningParamSettingDialog
ref="ReasoningParamSettingDialogRef"
@refresh="submitReasoningDialog"
/>
<AddKnowledgeDialog ref="AddKnowledgeDialogRef" @addData="addKnowledge" :data="knowledgeList"
:loading="knowledgeLoading" />
<ReasoningParamSettingDialog ref="ReasoningParamSettingDialogRef" @refresh="submitReasoningDialog" />
</div>
</template>
<script setup lang="ts">
import { reactive, ref, onMounted, computed } from 'vue'
import { useRoute } from 'vue-router'
import { reactive, ref, onMounted, computed, onBeforeMount } from 'vue'
import { useRoute, useRouter } from 'vue-router'
import { groupBy } from 'lodash'
import AIModeParamSettingDialog from './component/AIModeParamSettingDialog.vue'
import ParamSettingDialog from './component/ParamSettingDialog.vue'
@ -454,7 +309,7 @@ import { EditionConst } from '@/utils/permission/data'
import { hasPermission } from '@/utils/permission/index'
import { loadSharedApi } from '@/utils/dynamics-api/shared-api'
const route = useRoute()
const router = useRouter()
const {
params: { id },
} = route as any
@ -687,12 +542,12 @@ function getSelectModel() {
const obj =
apiType.value === 'systemManage'
? {
model_type: 'LLM',
workspace_id: applicationForm.value?.workspace_id,
}
model_type: 'LLM',
workspace_id: applicationForm.value?.workspace_id,
}
: {
model_type: 'LLM',
}
model_type: 'LLM',
}
loadSharedApi({ type: 'model', systemType: apiType.value })
.getSelectModelList(obj)
.then((res: any) => {
@ -709,12 +564,12 @@ function getSTTModel() {
const obj =
apiType.value === 'systemManage'
? {
model_type: 'STT',
workspace_id: applicationForm.value?.workspace_id,
}
model_type: 'STT',
workspace_id: applicationForm.value?.workspace_id,
}
: {
model_type: 'STT',
}
model_type: 'STT',
}
loadSharedApi({ type: 'model', systemType: apiType.value })
.getSelectModelList(obj)
.then((res: any) => {
@ -731,12 +586,12 @@ function getTTSModel() {
const obj =
apiType.value === 'systemManage'
? {
model_type: 'TTS',
workspace_id: applicationForm.value?.workspace_id,
}
model_type: 'TTS',
workspace_id: applicationForm.value?.workspace_id,
}
: {
model_type: 'TTS',
}
model_type: 'TTS',
}
loadSharedApi({ type: 'model', systemType: apiType.value })
.getSelectModelList(obj)
.then((res: any) => {
@ -768,7 +623,16 @@ function sttModelEnableChange() {
applicationForm.value.stt_model_id = undefined
}
}
onBeforeMount(() => {
if (route.path.includes('WORK_FLOW')) {
if (apiType.value == 'workspace') {
router.push(`/application/workspace/${route.params.id}/workflow`)
} else {
router.push(`/application/resource-management/${route.params.id}/workflow`)
}
}
})
onMounted(() => {
getSelectModel()
getDetail()