Skip to content

Commit 327f8e6

Browse files
author
Jicheng Lu
committed
allow scrollable
1 parent 93b00dd commit 327f8e6

File tree

4 files changed

+63
-4
lines changed

4 files changed

+63
-4
lines changed

src/routes/page/agent/[agentId]/agent-components/agent-knowledge-base.svelte

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,9 @@
4545
/** @type {import('$agentTypes').AgentKnowledgeBase[]} */
4646
let innerKnowledgeBases = [];
4747
48+
/** @type {HTMLElement} */
49+
let scrollContainer;
50+
4851
onMount(async () =>{
4952
getVectorKnowledgeCollections().then(data => {
5053
const list = data?.map(x => {
@@ -142,6 +145,7 @@
142145
disabled: false
143146
}
144147
];
148+
scrollToBottom();
145149
handleAgentChange();
146150
}
147151
@@ -178,6 +182,16 @@
178182
}) || [];
179183
}
180184
185+
function scrollToBottom() {
186+
if (scrollContainer) {
187+
setTimeout(() => {
188+
scrollContainer.scrollTo({
189+
top: scrollContainer.scrollHeight,
190+
behavior: 'smooth'
191+
});
192+
}, 0);
193+
}
194+
}
181195
</script>
182196
183197
<Card>
@@ -187,7 +201,7 @@
187201
<h6 class="mt-1 mb-3">Make your Agent have memory</h6>
188202
</div>
189203
190-
<div class="agent-utility-container">
204+
<div class="agent-utility-container" bind:this={scrollContainer}>
191205
{#each innerKnowledgeBases as knowledge, uid (uid)}
192206
<div class="utility-wrapper">
193207
<div class="utility-row utility-row-primary">

src/routes/page/agent/[agentId]/agent-components/agent-mcp-tool.svelte

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,9 @@
5454
/** @type {import('$agentTypes').AgentMcpTool[]} */
5555
let innerMcps = [];
5656
57+
/** @type {HTMLElement} */
58+
let scrollContainer;
59+
5760
5861
onMount(async () => {
5962
getServerConfigs().then(res => {
@@ -131,6 +134,7 @@
131134
functions: []
132135
}
133136
];
137+
scrollToBottom();
134138
handleAgentChange();
135139
}
136140
@@ -207,6 +211,17 @@
207211
innerRefresh(innerMcps);
208212
handleAgentChange();
209213
}
214+
215+
function scrollToBottom() {
216+
if (scrollContainer) {
217+
setTimeout(() => {
218+
scrollContainer.scrollTo({
219+
top: scrollContainer.scrollHeight,
220+
behavior: 'smooth'
221+
});
222+
}, 0);
223+
}
224+
}
210225
</script>
211226
212227
<Card>
@@ -216,7 +231,7 @@
216231
<h6 class="mt-1 mb-3">Tools powered by MCP Servers</h6>
217232
</div>
218233
219-
<div class="agent-utility-container">
234+
<div class="agent-utility-container" bind:this={scrollContainer}>
220235
{#each innerMcps as mcp, uid (uid)}
221236
<div class="utility-wrapper">
222237
<div class="utility-row utility-row-primary">

src/routes/page/agent/[agentId]/agent-components/agent-rule.svelte

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,9 @@
4141
/** @type {import('$agentTypes').AgentRule[]} */
4242
let innerRules = [];
4343
44+
/** @type {HTMLElement} */
45+
let scrollContainer;
46+
4447
onMount(async () =>{
4548
getAgentRuleOptions().then(data => {
4649
const list = data?.map(x => {
@@ -91,6 +94,7 @@
9194
disabled: false
9295
}
9396
];
97+
scrollToBottom();
9498
handleAgentChange();
9599
}
96100
@@ -143,6 +147,16 @@
143147
}) || [];
144148
}
145149
150+
function scrollToBottom() {
151+
if (scrollContainer) {
152+
setTimeout(() => {
153+
scrollContainer.scrollTo({
154+
top: scrollContainer.scrollHeight,
155+
behavior: 'smooth'
156+
});
157+
}, 0);
158+
}
159+
}
146160
</script>
147161
148162
<Card>
@@ -152,7 +166,7 @@
152166
<h6 class="mt-1 mb-3">Wake-up your agent by rules</h6>
153167
</div>
154168
155-
<div class="agent-utility-container">
169+
<div class="agent-utility-container" bind:this={scrollContainer}>
156170
{#each innerRules as rule, uid (uid)}
157171
<div class="utility-wrapper">
158172
<div class="utility-row utility-row-primary">

src/routes/page/agent/[agentId]/agent-components/agent-utility.svelte

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,9 @@
4242
/** @type {import('$agentTypes').AgentUtility[]} */
4343
let innerUtilities = [];
4444
45+
/** @type {HTMLElement} */
46+
let scrollContainer;
47+
4548
onMount(async () =>{
4649
resizeWindow();
4750
getAgentUtilityOptions().then(data => {
@@ -127,6 +130,8 @@
127130
items: []
128131
}
129132
];
133+
scrollToBottom();
134+
handleAgentChange();
130135
}
131136
132137
/** @param {number} idx */
@@ -267,6 +272,17 @@
267272
innerRefresh(innerUtilities);
268273
handleAgentChange();
269274
}
275+
276+
function scrollToBottom() {
277+
if (scrollContainer) {
278+
setTimeout(() => {
279+
scrollContainer.scrollTo({
280+
top: scrollContainer.scrollHeight,
281+
behavior: 'smooth'
282+
});
283+
}, 0);
284+
}
285+
}
270286
</script>
271287
272288
<svelte:window on:resize={() => resizeWindow()}/>
@@ -278,7 +294,7 @@
278294
<h6 class="mt-1 mb-3">Tools shared across plugins</h6>
279295
</div>
280296
281-
<div class="agent-utility-container">
297+
<div class="agent-utility-container" bind:this={scrollContainer}>
282298
{#if !agent?.is_router}
283299
<div class="merge-utility">
284300
<Input

0 commit comments

Comments
 (0)