Skip to content

Commit 8d08281

Browse files
authored
Merge pull request #257 from iceljc/features/refine-chat-window
Features/refine chat window
2 parents 07e002b + 42a1e95 commit 8d08281

File tree

24 files changed

+823
-31
lines changed

24 files changed

+823
-31
lines changed

src/lib/common/InPlaceEdit.svelte

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,19 +26,18 @@
2626
}
2727
2828
function submit() {
29+
editing = false;
2930
if (value != original) {
3031
dispatch('submit', value);
3132
}
32-
33-
editing = false;
3433
}
3534
3635
/** @param {any} event */
3736
function keydown(event) {
3837
if (event.key == 'Escape') {
3938
event.preventDefault()
4039
value = original;
41-
editing = false
40+
editing = false;
4241
}
4342
}
4443
@@ -63,7 +62,7 @@
6362
{:else}
6463
<!-- svelte-ignore a11y-click-events-have-key-events -->
6564
<!-- svelte-ignore a11y-no-static-element-interactions -->
66-
<div style="width: fit-content; min-width: 30%;" on:click={() => edit()}>
65+
<div style="width: fit-content; min-width: 30%;" class="clickable" on:click={() => edit()}>
6766
{#if !!value?.trim()}
6867
<span>{value}</span>
6968
{:else}

src/lib/helpers/constants.js

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,13 @@ export const CHAT_FRAME_ID = "chatbox-frame";
55
export const USER_SENDERS = [
66
UserRole.Admin,
77
UserRole.User,
8-
UserRole.Client
8+
UserRole.Client,
9+
UserRole.Root
10+
];
11+
12+
export const ADMIN_ROLES = [
13+
UserRole.Admin,
14+
UserRole.Root
915
];
1016

1117
export const BOT_SENDERS = [

src/lib/helpers/enums.js

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@ const userRole = {
44
User: "user",
55
Client: "client",
66
Function: "function",
7-
Assistant: "assistant"
7+
Assistant: "assistant",
8+
Root: "root"
89
};
910
export const UserRole = Object.freeze(userRole);
1011

@@ -115,4 +116,15 @@ const conversationTag = {
115116
Evaluation: "evaluation-set",
116117
Test: "test-set"
117118
};
118-
export const ConversationTag = Object.freeze(conversationTag);
119+
export const ConversationTag = Object.freeze(conversationTag);
120+
121+
const userPermission = {
122+
CreateAgent: "create-agent"
123+
};
124+
export const UserPermission = Object.freeze(userPermission);
125+
126+
const userAction = {
127+
Edit: "edit",
128+
Chat: "chat"
129+
};
130+
export const UserAction = Object.freeze(userAction);

src/lib/helpers/http.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,12 +61,14 @@ function skipLoader(config) {
6161
new RegExp('http(s*)://(.*?)/knowledge/(.*?)/search', 'g'),
6262
new RegExp('http(s*)://(.*?)/knowledge/vector/(.*?)/create', 'g'),
6363
new RegExp('http(s*)://(.*?)/knowledge/document/(.*?)/page', 'g'),
64+
new RegExp('http(s*)://(.*?)/users', 'g')
6465
];
6566

6667
const putRegexes = [
6768
new RegExp('http(s*)://(.*?)/knowledge/vector/(.*?)/update', 'g'),
6869
new RegExp('http(s*)://(.*?)/conversation/(.*?)/update-message', 'g'),
6970
new RegExp('http(s*)://(.*?)/conversation/(.*?)/update-tags', 'g'),
71+
new RegExp('http(s*)://(.*?)/users', 'g'),
7072
];
7173

7274
const deleteRegexes = [

src/lib/helpers/types/agentTypes.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@
5858
* @property {RoutingRule[]} routing_rules
5959
* @property {AgentWelcomeInfo} welcome_info - Welcome information.
6060
* @property {boolean} editable
61+
* @property {boolean} chatable
6162
*/
6263

6364

src/lib/helpers/types/userTypes.js

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,45 @@
77
* @property {string} [full_name] - The user full name.
88
* @property {string} [email] - The user email.
99
* @property {string} source - Account source.
10+
* @property {string?} [type] - Account source.
1011
* @property {string} [external_id] - The user external id.
12+
* @property {string[]} permissions - Permissions.
13+
* @property {UserAgentAction[]} agent_actions - Agent actions
1114
* @property {string} [create_date] - The user create date.
1215
* @property {string} [update_date] - The user update date.
1316
* @property {string} [role] - The user role.
1417
* @property {string} [avatar] - The user avatar.
1518
* @property {string} [color]
1619
* @property {string} [token]
20+
* @property {boolean} [open_detail]
21+
*/
22+
23+
/**
24+
* @typedef {Object} UserAgentAction
25+
* @property {string?} [id] - The id
26+
* @property {string} agent_id - The agent id
27+
* @property {import('$agentTypes').AgentModel} [agent] - The agent details
28+
* @property {string[]} actions - The actions
29+
*/
30+
31+
/**
32+
* @typedef {Object} UserAgentInnerAction
33+
* @property {string?} [id] - The id
34+
* @property {string} agent_id - The agent id
35+
* @property {string} [agent_name] - The agent name
36+
* @property {import('$agentTypes').AgentModel} [agent] - The agent details
37+
* @property {{ key: string, value: string, checked: boolean }[]} actions - The actions
38+
*/
39+
40+
/**
41+
* @typedef {Object} UserFilter
42+
* @property {number} page - The page number
43+
* @property {number} size - The page size
44+
* @property {string[]} [user_ids] - The user ids.
45+
* @property {string[]} [user_names] - The user names
46+
* @property {string[]} [roles] - The roles.
47+
* @property {string[]} [sources] - The sources.
48+
* @property {string[]} [external_ids] - The external ids.
1749
*/
1850

1951
export default {};

src/lib/scss/app.scss

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,7 @@ File: Main Css File
9292
@import "custom/pages/conversation";
9393
@import "custom/pages/agent";
9494
@import "custom/pages/knowledgebase";
95+
@import "custom/pages/users";
9596

9697
// Common
9798
@import "custom/common/animation";

src/lib/scss/custom/common/_common.scss

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -157,6 +157,11 @@ button:focus {
157157
justify-content:center;
158158
}
159159

160+
.div-center {
161+
display: flex;
162+
justify-content:center;
163+
}
164+
160165
.ellipsis {
161166
white-space: nowrap;
162167
overflow: hidden;
@@ -171,6 +176,10 @@ button:focus {
171176
.danger-background {
172177
background-color: $danger !important;
173178
}
179+
180+
.thin-scrollbar {
181+
scrollbar-width: thin;
182+
}
174183

175184
.markdown-container {
176185
overflow-x: auto;

src/lib/scss/custom/components/_chat.scss

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ $bubble-chat-theme-color: rgba($primary, 80%);
5454
width: 100%;
5555
z-index: 999;
5656
padding: 10px 15px;
57-
background-color: rgb(255, 255, 239);
57+
background-color: white;
5858
}
5959

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

0 commit comments

Comments
 (0)