Skip to content

Commit f1d9bfa

Browse files
committed
refactor: chat user
1 parent d0ba494 commit f1d9bfa

File tree

8 files changed

+66
-15
lines changed

8 files changed

+66
-15
lines changed

ui/src/api/chat-user/chat-user.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ const getUserGroupList: (resource: ChatUserResourceParams, loading?: Ref<boolean
2323
* 修改用户组列表授权
2424
*/
2525
const editUserGroupList: (resource: ChatUserResourceParams, data: { user_group_id: string, is_auth: boolean }[], loading?: Ref<boolean>) => Promise<Result<any>> = (resource, data, loading) => {
26-
return put(`${prefix}/${resource.resource_type}/${resource.resource_id}/user_group`, data, undefined, loading)
26+
return put(`${prefix.value}/${resource.resource_type}/${resource.resource_id}/user_group`, data, undefined, loading)
2727
}
2828

2929
/**
Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,19 @@
11
export default {
22
title: 'Chat users',
3-
syncUsers: 'Sync users',
4-
setUserGroups: 'Set user groups',
3+
syncUsers: 'Synchronize users',
4+
setUserGroups: 'Configure user groups',
5+
knowledgeTitleTip: 'This configuration will only take effect when the associated application enables chat user login authentication',
6+
applicationTitleTip: 'This configuration requires login authentication to be enabled in the application',
57
autoAuthorization: 'Auto authorization',
68
authorization: 'Authorization',
79
group: {
810
title: 'User groups',
11+
name: 'User group name',
12+
usernameOrName: 'Username/Name',
13+
delete: {
14+
confirmTitle: 'Confirm to delete user group:',
15+
confirmMessage: 'After deletion, all members in this user group will be removed. Please proceed with caution!',
16+
},
17+
batchDeleteMember: 'Remove selected {count} members?',
918
}
1019
};

ui/src/locales/lang/zh-CN/views/chat-user.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@ export default {
22
title: '对话用户',
33
syncUsers: '同步用户',
44
setUserGroups: '设置用户组',
5+
knowledgeTitleTip: '该配置需要关联的应用开启对话用户登录认证后才会生效',
6+
applicationTitleTip: '该配置需要应用开启登录认证后生效',
57
autoAuthorization: '自动授权',
68
authorization: '授权',
79
group: {

ui/src/locales/lang/zh-Hant/views/chat-user.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,18 @@ export default {
22
title: '對話用戶',
33
syncUsers: '同步用戶',
44
setUserGroups: '設定用戶組',
5+
knowledgeTitleTip: '該配置需要關聯的應用開啟對話用戶登入認證後才會生效',
6+
applicationTitleTip: '該配置需要應用開啟登入認證後生效',
57
autoAuthorization: '自動授權',
68
authorization: '授權',
79
group: {
810
title: '用戶組',
11+
name: '用戶組名稱',
12+
usernameOrName: '用戶名/姓名',
13+
delete: {
14+
confirmTitle: '是否刪除用戶組:',
15+
confirmMessage: '刪除後,該用戶組下的成員將全部移除,請謹慎操作!',
16+
},
17+
batchDeleteMember: '是否移除選中的 {count} 個成員?',
918
}
1019
};

ui/src/router/modules/document.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ const DocumentRouter = {
5555
active: 'chat-log',
5656
parentPath: '/knowledge/:id/:folderId',
5757
parentName: 'KnowledgeDetail',
58-
resourceType: ChatUserResourceEnum.APPLICATION
58+
resourceType: ChatUserResourceEnum.KNOWLEDGE
5959
},
6060
component: () => import('@/views/chat-user/index.vue')
6161
},

ui/src/views/chat-user/index.vue

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,8 @@
33
<template #header>
44
<div>
55
<h2>{{ $t('views.chatUser.title') }}</h2>
6-
<div class="color-secondary">{{ $t('views.user.title') }}</div>
6+
<div class="color-secondary">{{ resource.resource_type === ChatUserResourceEnum.APPLICATION ?
7+
$t('views.chatUser.applicationTitleTip') : $t('views.chatUser.knowledgeTitleTip') }}</div>
78
</div>
89
</template>
910
<el-card style="--el-card-padding: 0" class="user-card">
@@ -109,7 +110,7 @@ import { ChatUserResourceEnum } from '@/enums/workspaceChatUser'
109110
import { MsgSuccess } from '@/utils/message'
110111
111112
const route = useRoute()
112-
const resource: ChatUserResourceParams = { resource_id: route.params.id as string, resource_type: route.meta.resourceType as ChatUserResourceEnum }
113+
const resource: ChatUserResourceParams = reactive({ resource_id: route.params.id as string, resource_type: route.meta.resourceType as ChatUserResourceEnum })
113114
114115
const filterText = ref('')
115116
const loading = ref(false)

ui/src/views/system-chat-user/group/index.vue

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,11 @@
22
<ContentContainer>
33
<template #header>
44
<div class="shared-header">
5-
<span class="title">{{ t('views.system.shared_resources') }}</span>
5+
<span class="title">{{ t('views.chatUser.title') }}</span>
66
<el-icon size="12">
77
<rightOutlined></rightOutlined>
88
</el-icon>
9-
<span class="sub-title">{{ t('views.knowledge.title') }}</span>
9+
<span class="sub-title">{{ t('views.chatUser.group.title') }}</span>
1010
</div>
1111
</template>
1212
<el-card style="--el-card-padding: 0" class="user-card">
@@ -293,6 +293,23 @@ function handleDeleteUser(item?: ChatUserGroupUserItem) {
293293
</script>
294294

295295
<style lang="scss" scoped>
296+
.shared-header {
297+
color: #646a73;
298+
font-weight: 400;
299+
font-size: 14px;
300+
line-height: 22px;
301+
display: flex;
302+
align-items: center;
303+
304+
:deep(.el-icon i) {
305+
height: 12px;
306+
}
307+
308+
.sub-title {
309+
color: #1f2329;
310+
}
311+
}
312+
296313
.content-container {
297314
height: 100%;
298315
display: flex;

ui/src/views/system-chat-user/user-manage/index.vue

Lines changed: 20 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,11 @@
22
<ContentContainer>
33
<template #header>
44
<div class="shared-header">
5-
<span class="title">{{ t('views.system.shared_resources') }}</span>
5+
<span class="title">{{ t('views.chatUser.title') }}</span>
66
<el-icon size="12">
77
<rightOutlined></rightOutlined>
88
</el-icon>
9-
<span class="sub-title">{{ t('views.knowledge.title') }}</span>
9+
<span class="sub-title">{{ t('views.chatUser.title') }}</span>
1010
</div>
1111
</template>
1212
<el-card class="h-full">
@@ -59,11 +59,7 @@
5959
</template>
6060
</el-table-column>
6161

62-
<el-table-column
63-
prop="email"
64-
:label="$t('views.login.loginForm.email.label')"
65-
show-overflow-tooltip
66-
>
62+
<el-table-column prop="email" :label="$t('views.login.loginForm.email.label')" show-overflow-tooltip>
6763
<template #default="{ row }">
6864
{{ row.email || '-' }}
6965
</template>
@@ -264,6 +260,23 @@ onMounted(() => {
264260
</script>
265261

266262
<style lang="scss" scoped>
263+
.shared-header {
264+
color: #646a73;
265+
font-weight: 400;
266+
font-size: 14px;
267+
line-height: 22px;
268+
display: flex;
269+
align-items: center;
270+
271+
:deep(.el-icon i) {
272+
height: 12px;
273+
}
274+
275+
.sub-title {
276+
color: #1f2329;
277+
}
278+
}
279+
267280
.content-container {
268281
height: 100%;
269282
display: flex;

0 commit comments

Comments
 (0)