Skip to content

Commit e0a7fe8

Browse files
feat: chat user
1 parent 8875bc9 commit e0a7fe8

File tree

11 files changed

+189
-21
lines changed

11 files changed

+189
-21
lines changed

ui/src/api/system/auth.ts

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
import {Result} from '@/request/Result'
2+
import {get, post, put} from '@/request/index'
3+
import {type Ref} from 'vue'
4+
5+
const prefix = '/system/auth'
6+
/**
7+
* 获取认证设置
8+
*/
9+
const getAuthSetting: (auth_type: string, loading?: Ref<boolean>) => Promise<Result<any>> = (auth_type, loading) => {
10+
return get(`${prefix}/${auth_type}/detail`, undefined, loading)
11+
}
12+
13+
/**
14+
* ldap连接测试
15+
*/
16+
const postAuthSetting: (data: any, loading?: Ref<boolean>) => Promise<Result<any>> = (
17+
data,
18+
loading
19+
) => {
20+
return post(`${prefix}/connection`, data, undefined, loading)
21+
}
22+
23+
/**
24+
* 修改邮箱设置
25+
*/
26+
const putAuthSetting: (auth_type: string, data: any, loading?: Ref<boolean>) => Promise<Result<any>> = (
27+
auth_type,
28+
data,
29+
loading
30+
) => {
31+
return put(`${prefix}/${auth_type}/info`, data, undefined, loading)
32+
}
33+
34+
export default {
35+
getAuthSetting,
36+
postAuthSetting,
37+
putAuthSetting
38+
}

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

Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
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'
5+
import type {ResetPasswordRequest} from "@/api/type/user.ts";
6+
7+
const prefix = '/system/chat_user'
8+
/**
9+
* 用户分页列表
10+
* @query 参数
11+
email_or_username: string
12+
*/
13+
const getUserManage: (
14+
page: pageRequest,
15+
email_or_username: string,
16+
loading?: Ref<boolean>,
17+
) => Promise<Result<any>> = (page, email_or_username, loading) => {
18+
return get(
19+
`${prefix}/${page.current_page}/${page.page_size}`,
20+
email_or_username ? { email_or_username } : undefined,
21+
loading,
22+
)
23+
}
24+
25+
/**
26+
* 删除用户
27+
* @param 参数 user_id,
28+
*/
29+
const delUserManage: (user_id: string, loading?: Ref<boolean>) => Promise<Result<boolean>> = (
30+
user_id,
31+
loading,
32+
) => {
33+
return del(`${prefix}/${user_id}`, undefined, {}, loading)
34+
}
35+
36+
/**
37+
* 创建用户
38+
*/
39+
const postUserManage: (data: any, loading?: Ref<boolean>) => Promise<Result<any>> = (
40+
data,
41+
loading,
42+
) => {
43+
return post(`${prefix}`, data, undefined, loading)
44+
}
45+
46+
/**
47+
* 编辑用户
48+
*/
49+
const putUserManage: (
50+
user_id: string,
51+
data: any,
52+
loading?: Ref<boolean>,
53+
) => Promise<Result<any>> = (user_id, data, loading) => {
54+
return put(`${prefix}/${user_id}`, data, undefined, loading)
55+
}
56+
57+
/**
58+
* 修改用户密码
59+
*/
60+
const putUserManagePassword: (
61+
user_id: string,
62+
data: any,
63+
loading?: Ref<boolean>
64+
) => Promise<Result<any>> = (user_id, data, loading) => {
65+
return put(`${prefix}/${user_id}/re_password`, data, undefined, loading)
66+
}
67+
68+
69+
export default {
70+
getUserManage,
71+
putUserManage,
72+
delUserManage,
73+
postUserManage,
74+
putUserManagePassword,
75+
}
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
import { Result } from '@/request/Result'
2+
import { get, post, del, put } from '@/request/index'
3+
import { type Ref } from 'vue'
4+
5+
const prefix = '/platform'
6+
const getPlatformInfo: (loading?: Ref<boolean>) => Promise<Result<any>> = (loading) => {
7+
return get(`${prefix}/source`, undefined, loading)
8+
}
9+
10+
const updateConfig: (data: any, loading?: Ref<boolean>) => Promise<Result<any>> = (
11+
data,
12+
loading
13+
) => {
14+
return post(`${prefix}/source`, data, undefined, loading)
15+
}
16+
17+
const validateConnection: (data: any, loading?: Ref<boolean>) => Promise<Result<any>> = (
18+
data,
19+
loading
20+
) => {
21+
return put(`${prefix}/source`, data, undefined, loading)
22+
}
23+
export default {
24+
getPlatformInfo,
25+
updateConfig,
26+
validateConnection
27+
}

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

Lines changed: 38 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ export default {
44
shared: '共享',
55
shared_resources: '共享资源',
66
share_knowledge: '共享知识库',
7-
authorized_workspace:'授权工作空间',
7+
authorized_workspace: '授权工作空间',
88
test: '测试连接',
99
testSuccess: '测试连接成功',
1010
testFailed: '测试连接失败',
@@ -23,7 +23,7 @@ export default {
2323
ldap_filterPlaceholder: '请输入用户过滤器',
2424
ldap_mapping: 'LDAP 属性映射',
2525
ldap_mappingPlaceholder: '请输入 LDAP 属性映射',
26-
enableAuthentication: '启用 LDAP 认证'
26+
enableAuthentication: '启用 LDAP 认证',
2727
},
2828
cas: {
2929
title: 'CAS',
@@ -33,7 +33,7 @@ export default {
3333
validateUrlPlaceholder: '请输入验证地址',
3434
redirectUrl: '回调地址',
3535
redirectUrlPlaceholder: '请输入回调地址',
36-
enableAuthentication: '启用 CAS 认证'
36+
enableAuthentication: '启用 CAS 认证',
3737
},
3838
oidc: {
3939
title: 'OIDC',
@@ -52,7 +52,7 @@ export default {
5252
logoutEndpointPlaceholder: '请输入注销端地址',
5353
redirectUrl: '回调地址',
5454
redirectUrlPlaceholder: '请输入回调地址',
55-
enableAuthentication: '启用 OIDC 认证'
55+
enableAuthentication: '启用 OIDC 认证',
5656
},
5757

5858
oauth2: {
@@ -73,7 +73,7 @@ export default {
7373
redirectUrlPlaceholder: '请输入回调地址',
7474
filedMapping: '字段映射',
7575
filedMappingPlaceholder: '请输入字段映射',
76-
enableAuthentication: '启用 OAuth2 认证'
76+
enableAuthentication: '启用 OAuth2 认证',
7777
},
7878
scanTheQRCode: {
7979
title: '扫码登录',
@@ -95,8 +95,8 @@ export default {
9595
larkQrCode: '飞书扫码登录',
9696
dingtalkQrCode: '钉钉扫码登录',
9797
setting: '设置',
98-
access: '接入'
99-
}
98+
access: '接入',
99+
},
100100
},
101101
theme: {
102102
title: '外观设置',
@@ -136,7 +136,7 @@ export default {
136136
abandonUpdate: '放弃更新',
137137
saveAndApply: '保存并应用',
138138
fileMessageError: '文件大小超过 10M',
139-
saveSuccess: '外观设置成功'
139+
saveSuccess: '外观设置成功',
140140
},
141141
email: {
142142
title: '邮箱设置',
@@ -151,6 +151,34 @@ export default {
151151
smtpPassword: '发件人密码',
152152
smtpPasswordPlaceholder: '请输入发件人密码',
153153
enableSSL: '启用 SSL(如果 SMTP 端口是 465,通常需要启用 SSL)',
154-
enableTLS: '启用 TLS(如果 SMTP 端口是 587,通常需要启用 TLS)'
155-
}
154+
enableTLS: '启用 TLS(如果 SMTP 端口是 587,通常需要启用 TLS)',
155+
},
156+
group: {
157+
title: '团队成员',
158+
member: '成员',
159+
manage: '所有者',
160+
permissionSetting: '权限设置',
161+
addMember: '添加成员',
162+
addSubTitle: '成员登录后可以访问到您授权的数据。',
163+
searchBar: {
164+
placeholder: '请输入用户名搜索',
165+
},
166+
delete: {
167+
button: '移除',
168+
confirmTitle: '是否移除成员:',
169+
confirmMessage: '移除后将会取消成员拥有的知识库和应用权限。',
170+
},
171+
setting: {
172+
management: '管理',
173+
check: '查看',
174+
},
175+
176+
form: {
177+
userName: {
178+
label: '用户名/邮箱',
179+
placeholder: '请输入成员的用户名或邮箱',
180+
requiredMessage: '请输入用户名/邮箱',
181+
},
182+
},
183+
},
156184
}

ui/src/views/system-chat-user/authentication/component/CAS.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@
5454
</template>
5555
<script setup lang="ts">
5656
import { reactive, ref, watch, onMounted } from 'vue'
57-
import authApi from '@/api/system-settings/auth-setting'
57+
import authApi from '@/api/system/auth'
5858
import type { FormInstance, FormRules } from 'element-plus'
5959
import { t } from '@/locales'
6060
import { MsgSuccess } from '@/utils/message'

ui/src/views/system-chat-user/authentication/component/EditModal.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ template
5252
<script setup lang="ts">
5353
import { reactive, ref } from 'vue'
5454
import { ElForm } from 'element-plus'
55-
import platformApi from '@/api/system-settings/platform-source'
55+
import platformApi from '@/api/system/platform-source'
5656
import { MsgError, MsgSuccess } from '@/utils/message'
5757
import { t } from '@/locales'
5858

ui/src/views/system-chat-user/authentication/component/LDAP.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@
7979
</template>
8080
<script setup lang="ts">
8181
import { reactive, ref, watch, onMounted } from 'vue'
82-
import authApi from '@/api/system-settings/auth-setting'
82+
import authApi from '@/api/system/auth'
8383
import type { FormInstance, FormRules } from 'element-plus'
8484
import { t } from '@/locales'
8585
import { MsgSuccess } from '@/utils/message'

ui/src/views/system-chat-user/authentication/component/OAuth2.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@
100100
</template>
101101
<script setup lang="ts">
102102
import { reactive, ref, onMounted } from 'vue'
103-
import authApi from '@/api/system-settings/auth-setting'
103+
import authApi from '@/api/system/auth'
104104
import type { FormInstance, FormRules } from 'element-plus'
105105
import { t } from '@/locales'
106106
import { MsgSuccess } from '@/utils/message'

ui/src/views/system-chat-user/authentication/component/OIDC.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@
9797
</template>
9898
<script setup lang="ts">
9999
import { reactive, ref, watch, onMounted } from 'vue'
100-
import authApi from '@/api/system-settings/auth-setting'
100+
import authApi from '@/api/system/auth'
101101
import type { FormInstance, FormRules } from 'element-plus'
102102
import { t } from '@/locales'
103103
import { MsgSuccess } from '@/utils/message'

ui/src/views/system-chat-user/authentication/component/SCAN.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@
8989
import { reactive, ref, onMounted } from 'vue'
9090
import { copyClick } from '@/utils/clipboard'
9191
import EditModel from './EditModal.vue'
92-
import platformApi from '@/api/system-settings/platform-source'
92+
import platformApi from '@/api/system/platform-source'
9393
import { MsgError, MsgSuccess } from '@/utils/message'
9494
import { t } from '@/locales'
9595

0 commit comments

Comments
 (0)