Skip to content

Commit 7a97ba3

Browse files
committed
add output arguments
1 parent 69c6766 commit 7a97ba3

File tree

2 files changed

+22
-12
lines changed

2 files changed

+22
-12
lines changed

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -262,7 +262,7 @@
262262
.tooltip-inner {
263263
text-align: start;
264264
max-width: fit-content;
265-
padding: 20px;
265+
padding: 5px 10px;
266266
}
267267

268268
.markdown-div {
@@ -271,6 +271,7 @@
271271

272272
pre {
273273
white-space: pre !important;
274+
width: fit-content;
274275
margin-top: 1em;
275276
margin-bottom: 1em;
276277
}

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

Lines changed: 20 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,9 @@
99
const limit = 100;
1010
const textLimit = 1024;
1111
12+
let windowWidth = 0;
13+
let windowHeight = 0;
14+
1215
/** @type {import('$agentTypes').AgentModel} */
1316
export let agent;
1417
@@ -51,6 +54,7 @@
5154
let scrollContainer;
5255
5356
onMount(async () =>{
57+
resizeWindow();
5458
getAgentRuleOptions().then(data => {
5559
const list = data?.map(x => {
5660
return {
@@ -148,11 +152,7 @@
148152
const found = ruleOptions.find(y => y.name === x.trigger_name);
149153
return {
150154
...x,
151-
// json_args: found?.json_args
152-
json_args: `\`\`\`json\n${JSON.stringify({
153-
test: 'Contrary to popular belief, Lorem Ipsum is not simply random text. It has roots in a piece of classical Latin literature from 45 BC, making it over 2000 years old. Richard McClintock, a Latin professor at Hampden-Sydney College in Virginia, looked up one of the mo',
154-
name: 'The standard chunk of Lorem Ipsum used since the 1500s is reproduced below for those interested. Sections 1.10.32 and 1.10.33 from "de Finibus Bonorum et Mal'
155-
}, null, 2)}\n\`\`\``
155+
json_args: found?.json_args
156156
}
157157
}) || [];
158158
}
@@ -167,8 +167,15 @@
167167
}, 0);
168168
}
169169
}
170+
171+
function resizeWindow() {
172+
windowWidth = window.innerWidth;
173+
windowHeight = window.innerHeight;
174+
}
170175
</script>
171176
177+
<svelte:window on:resize={() => resizeWindow()}/>
178+
172179
<Card>
173180
<CardBody>
174181
<div class="text-center">
@@ -234,12 +241,12 @@
234241
<div class="line-align-center">
235242
{'Criteria'}
236243
</div>
237-
{#if ADMIN_ROLES.includes(user?.role || '') && !!rule.trigger_name}
244+
{#if ADMIN_ROLES.includes(user?.role || '') && !!rule.trigger_name && !!rule.criteria?.trim()}
238245
<div
239246
class="line-align-center clickable text-primary fs-4"
240247
data-bs-toggle="tooltip"
241248
data-bs-placement="top"
242-
title="Compile"
249+
title="Compile code script"
243250
>
244251
<i class="mdi mdi-file-code" />
245252
</div>
@@ -265,20 +272,22 @@
265272
class="bx bx-info-circle"
266273
style="font-size: 15px;"
267274
id={`rule-${uid}`}
275+
data-bs-toggle="tooltip"
276+
data-bs-placement="top"
277+
title="Output arguments"
268278
/>
269279
<BotsharpTooltip
270-
isOpen
271280
containerClasses="agent-utility-desc"
272-
style={`min-width: 100px;`}
281+
style={`min-width: ${Math.floor(windowWidth*0.3)}px;`}
273282
target={`rule-${uid}`}
274283
placement="right"
275-
persist={false}
284+
persist
276285
>
277286
<Markdown
278287
rawText
279288
scrollable
280289
containerClasses={'markdown-div'}
281-
containerStyles={`max-width: 500px; max-height: 100px;`}
290+
containerStyles={`max-width: ${Math.floor(windowWidth*0.3)}px;`}
282291
text={rule.json_args}
283292
/>
284293
</BotsharpTooltip>

0 commit comments

Comments
 (0)