diff --git a/ui/src/api/chat-user/chat-user.ts b/ui/src/api/chat-user/chat-user.ts new file mode 100644 index 000000000..ef59baec1 --- /dev/null +++ b/ui/src/api/chat-user/chat-user.ts @@ -0,0 +1,48 @@ +import type { Ref } from 'vue' +import { Result } from '@/request/Result' +import { get, put } from '@/request/index' +import type { ChatUserGroupItem, ChatUserGroupUserItem, ChatUserResourceParams, putUserGroupUserParams } from '@/api/type/workspaceChatUser' +import type { pageRequest, PageList } from '@/api/type/common' +const prefix = '/workspace/' + localStorage.getItem('workspace_id') + +/** + * 获取用户组列表 + */ +const getUserGroupList: (resource: ChatUserResourceParams, loading?: Ref) => Promise> = (resource, loading) => { + return get(`${prefix}/${resource.resource_type}/${resource.resource_id}/user_group`, undefined, loading) +} + +/** + * 获取用户组的用户列表 + */ +const getUserGroupUserList: ( + resource: ChatUserResourceParams, + user_group_id: string, + page: pageRequest, + param: any, + loading?: Ref, +) => Promise>> = (resource, user_group_id, page, param, loading) => { + return get( + `${prefix}/${resource.resource_type}/${resource.resource_id}/user_group_id/${user_group_id}/${page.current_page}/${page.page_size}`, + param, + loading, + ) +} + +/** + * 更新用户组的用户列表 + */ +const putUserGroupUser: ( + resource: ChatUserResourceParams, + user_group_id: string, + data: putUserGroupUserParams[], + loading?: Ref, +) => Promise> = (resource, user_group_id, data, loading) => { + return put(`${prefix}/${resource.resource_type}/${resource.resource_id}/user_group_id/${user_group_id}`, data, undefined, loading) +} + +export default { + getUserGroupList, + getUserGroupUserList, + putUserGroupUser +} \ No newline at end of file diff --git a/ui/src/api/system/chat-user.ts b/ui/src/api/system/chat-user.ts index 703a0b70f..730de1ce5 100644 --- a/ui/src/api/system/chat-user.ts +++ b/ui/src/api/system/chat-user.ts @@ -1,22 +1,22 @@ -import {Result} from '@/request/Result' -import {get, put, post, del} from '@/request/index' -import type {pageRequest} from '@/api/type/common' -import type {Ref} from 'vue' +import { Result } from '@/request/Result' +import { get, put, post, del } from '@/request/index' +import type { pageRequest } from '@/api/type/common' +import type { Ref } from 'vue' const prefix = '/system/chat_user' /** * 用户分页列表 * @query 参数 - email_or_username: string + username_or_nickname: string */ const getUserManage: ( page: pageRequest, - email_or_username: string, + username_or_nickname: string, loading?: Ref, -) => Promise> = (page, email_or_username, loading) => { +) => Promise> = (page, username_or_nickname, loading) => { return get( `${prefix}/user_manage/${page.current_page}/${page.page_size}`, - email_or_username ? {email_or_username} : undefined, + username_or_nickname ? { username_or_nickname } : undefined, loading, ) } diff --git a/ui/src/api/type/workspaceChatUser.ts b/ui/src/api/type/workspaceChatUser.ts new file mode 100644 index 000000000..1c0ab66ae --- /dev/null +++ b/ui/src/api/type/workspaceChatUser.ts @@ -0,0 +1,33 @@ + +import { ChatUserResourceEnum } from '@/enums/workspaceChatUser' + +interface ChatUserResourceParams { + resource_id: string, + resource_type: ChatUserResourceEnum +} + +interface ChatUserGroupItem { + id: string, + name: string, + is_auth: boolean +} + +interface ChatUserGroupUserItem { + id: string, + is_auth: boolean, + email: string, + phone: string, + nick_name: string, + username: string, + password: string, + source: string, + is_active: boolean, + create_time: string, + update_time: string, +} + +interface putUserGroupUserParams { + chat_user_id: string, + is_auth: boolean +} +export type { ChatUserGroupItem, putUserGroupUserParams, ChatUserResourceParams, ChatUserGroupUserItem } \ No newline at end of file diff --git a/ui/src/enums/workspaceChatUser.ts b/ui/src/enums/workspaceChatUser.ts new file mode 100644 index 000000000..d581b497b --- /dev/null +++ b/ui/src/enums/workspaceChatUser.ts @@ -0,0 +1,4 @@ +export enum ChatUserResourceEnum { + KNOWLEDGE = 'KNOWLEDGE', + APPLICATION = 'APPLICATION', +} \ No newline at end of file diff --git a/ui/src/locales/lang/en-US/common.ts b/ui/src/locales/lang/en-US/common.ts index 06692fee4..41f923c6b 100644 --- a/ui/src/locales/lang/en-US/common.ts +++ b/ui/src/locales/lang/en-US/common.ts @@ -84,4 +84,5 @@ export default { }, info: 'Base Information', otherSetting: 'Other Settings', + username: 'username' } diff --git a/ui/src/locales/lang/en-US/views/chat-user.ts b/ui/src/locales/lang/en-US/views/chat-user.ts new file mode 100644 index 000000000..c1716c115 --- /dev/null +++ b/ui/src/locales/lang/en-US/views/chat-user.ts @@ -0,0 +1,10 @@ +export default { + title: 'Chat users', + syncUsers: 'Sync users', + setUserGroups: 'Set user groups', + autoAuthorization: 'Auto authorization', + authorization: 'Authorization', + group: { + title: 'User groups', + } +}; \ No newline at end of file diff --git a/ui/src/locales/lang/en-US/views/index.ts b/ui/src/locales/lang/en-US/views/index.ts index 002bce6ab..7b8fbb7f6 100644 --- a/ui/src/locales/lang/en-US/views/index.ts +++ b/ui/src/locales/lang/en-US/views/index.ts @@ -14,6 +14,7 @@ import document from './document' import paragraph from './paragraph' import problem from './problem' import chatLog from './chat-log' +import chatUser from './chat-user' import applicationWorkflow from './application-workflow' import login from './login' import operateLog from './operate-log' @@ -36,5 +37,6 @@ export default { login, operateLog, role, - workspace + workspace, + chatUser } diff --git a/ui/src/locales/lang/zh-CN/common.ts b/ui/src/locales/lang/zh-CN/common.ts index eec9c44b3..0c2f55308 100644 --- a/ui/src/locales/lang/zh-CN/common.ts +++ b/ui/src/locales/lang/zh-CN/common.ts @@ -88,4 +88,5 @@ export default { }, info: '基本信息', otherSetting: '其他设置', + username: '用户名' } diff --git a/ui/src/locales/lang/zh-CN/views/chat-user.ts b/ui/src/locales/lang/zh-CN/views/chat-user.ts new file mode 100644 index 000000000..63e06ab9e --- /dev/null +++ b/ui/src/locales/lang/zh-CN/views/chat-user.ts @@ -0,0 +1,10 @@ +export default { + title: '对话用户', + syncUsers: '同步用户', + setUserGroups: '设置用户组', + autoAuthorization: '自动授权', + authorization: '授权', + group: { + title: '用户组', + } +} diff --git a/ui/src/locales/lang/zh-CN/views/index.ts b/ui/src/locales/lang/zh-CN/views/index.ts index 985d365fa..f87670b55 100644 --- a/ui/src/locales/lang/zh-CN/views/index.ts +++ b/ui/src/locales/lang/zh-CN/views/index.ts @@ -14,6 +14,7 @@ import applicationOverview from './application-overview' import applicationWorkflow from './application-workflow' import paragraph from './paragraph' import chatLog from './chat-log' +import chatUser from './chat-user' // import notFound from './404' // import operateLog from './operate-log' @@ -34,6 +35,7 @@ export default { applicationWorkflow, paragraph, chatLog, + chatUser, // notFound, // operateLog diff --git a/ui/src/locales/lang/zh-Hant/common.ts b/ui/src/locales/lang/zh-Hant/common.ts index 35a46f84b..143314b20 100644 --- a/ui/src/locales/lang/zh-Hant/common.ts +++ b/ui/src/locales/lang/zh-Hant/common.ts @@ -84,4 +84,5 @@ export default { }, info: '使用者資訊', otherSetting: '其他設定', + username: '用户名' } diff --git a/ui/src/locales/lang/zh-Hant/views/chat-user.ts b/ui/src/locales/lang/zh-Hant/views/chat-user.ts new file mode 100644 index 000000000..119a4a49d --- /dev/null +++ b/ui/src/locales/lang/zh-Hant/views/chat-user.ts @@ -0,0 +1,10 @@ +export default { + title: '對話用戶', + syncUsers: '同步用戶', + setUserGroups: '設定用戶組', + autoAuthorization: '自動授權', + authorization: '授權', + group: { + title: '用戶組', + } +}; \ No newline at end of file diff --git a/ui/src/locales/lang/zh-Hant/views/index.ts b/ui/src/locales/lang/zh-Hant/views/index.ts index 002bce6ab..7b8fbb7f6 100644 --- a/ui/src/locales/lang/zh-Hant/views/index.ts +++ b/ui/src/locales/lang/zh-Hant/views/index.ts @@ -14,6 +14,7 @@ import document from './document' import paragraph from './paragraph' import problem from './problem' import chatLog from './chat-log' +import chatUser from './chat-user' import applicationWorkflow from './application-workflow' import login from './login' import operateLog from './operate-log' @@ -36,5 +37,6 @@ export default { login, operateLog, role, - workspace + workspace, + chatUser } diff --git a/ui/src/router/modules/application-detail.ts b/ui/src/router/modules/application-detail.ts index 47274f366..b302175aa 100644 --- a/ui/src/router/modules/application-detail.ts +++ b/ui/src/router/modules/application-detail.ts @@ -1,3 +1,5 @@ +import { ChatUserResourceEnum } from '@/enums/workspaceChatUser' + import { PermissionConst, RoleConst } from '@/utils/permission/data' const ApplicationDetailRouter = { @@ -63,6 +65,20 @@ const ApplicationDetailRouter = { }, component: () => import('@/views/hit-test/index.vue'), }, + { + path: 'chat-user', + name: 'applicationChatUser', + meta: { + icon: 'app-document', + iconActive: 'app-document-active', + title: 'views.chatUser.title', + active: 'chat-log', + parentPath: '/application/:id/:type', + parentName: 'ApplicationDetail', + resourceType: ChatUserResourceEnum.APPLICATION + }, + component: () => import('@/views/chat-user/index.vue') + }, { path: 'chat-log', name: 'ChatLog', diff --git a/ui/src/router/modules/document.ts b/ui/src/router/modules/document.ts index 5d1749225..4aeb182c3 100644 --- a/ui/src/router/modules/document.ts +++ b/ui/src/router/modules/document.ts @@ -1,3 +1,5 @@ +import { ChatUserResourceEnum } from '@/enums/workspaceChatUser' + const DocumentRouter = { path: '/knowledge/:id/:folderId', name: 'KnowledgeDetail', @@ -43,6 +45,20 @@ const DocumentRouter = { }, component: () => import('@/views/hit-test/index.vue'), }, + { + path: 'chat-user', + name: 'KnowledgeChatUser', + meta: { + icon: 'app-document', + iconActive: 'app-document-active', + title: 'views.chatUser.title', + active: 'chat-log', + parentPath: '/knowledge/:id/:folderId', + parentName: 'KnowledgeDetail', + resourceType: ChatUserResourceEnum.APPLICATION + }, + component: () => import('@/views/chat-user/index.vue') + }, { path: 'setting', name: 'KnowledgeSetting', diff --git a/ui/src/router/modules/system.ts b/ui/src/router/modules/system.ts index 9049a2a83..113d36dc1 100644 --- a/ui/src/router/modules/system.ts +++ b/ui/src/router/modules/system.ts @@ -111,7 +111,7 @@ const systemRouter = { meta: { icon: 'app-folder-share', iconActive: 'app-folder-share-active', - title: '对话用户', + title: 'views.chatUser.title', activeMenu: '/system', parentPath: '/system', parentName: 'system', @@ -121,7 +121,7 @@ const systemRouter = { path: '/system/chat/chat-user', name: 'ChatUser', meta: { - title: '对话用户', + title: 'views.chatUser.title', activeMenu: '/system', parentPath: '/system', parentName: 'system', @@ -132,7 +132,7 @@ const systemRouter = { path: '/system/chat/group', name: 'Group', meta: { - title: '用户组', + title: 'views.chatUser.group.title', activeMenu: '/system', parentPath: '/system', parentName: 'system', @@ -143,7 +143,7 @@ const systemRouter = { path: '/system/chat/authentication', name: 'Authentication', meta: { - title: '登录认证', + title: 'views.system.authentication.title', activeMenu: '/system', parentPath: '/system', parentName: 'system', diff --git a/ui/src/views/chat-user/index.vue b/ui/src/views/chat-user/index.vue new file mode 100644 index 000000000..dce81985a --- /dev/null +++ b/ui/src/views/chat-user/index.vue @@ -0,0 +1,260 @@ + + + + + \ No newline at end of file diff --git a/ui/src/views/system-chat-user/user-manage/index.vue b/ui/src/views/system-chat-user/user-manage/index.vue index 27970a56c..0faa1609b 100644 --- a/ui/src/views/system-chat-user/user-manage/index.vue +++ b/ui/src/views/system-chat-user/user-manage/index.vue @@ -1,48 +1,50 @@