Skip to content

Commit e8bb1bf

Browse files
author
Jicheng Lu
committed
refine log style
1 parent 99c3f6c commit e8bb1bf

File tree

5 files changed

+43
-30
lines changed

5 files changed

+43
-30
lines changed

src/lib/scss/custom/pages/_chat.scss

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -364,15 +364,15 @@
364364
background-color: black;
365365

366366
.log-close-btn {
367-
margin-top: 1.5rem;
368-
margin-bottom: 10px;
367+
margin-top: 1.2rem;
369368
position: sticky;
370369
display: flex;
371370
justify-content: space-between;
371+
height: 5vh;
372372
}
373373

374374
.state-log-section {
375-
height: 92vh;
375+
height: 90vh;
376376
}
377377

378378
.content-log-list {
@@ -390,7 +390,6 @@
390390

391391
.queue-change-log-list {
392392
width: 100%;
393-
height: 5vh;
394393
}
395394

396395
.log-list {
@@ -470,7 +469,7 @@
470469

471470
.log-content {
472471
text-align: center;
473-
font-size: 17px;
472+
font-size: 14px;
474473
margin-top: 2px;
475474
margin-bottom: 2px;
476475
}

src/routes/chat/[agentId]/[conversationId]/chat-box.svelte

Lines changed: 17 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -66,8 +66,8 @@
6666
/** @type {import('$types').UserModel} */
6767
export let currentUser;
6868
69-
// @ts-ignore
70-
let scrollbar;
69+
/** @type {any[]} */
70+
let scrollbars = [];
7171
let microphoneIcon = "microphone-off";
7272
7373
/** @type {import('$types').ChatResponseModel?} */
@@ -121,8 +121,12 @@
121121
signalr.onConversationMessageDeleted = onConversationMessageDeleted;
122122
await signalr.start(params.conversationId);
123123
124-
const scrollElement = document.querySelector('.chat-scrollbar');
125-
scrollbar = OverlayScrollbars(scrollElement, options);
124+
const scrollbarElements = [
125+
document.querySelector('.chat-scrollbar')
126+
].filter(Boolean);
127+
scrollbarElements.forEach(elem => {
128+
scrollbars = [ ...scrollbars, OverlayScrollbars(elem, options) ];
129+
});
126130
refresh();
127131
});
128132
@@ -210,10 +214,13 @@
210214
groupedDialogs = groupDialogs(dialogs);
211215
await tick();
212216
213-
setTimeout(() => {
214-
const { viewport } = scrollbar.elements();
215-
viewport.scrollTo({ top: viewport.scrollHeight, behavior: 'smooth' }); // set scroll offset
216-
}, 200);
217+
// @ts-ignore
218+
scrollbars.forEach(scrollbar => {
219+
setTimeout(() => {
220+
const { viewport } = scrollbar.elements();
221+
viewport.scrollTo({ top: viewport.scrollHeight, behavior: 'smooth' });
222+
}, 200);
223+
});
217224
}
218225
219226
/** @param {import('$types').ChatResponseModel[]} dialogs */
@@ -458,6 +465,7 @@
458465
isLoadContentLog = !isLoadContentLog;
459466
if (!isLoadContentLog) {
460467
contentLogs = [];
468+
agentQueueChangeLogs = [];
461469
isContentLogClosed = true;
462470
} else {
463471
isContentLogClosed = false;
@@ -472,6 +480,7 @@
472480
isLoadStateLog = !isLoadStateLog;
473481
if (!isLoadStateLog) {
474482
stateLogs = [];
483+
stateChangeLogs = [];
475484
isStateLogClosed = true;
476485
} else {
477486
isStateLogClosed = false;

src/routes/chat/[agentId]/[conversationId]/contentLogs/agent-queue-change-element.svelte

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,6 @@
77

88
<div class="log-element queue-change-container">
99
<div class="log-content queue-change-content">
10-
<span class="text-warning">{data?.log}</span>
10+
<span class="text-danger">{data?.log}</span>
1111
</div>
1212
</div>

src/routes/chat/[agentId]/[conversationId]/stateLogs/state-change-element.svelte

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
/** @type {string} */
77
let beforeActiveRoundText = '';
88
let afterActiveRoundText = '';
9+
const defaultKey = '-';
910
1011
$: {
1112
beforeActiveRoundText = buildActiveRoundText(data?.before_value, data?.before_active_rounds);
@@ -40,7 +41,7 @@
4041
<div class="log-content state-value-container">
4142
<div class="state-value">
4243
<div class="value">
43-
{`${data?.before_value || 'unknown'}`}
44+
{`${data?.before_value || defaultKey}`}
4445
</div>
4546
{#if !!beforeActiveRoundText}
4647
<div class="active-rounds">
@@ -50,7 +51,7 @@
5051
</div>
5152
<div class="state-value text-warning">
5253
<div class="value">
53-
{`${data?.after_value || 'unknown'}`}
54+
{`${data?.after_value || defaultKey}`}
5455
</div>
5556
{#if !!afterActiveRoundText}
5657
<div class="active-rounds">

src/routes/chat/[agentId]/[conversationId]/stateLogs/state-log.svelte

Lines changed: 18 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -80,20 +80,24 @@
8080
<div class="chat-log">
8181
<div class="card mb-0 log-background" style="height: 100%;">
8282
<div class="log-close-btn padding-side">
83-
<button
84-
type="button"
85-
class="btn btn-sm btn-secondary btn-rounded chat-send waves-effect waves-light"
86-
on:click={() => closeWindow()}
87-
>
88-
<i class="mdi mdi-window-close"></i>
89-
</button>
90-
<button
91-
type="button"
92-
class="btn btn-sm btn-secondary btn-rounded chat-send waves-effect waves-light"
93-
on:click={() => handleCleanScreen()}
94-
>
95-
<i class="bx bx-trash"></i>
96-
</button>
83+
<div>
84+
<button
85+
type="button"
86+
class="btn btn-sm btn-secondary btn-rounded chat-send waves-effect waves-light"
87+
on:click={() => closeWindow()}
88+
>
89+
<i class="mdi mdi-window-close"></i>
90+
</button>
91+
</div>
92+
<div>
93+
<button
94+
type="button"
95+
class="btn btn-sm btn-secondary btn-rounded chat-send waves-effect waves-light"
96+
on:click={() => handleCleanScreen()}
97+
>
98+
<i class="bx bx-trash"></i>
99+
</button>
100+
</div>
97101
</div>
98102
<div class="state-log-section">
99103
<Splitpanes horizontal>

0 commit comments

Comments
 (0)