Skip to content

Commit d86ad90

Browse files
committed
feat: applicationChatUser
1 parent a892f30 commit d86ad90

File tree

18 files changed

+532
-92
lines changed

18 files changed

+532
-92
lines changed

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

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
import type { Ref } from 'vue'
2+
import { Result } from '@/request/Result'
3+
import { get, put } from '@/request/index'
4+
import type { ChatUserGroupItem, ChatUserGroupUserItem, ChatUserResourceParams, putUserGroupUserParams } from '@/api/type/workspaceChatUser'
5+
import type { pageRequest, PageList } from '@/api/type/common'
6+
const prefix = '/workspace/' + localStorage.getItem('workspace_id')
7+
8+
/**
9+
* 获取用户组列表
10+
*/
11+
const getUserGroupList: (resource: ChatUserResourceParams, loading?: Ref<boolean>) => Promise<Result<ChatUserGroupItem[]>> = (resource, loading) => {
12+
return get(`${prefix}/${resource.resource_type}/${resource.resource_id}/user_group`, undefined, loading)
13+
}
14+
15+
/**
16+
* 获取用户组的用户列表
17+
*/
18+
const getUserGroupUserList: (
19+
resource: ChatUserResourceParams,
20+
user_group_id: string,
21+
page: pageRequest,
22+
param: any,
23+
loading?: Ref<boolean>,
24+
) => Promise<Result<PageList<ChatUserGroupUserItem[]>>> = (resource, user_group_id, page, param, loading) => {
25+
return get(
26+
`${prefix}/${resource.resource_type}/${resource.resource_id}/user_group_id/${user_group_id}/${page.current_page}/${page.page_size}`,
27+
param,
28+
loading,
29+
)
30+
}
31+
32+
/**
33+
* 更新用户组的用户列表
34+
*/
35+
const putUserGroupUser: (
36+
resource: ChatUserResourceParams,
37+
user_group_id: string,
38+
data: putUserGroupUserParams[],
39+
loading?: Ref<boolean>,
40+
) => Promise<Result<boolean>> = (resource, user_group_id, data, loading) => {
41+
return put(`${prefix}/${resource.resource_type}/${resource.resource_id}/user_group_id/${user_group_id}`, data, undefined, loading)
42+
}
43+
44+
export default {
45+
getUserGroupList,
46+
getUserGroupUserList,
47+
putUserGroupUser
48+
}

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

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,22 @@
1-
import {Result} from '@/request/Result'
2-
import {get, put, post, del} from '@/request/index'
3-
import type {pageRequest} from '@/api/type/common'
4-
import type {Ref} from 'vue'
1+
import { Result } from '@/request/Result'
2+
import { get, put, post, del } from '@/request/index'
3+
import type { pageRequest } from '@/api/type/common'
4+
import type { Ref } from 'vue'
55

66
const prefix = '/system/chat_user'
77
/**
88
* 用户分页列表
99
* @query 参数
10-
email_or_username: string
10+
username_or_nickname: string
1111
*/
1212
const getUserManage: (
1313
page: pageRequest,
14-
email_or_username: string,
14+
username_or_nickname: string,
1515
loading?: Ref<boolean>,
16-
) => Promise<Result<any>> = (page, email_or_username, loading) => {
16+
) => Promise<Result<any>> = (page, username_or_nickname, loading) => {
1717
return get(
1818
`${prefix}/user_manage/${page.current_page}/${page.page_size}`,
19-
email_or_username ? {email_or_username} : undefined,
19+
username_or_nickname ? { username_or_nickname } : undefined,
2020
loading,
2121
)
2222
}
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
2+
import { ChatUserResourceEnum } from '@/enums/workspaceChatUser'
3+
4+
interface ChatUserResourceParams {
5+
resource_id: string,
6+
resource_type: ChatUserResourceEnum
7+
}
8+
9+
interface ChatUserGroupItem {
10+
id: string,
11+
name: string,
12+
is_auth: boolean
13+
}
14+
15+
interface ChatUserGroupUserItem {
16+
id: string,
17+
is_auth: boolean,
18+
email: string,
19+
phone: string,
20+
nick_name: string,
21+
username: string,
22+
password: string,
23+
source: string,
24+
is_active: boolean,
25+
create_time: string,
26+
update_time: string,
27+
}
28+
29+
interface putUserGroupUserParams {
30+
chat_user_id: string,
31+
is_auth: boolean
32+
}
33+
export type { ChatUserGroupItem, putUserGroupUserParams, ChatUserResourceParams, ChatUserGroupUserItem }

ui/src/enums/workspaceChatUser.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
export enum ChatUserResourceEnum {
2+
KNOWLEDGE = 'KNOWLEDGE',
3+
APPLICATION = 'APPLICATION',
4+
}

ui/src/locales/lang/en-US/common.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,4 +84,5 @@ export default {
8484
},
8585
info: 'Base Information',
8686
otherSetting: 'Other Settings',
87+
username: 'username'
8788
}
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
export default {
2+
title: 'Chat users',
3+
syncUsers: 'Sync users',
4+
setUserGroups: 'Set user groups',
5+
autoAuthorization: 'Auto authorization',
6+
authorization: 'Authorization',
7+
group: {
8+
title: 'User groups',
9+
}
10+
};

ui/src/locales/lang/en-US/views/index.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ import document from './document'
1414
import paragraph from './paragraph'
1515
import problem from './problem'
1616
import chatLog from './chat-log'
17+
import chatUser from './chat-user'
1718
import applicationWorkflow from './application-workflow'
1819
import login from './login'
1920
import operateLog from './operate-log'
@@ -36,5 +37,6 @@ export default {
3637
login,
3738
operateLog,
3839
role,
39-
workspace
40+
workspace,
41+
chatUser
4042
}

ui/src/locales/lang/zh-CN/common.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,4 +88,5 @@ export default {
8888
},
8989
info: '基本信息',
9090
otherSetting: '其他设置',
91+
username: '用户名'
9192
}
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
export default {
2+
title: '对话用户',
3+
syncUsers: '同步用户',
4+
setUserGroups: '设置用户组',
5+
autoAuthorization: '自动授权',
6+
authorization: '授权',
7+
group: {
8+
title: '用户组',
9+
}
10+
}

ui/src/locales/lang/zh-CN/views/index.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ import applicationOverview from './application-overview'
1414
import applicationWorkflow from './application-workflow'
1515
import paragraph from './paragraph'
1616
import chatLog from './chat-log'
17+
import chatUser from './chat-user'
1718
// import notFound from './404'
1819

1920
// import operateLog from './operate-log'
@@ -34,6 +35,7 @@ export default {
3435
applicationWorkflow,
3536
paragraph,
3637
chatLog,
38+
chatUser,
3739
// notFound,
3840

3941
// operateLog

0 commit comments

Comments
 (0)