Skip to content

Commit dc23978

Browse files
authored
Merge pull request #464 from iceljc/main
fix log scrolling
2 parents 0140403 + 60de090 commit dc23978

4 files changed

Lines changed: 24 additions & 34 deletions

File tree

src/lib/styles/pages/_chat.scss

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2959,13 +2959,6 @@
29592959
flex-direction: column;
29602960
gap: 20px;
29612961
padding: 0 20px;
2962-
overflow-y: scroll;
2963-
scrollbar-width: none;
2964-
2965-
2966-
&::-webkit-scrollbar {
2967-
display: none;
2968-
}
29692962
}
29702963

29712964

@@ -2984,6 +2977,7 @@
29842977
background: linear-gradient(180deg, rgb(15 21 36) 0%, rgb(9 13 24) 100%);
29852978
border-radius: 12px;
29862979
border: 1px solid color-mix(in srgb, var(--color-secondary) 30%, transparent);
2980+
margin: 10px 0 14px 0;
29872981
display: flex;
29882982
flex-direction: column;
29892983
position: relative;

src/routes/chat/[agentId]/[conversationId]/agent-info/chat-agent-info.svelte

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,16 @@
77
* }}
88
*/
99
let { agent } = $props();
10+
11+
/** @param {number} count @param {string} singular @param {string} plural */
12+
const pluralize = (count, singular, plural) => `${count || 0} ${count > 1 ? plural : singular}`;
13+
14+
let stats = $derived([
15+
agent?.profiles && pluralize(agent.profiles.length, 'profile', 'profiles'),
16+
agent?.functions && pluralize(agent.functions.length, 'function', 'functions'),
17+
agent?.utilities && pluralize(agent.utilities.length, 'utility', 'utilities'),
18+
agent?.mcp_tools && pluralize(agent.mcp_tools.length, 'MCP', 'MCPs')
19+
].filter(Boolean).join(', '));
1020
</script>
1121
1222
<div class="cai-wrapper">
@@ -34,18 +44,7 @@
3444
</div>
3545
<div class="cai-row">
3646
<div class="cai-meta">
37-
{#if !!agent?.profiles}
38-
<span>{agent?.profiles?.length || 0} {agent?.profiles?.length > 1 ? 'profiles' : 'profile'}{', '}</span>
39-
{/if}
40-
{#if !!agent?.functions}
41-
<span>{agent?.functions?.length || 0} {agent?.functions?.length > 1 ? 'functions' : 'function'}{', '}</span>
42-
{/if}
43-
{#if !!agent?.utilities}
44-
<span>{agent?.utilities?.length || 0} {agent?.utilities?.length > 1 ? 'utilities' : 'utility'}{', '}</span>
45-
{/if}
46-
{#if !!agent?.mcp_tools}
47-
<span>{agent?.mcp_tools?.length || 0} {agent?.mcp_tools?.length > 1 ? 'MCPs' : 'MCP'}</span>
48-
{/if}
47+
<span>{stats}</span>
4948
</div>
5049
</div>
5150
</div>

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

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -52,25 +52,33 @@
5252
agentQueueLogs;
5353
latestStateLog;
5454
55+
initScrollbars();
5556
scrollToBottom();
5657
});
5758
5859
onDestroy(() => {
5960
cleanLogs();
6061
});
6162
62-
let _scrollScheduled = false;
63-
function scrollToBottom() {
63+
function initScrollbars() {
6464
const scrollbarElements = [
65+
document.querySelector('.instant-log-scrollbar'),
6566
document.querySelector('.latest-state-log-scrollbar'),
6667
document.querySelector('.msg-state-log-scrollbar'),
6768
document.querySelector('.agent-queue-log-scrollbar')
6869
].filter(Boolean);
6970
scrollbarElements.forEach(elem => {
71+
// @ts-ignore
72+
if (elem.hasAttribute('data-overlayscrollbars')) {
73+
return;
74+
}
7075
// @ts-ignore
7176
scrollbars = [ ...scrollbars, OverlayScrollbars(elem, options) ];
7277
});
78+
}
7379
80+
let _scrollScheduled = false;
81+
function scrollToBottom() {
7482
if (_scrollScheduled) {
7583
return;
7684
}
@@ -104,12 +112,6 @@
104112
}
105113
</script>
106114

107-
<!--
108-
NOTE: .latest-state-log-scrollbar, .msg-state-log-scrollbar and
109-
.agent-queue-log-scrollbar are DOM hooks queried by scrollToBottom().
110-
Keep those class names on the markup; styling is done via the
111-
scoped .il-* siblings.
112-
-->
113115
<div class="il-root font-code">
114116
<div class="il-card">
115117
<div class="il-close-bar">
@@ -124,7 +126,7 @@
124126
</button>
125127
</div>
126128
</div>
127-
<div class="il-body">
129+
<div class="il-body instant-log-scrollbar">
128130
{#if !!agent}
129131
<div
130132
class="il-section il-section-agent"

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

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -186,12 +186,7 @@
186186
}
187187
</script>
188188
189-
<!--
190-
NOTE: .content-log-scrollbar and .conv-state-log-scrollbar are DOM hooks
191-
queried by initScrollbars() (this file) and autoScrollToTargetLog()
192-
(chat-box.svelte). Keep those class names exactly. Scoped styling is
193-
applied through .pl-* siblings.
194-
-->
189+
195190
<div class="pl-root font-code">
196191
<div class="pl-card">
197192
<div class="pl-header-bar">

0 commit comments

Comments
 (0)