Skip to content

Commit 358c49a

Browse files
authored
Merge pull request #275 from iceljc/features/refine-chat-window
Features/refine chat window
2 parents ef71903 + 02aa068 commit 358c49a

File tree

21 files changed

+1006
-220
lines changed

21 files changed

+1006
-220
lines changed

src/lib/common/Loader.svelte

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,13 @@
33
44
export let disableDefaultStyles = false;
55
export let containerClasses = '';
6+
export let containerStyles = '';
67
export let size = 100;
78
</script>
89

9-
<div class="{disableDefaultStyles ? '' : 'loader'} {containerClasses}">
10+
<div
11+
class="{disableDefaultStyles ? '' : 'loader'} {containerClasses}"
12+
style={`${containerStyles}`}
13+
>
1014
<Circle {size} color="var(--bs-primary)" unit="px" duration="1s" />
1115
</div>

src/lib/helpers/enums.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,8 @@ export const UserPermission = Object.freeze(userPermission);
125125

126126
const userAction = {
127127
Edit: "edit",
128+
Train: "train",
129+
Evaluate: "evaluate",
128130
Chat: "chat"
129131
};
130132
export const UserAction = Object.freeze(userAction);

src/lib/helpers/http.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,10 @@ function skipLoader(config) {
8585
new RegExp('http(s*)://(.*?)/conversation/(.*?)/files/(.*?)', 'g'),
8686
new RegExp('http(s*)://(.*?)/llm-provider/(.*?)/models', 'g'),
8787
new RegExp('http(s*)://(.*?)/knowledge/vector/collections', 'g'),
88-
new RegExp('http(s*)://(.*?)/knowledge/vector/(.*?)/exist', 'g')
88+
new RegExp('http(s*)://(.*?)/knowledge/vector/(.*?)/exist', 'g'),
89+
new RegExp('http(s*)://(.*?)/role/options', 'g'),
90+
new RegExp('http(s*)://(.*?)/role/(.*?)/details', 'g'),
91+
new RegExp('http(s*)://(.*?)/user/(.*?)/details', 'g'),
8992
];
9093

9194
if (config.method === 'post' && postRegexes.some(regex => regex.test(config.url || ''))) {

src/lib/helpers/types/agentTypes.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,8 @@
6060
* @property {AgentWelcomeInfo} welcome_info - Welcome information.
6161
* @property {boolean} editable
6262
* @property {boolean} chatable
63+
* @property {boolean} trainable
64+
* @property {boolean} evaluable
6365
*/
6466

6567

src/lib/helpers/types/roleTypes.js

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
/**
2+
* @typedef {Object} RoleModel
3+
* @property {string} id - The user id.
4+
* @property {string} [name] - Role name
5+
* @property {string[]} permissions - Permissions.
6+
* @property {RoleAgentAction[]} agent_actions - Agent actions
7+
* @property {string} [create_date] - The user create date.
8+
* @property {string} [update_date] - The user update date.
9+
* @property {boolean} [open_detail]
10+
*/
11+
12+
/**
13+
* @typedef {Object} RoleAgentAction
14+
* @property {string?} [id] - The id
15+
* @property {string} agent_id - The agent id
16+
* @property {import('$agentTypes').AgentModel} [agent] - The agent details
17+
* @property {string[]} actions - The actions
18+
*/
19+
20+
/**
21+
* @typedef {Object} RoleAgentInnerAction
22+
* @property {string?} [id] - The id
23+
* @property {string} agent_id - The agent id
24+
* @property {string} [agent_name] - The agent name
25+
* @property {import('$agentTypes').AgentModel} [agent] - The agent details
26+
* @property {{ key: string, value: string, checked: boolean }[]} actions - The actions
27+
*/
28+
29+
/**
30+
* @typedef {Object} RoleFilter
31+
* @property {string[]} [names] - The role names.
32+
*/
33+
34+
export default {};

src/lib/helpers/types/userTypes.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@
4444
* @property {string[]} [user_ids] - The user ids.
4545
* @property {string[]} [user_names] - The user names
4646
* @property {string[]} [roles] - The roles.
47+
* @property {string[]} [types] - The types.
4748
* @property {string[]} [sources] - The sources.
4849
* @property {string[]} [external_ids] - The external ids.
4950
*/

src/lib/scss/app.scss

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,7 @@ File: Main Css File
9494
@import "custom/pages/agent";
9595
@import "custom/pages/knowledgebase";
9696
@import "custom/pages/users";
97+
@import "custom/pages/roles";
9798

9899
// Common
99100
@import "custom/common/animation";
Lines changed: 120 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,120 @@
1+
.roles-table {
2+
.role-plain-col {
3+
width: 10%;
4+
max-width: 100px;
5+
}
6+
7+
.role-permission-col {
8+
width: 40%;
9+
max-width: 300px;
10+
}
11+
12+
.role-detail {
13+
padding: 2px 5px;
14+
border-radius: 3px;
15+
border-color: var(--#{$prefix}light) !important;
16+
background-color: var(--#{$prefix}light) !important;
17+
position: relative;
18+
19+
ul {
20+
li {
21+
margin: 2px 0px;
22+
}
23+
}
24+
25+
.wrappable {
26+
white-space: wrap !important;
27+
}
28+
29+
.basic-info {
30+
margin: 15px 0px 0px 0px;
31+
display: flex;
32+
flex-wrap: wrap;
33+
34+
li {
35+
flex: 0 0 50%;
36+
37+
.inline-edit {
38+
display: flex;
39+
gap: 3px;
40+
}
41+
}
42+
}
43+
44+
.role-permission-container {
45+
display: flex;
46+
gap: 5px;
47+
48+
.permission-wrapper {
49+
display: flex;
50+
flex-direction: column;
51+
gap: 3px;
52+
53+
.edit-wrapper {
54+
display: flex;
55+
gap: 3px;
56+
}
57+
58+
input[type="text"] {
59+
height: 30px;
60+
font-size: 12px;
61+
}
62+
}
63+
64+
65+
.list-add {
66+
font-size: 18px;
67+
}
68+
}
69+
70+
.role-agent-container {
71+
margin: 20px 0px;
72+
padding: 0px 2rem;
73+
74+
.action-row-wrapper {
75+
overflow-y: auto;
76+
scrollbar-width: thin;
77+
height: fit-content;
78+
max-height: 300px;
79+
}
80+
81+
.action-row {
82+
display: flex;
83+
}
84+
85+
.action-col {
86+
padding: 3px 0px;
87+
border-bottom: 1px dotted var(--bs-primary);
88+
89+
input[type='checkbox'] {
90+
outline: none !important;
91+
box-shadow: none !important;
92+
}
93+
}
94+
95+
.action-title {
96+
.action-title-wrapper {
97+
display: flex;
98+
gap: 3px;
99+
justify-content: center;
100+
text-transform: capitalize;
101+
text-align: center;
102+
border-bottom: 2px solid var(--bs-primary);
103+
}
104+
}
105+
106+
.action-center {
107+
display: flex;
108+
justify-content: center;
109+
}
110+
}
111+
112+
.edit-btn {
113+
display: flex;
114+
justify-content: flex-end;
115+
font-size: 16px;
116+
margin-top: 3px;
117+
margin-right: 5px;
118+
}
119+
}
120+
}

src/lib/scss/custom/pages/_users.scss

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,6 @@
88
width: 20%;
99
max-width: 300px;
1010
}
11-
12-
.user-agent-col {
13-
width: 25%;
14-
max-width: 350px;
15-
}
1611

1712
.user-detail {
1813
padding: 2px 5px;
@@ -46,6 +41,14 @@
4641
}
4742
}
4843

44+
.role-wrapper {
45+
.role-select {
46+
height: 30px;
47+
font-size: 12px;
48+
padding: 0.3rem 1rem;
49+
}
50+
}
51+
4952
.user-permission-container {
5053
display: flex;
5154
gap: 5px;
@@ -89,6 +92,7 @@
8992

9093
.action-col {
9194
padding: 3px 0px;
95+
border-bottom: 1px dotted var(--bs-primary);
9296

9397
input[type='checkbox'] {
9498
outline: none !important;

src/lib/services/api-endpoints.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,17 @@ import { PUBLIC_SERVICE_URL } from '$env/static/public';
22
export const host = PUBLIC_SERVICE_URL;
33

44
export const endpoints = {
5+
// role
6+
roleOptionsUrl: `${host}/role/options`,
7+
rolesUrl: `${host}/roles`,
8+
roleDetailUrl: `${host}/role/{id}/details`,
9+
roleUpdateUrl: `${host}/role`,
10+
511
// user
612
tokenUrl: `${host}/token`,
713
myInfoUrl: `${host}/user/me`,
814
usersUrl: `${host}/users`,
15+
userDetailUrl: `${host}/user/{id}/details`,
916
userUpdateUrl: `${host}/user`,
1017
usrCreationUrl: `${host}/user`,
1118
userAvatarUrl: `${host}/user/avatar`,

0 commit comments

Comments
 (0)