Skip to content

Commit 950fe9a

Browse files
author
Jicheng Lu
committed
refine scroll
1 parent 42fc2fd commit 950fe9a

File tree

20 files changed

+371
-171
lines changed

20 files changed

+371
-171
lines changed

src/lib/common/StateModal.svelte

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -201,7 +201,7 @@
201201
<!-- svelte-ignore a11y-click-events-have-key-events -->
202202
<!-- svelte-ignore a11y-no-static-element-interactions -->
203203
<i
204-
class="bx bx-no-entry clickable"
204+
class="bx bxs-no-entry clickable"
205205
class:hide={states.length === 1}
206206
on:click={() => remove(idx)}
207207
/>

src/lib/common/StateSearch.svelte

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@
5858
<!-- svelte-ignore a11y-click-events-have-key-events -->
5959
<!-- svelte-ignore a11y-no-static-element-interactions -->
6060
<i
61-
class="bx bx-no-entry text-danger clickable"
61+
class="bx bxs-no-entry text-danger clickable"
6262
class:hide={states.length === 1}
6363
on:click={() => removeState(idx)}
6464
/>

src/lib/helpers/http.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,8 @@ function skipLoader(config) {
112112
new RegExp('http(s*)://(.*?)/logger/instruction/log/keys', 'g'),
113113
new RegExp('http(s*)://(.*?)/logger/conversation/(.*?)/content-log', 'g'),
114114
new RegExp('http(s*)://(.*?)/logger/conversation/(.*?)/state-log', 'g'),
115-
new RegExp('http(s*)://(.*?)/mcp/server-configs', 'g')
115+
new RegExp('http(s*)://(.*?)/mcp/server-configs', 'g'),
116+
new RegExp('http(s*)://(.*?)/agent/(.*?)/code-scripts', 'g')
116117
];
117118

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

src/lib/helpers/types/instructTypes.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
* @property {string?} [provider] - The LLM provider.
77
* @property {string?} [model] - The LLM model.
88
* @property {import('$conversationTypes').ConversationStateModel[]} [states]
9+
* @property {CodeInstructOptions?} [codeOptions]
910
*/
1011

1112
/**
@@ -59,4 +60,12 @@
5960
* @property {string?} [endTime]
6061
*/
6162

63+
/**
64+
* @typedef {Object} CodeInstructOptions
65+
* @property {string?} [processor] - The code processor.
66+
* @property {string?} [script_name] - The code script name.
67+
* @property {string?} [script_type] - The code script type: src or test.
68+
* @property {{key: string, value: string}[]?} [arguments] - The arguments.
69+
*/
70+
6271
export default {};

src/lib/helpers/utils/common.js

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,21 @@ export function goToUrl(url, opts = {}) {
143143
goto(url, { replaceState, noScroll });
144144
}
145145

146+
/**
147+
* @param {HTMLElement | null | undefined} container
148+
* @param {ScrollBehavior} behavior
149+
*/
150+
export function scrollToBottom(container, behavior = 'smooth') {
151+
if (container) {
152+
setTimeout(() => {
153+
container.scrollTo({
154+
top: container.scrollHeight,
155+
behavior: behavior
156+
});
157+
}, 0);
158+
}
159+
}
160+
146161
/**
147162
* @param {string} str
148163
*/

src/lib/scss/custom/pages/_agent.scss

Lines changed: 61 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -147,6 +147,22 @@
147147
padding: 10px;
148148
border: 1px dashed var(--bs-primary);
149149
border-radius: 5px;
150+
151+
.llm-config-item {
152+
display: flex;
153+
flex-wrap: wrap;
154+
155+
.llm-config-label {
156+
overflow-x: hidden;
157+
text-overflow: ellipsis;
158+
white-space: nowrap;
159+
flex: 0.25;
160+
}
161+
162+
.llm-config-input {
163+
flex: 0.75;
164+
}
165+
}
150166
}
151167

152168
.agent-utility-container {
@@ -294,46 +310,58 @@
294310
}
295311

296312
// Responsive adjustments for utility
297-
@media (max-width: 768px) {
298-
.agent-utility-container {
299-
padding: 0 5px;
313+
@media (max-width: 1250px) {
314+
.agent-config-container {
315+
.llm-config-item {
316+
flex-direction: column;
300317

301-
.utility-wrapper {
302-
.utility-row-primary {
303-
flex-direction: column;
304-
}
318+
.llm-config-label {
319+
width: 100%;
320+
}
305321

306-
.utility-row {
307-
.utility-label,
308-
.utility-value {
309-
width: 100%;
322+
.llm-config-input {
323+
width: 100%;
324+
}
310325
}
326+
}
311327

312-
.utility-value {
313-
flex-direction: column;
314-
}
328+
.agent-utility-container {
329+
padding: 0 5px;
315330

316-
.utility-input,
317-
.utility-delete {
318-
width: 100%;
319-
}
331+
.utility-wrapper {
332+
.utility-row-primary {
333+
flex-direction: column;
334+
}
320335

321-
.utility-delete {
322-
display: flex;
323-
justify-content: flex-end;
324-
align-items: end;
325-
margin-top: 6px;
326-
}
327-
}
336+
.utility-row {
337+
.utility-label, .utility-value {
338+
width: 100%;
339+
}
328340

329-
.utility-row-secondary {
330-
.utility-content {
331-
.utility-list-item {
332-
flex-direction: column;
333-
gap: 6px;
334-
}
341+
.utility-value {
342+
flex-direction: column;
343+
}
344+
345+
.utility-input, .utility-delete {
346+
width: 100%;
347+
}
348+
349+
.utility-delete {
350+
display: flex;
351+
justify-content: flex-end;
352+
align-items: end;
353+
margin-top: 6px;
354+
}
355+
}
356+
357+
.utility-row-secondary {
358+
.utility-content {
359+
.utility-list-item {
360+
flex-direction: column;
361+
gap: 6px;
362+
}
363+
}
364+
}
335365
}
336-
}
337366
}
338-
}
339367
}

src/lib/scss/custom/pages/_instruction.scss

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@
5757
justify-content: center;
5858

5959
.instruct-setting-dropdown {
60-
width: 60%;
60+
width: 75%;
6161
}
6262

6363
@media (max-width: 992px) {
@@ -72,12 +72,16 @@
7272
padding: 20px 10px;
7373
}
7474

75-
.instruct-state-container {
75+
.instruct-kv-container {
7676
display: flex;
7777
flex-direction: column;
7878
gap: 10px;
79+
max-height: 200px;
80+
overflow-y: auto;
81+
scrollbar-width: none;
82+
padding-top: 20px;
7983

80-
.instruct-state-item {
84+
.instruct-kv-item {
8185
display: flex;
8286
gap: 30px;
8387
justify-content: center;

src/lib/scss/custom/pages/_knowledgebase.scss

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
}
2323

2424
.demo-tooltip-icon {
25-
font-size: 18px;
25+
font-size: 15px;
2626
}
2727

2828
.demo-tooltip-note {

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

Lines changed: 4 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
import { getVectorKnowledgeCollections } from '$lib/services/knowledge-base-service';
55
import { KnowledgeCollectionDisplayType } from '$lib/helpers/enums';
66
import { DECIMAL_REGEX } from '$lib/helpers/constants';
7+
import { scrollToBottom } from '$lib/helpers/utils/common';
78
89
const limit = 100;
910
const confidLowerBound = 0;
@@ -145,7 +146,7 @@
145146
disabled: false
146147
}
147148
];
148-
scrollToBottom();
149+
scrollToBottom(scrollContainer);
149150
handleAgentChange();
150151
}
151152
@@ -181,17 +182,6 @@
181182
}
182183
}) || [];
183184
}
184-
185-
function scrollToBottom() {
186-
if (scrollContainer) {
187-
setTimeout(() => {
188-
scrollContainer.scrollTo({
189-
top: scrollContainer.scrollHeight,
190-
behavior: 'smooth'
191-
});
192-
}, 0);
193-
}
194-
}
195185
</script>
196186
197187
<Card>
@@ -221,7 +211,7 @@
221211
data-bs-placement="top"
222212
title="Uncheck to disable knowledgebase"
223213
>
224-
<i class="bx bx-info-circle" />
214+
<i class="bx bx-info-circle fs-6" />
225215
</div>
226216
</div>
227217
</div>
@@ -241,7 +231,7 @@
241231
</div>
242232
<div class="utility-delete line-align-center">
243233
<i
244-
class="bx bxs-no-entry text-danger clickable"
234+
class="bx bxs-no-entry text-danger clickable fs-6"
245235
role="link"
246236
tabindex="0"
247237
on:keydown={() => {}}

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

Lines changed: 6 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
import { onMount } from 'svelte';
33
import { Card, CardBody, Input, Button } from '@sveltestrap/sveltestrap';
44
import { getServerConfigs } from '$lib/services/mcp-service';
5+
import { scrollToBottom } from '$lib/helpers/utils/common';
56
67
const limit = 100;
78
@@ -134,7 +135,7 @@
134135
functions: []
135136
}
136137
];
137-
scrollToBottom();
138+
scrollToBottom(scrollContainer);
138139
handleAgentChange();
139140
}
140141
@@ -211,17 +212,6 @@
211212
innerRefresh(innerMcps);
212213
handleAgentChange();
213214
}
214-
215-
function scrollToBottom() {
216-
if (scrollContainer) {
217-
setTimeout(() => {
218-
scrollContainer.scrollTo({
219-
top: scrollContainer.scrollHeight,
220-
behavior: 'smooth'
221-
});
222-
}, 0);
223-
}
224-
}
225215
</script>
226216
227217
<Card>
@@ -246,7 +236,7 @@
246236
/>
247237
</div>
248238
<div
249-
class="line-align-center"
239+
class="line-align-center fs-6"
250240
data-bs-toggle="tooltip"
251241
data-bs-placement="top"
252242
title="Uncheck to disable MCP"
@@ -271,7 +261,7 @@
271261
</div>
272262
<div class="utility-delete line-align-center">
273263
<i
274-
class="bx bxs-no-entry text-danger clickable"
264+
class="bx bxs-no-entry text-danger clickable fs-6"
275265
role="link"
276266
tabindex="0"
277267
on:keydown={() => {}}
@@ -321,7 +311,7 @@
321311
</div>
322312
<div class="utility-delete line-align-center">
323313
<i
324-
class="bx bxs-no-entry text-danger clickable"
314+
class="bx bxs-no-entry text-danger clickable fs-6"
325315
role="link"
326316
tabindex="0"
327317
on:keydown={() => {}}
@@ -339,7 +329,7 @@
339329
</div>
340330
<div class="utility-value">
341331
<i
342-
class="bx bx-list-plus add-list clickable"
332+
class="bx bx-list-plus add-list clickable fs-6"
343333
role="link"
344334
tabindex="0"
345335
on:keydown={() => {}}

0 commit comments

Comments
 (0)