|
9 | 9 | const limit = 100; |
10 | 10 | const textLimit = 1024; |
11 | 11 |
|
| 12 | + let windowWidth = 0; |
| 13 | + let windowHeight = 0; |
| 14 | +
|
12 | 15 | /** @type {import('$agentTypes').AgentModel} */ |
13 | 16 | export let agent; |
14 | 17 |
|
|
51 | 54 | let scrollContainer; |
52 | 55 |
|
53 | 56 | onMount(async () =>{ |
| 57 | + resizeWindow(); |
54 | 58 | getAgentRuleOptions().then(data => { |
55 | 59 | const list = data?.map(x => { |
56 | 60 | return { |
|
148 | 152 | const found = ruleOptions.find(y => y.name === x.trigger_name); |
149 | 153 | return { |
150 | 154 | ...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 |
156 | 156 | } |
157 | 157 | }) || []; |
158 | 158 | } |
|
167 | 167 | }, 0); |
168 | 168 | } |
169 | 169 | } |
| 170 | +
|
| 171 | + function resizeWindow() { |
| 172 | + windowWidth = window.innerWidth; |
| 173 | + windowHeight = window.innerHeight; |
| 174 | + } |
170 | 175 | </script> |
171 | 176 |
|
| 177 | +<svelte:window on:resize={() => resizeWindow()}/> |
| 178 | +
|
172 | 179 | <Card> |
173 | 180 | <CardBody> |
174 | 181 | <div class="text-center"> |
|
234 | 241 | <div class="line-align-center"> |
235 | 242 | {'Criteria'} |
236 | 243 | </div> |
237 | | - {#if ADMIN_ROLES.includes(user?.role || '') && !!rule.trigger_name} |
| 244 | + {#if ADMIN_ROLES.includes(user?.role || '') && !!rule.trigger_name && !!rule.criteria?.trim()} |
238 | 245 | <div |
239 | 246 | class="line-align-center clickable text-primary fs-4" |
240 | 247 | data-bs-toggle="tooltip" |
241 | 248 | data-bs-placement="top" |
242 | | - title="Compile" |
| 249 | + title="Compile code script" |
243 | 250 | > |
244 | 251 | <i class="mdi mdi-file-code" /> |
245 | 252 | </div> |
|
265 | 272 | class="bx bx-info-circle" |
266 | 273 | style="font-size: 15px;" |
267 | 274 | id={`rule-${uid}`} |
| 275 | + data-bs-toggle="tooltip" |
| 276 | + data-bs-placement="top" |
| 277 | + title="Output arguments" |
268 | 278 | /> |
269 | 279 | <BotsharpTooltip |
270 | | - isOpen |
271 | 280 | containerClasses="agent-utility-desc" |
272 | | - style={`min-width: 100px;`} |
| 281 | + style={`min-width: ${Math.floor(windowWidth*0.3)}px;`} |
273 | 282 | target={`rule-${uid}`} |
274 | 283 | placement="right" |
275 | | - persist={false} |
| 284 | + persist |
276 | 285 | > |
277 | 286 | <Markdown |
278 | 287 | rawText |
279 | 288 | scrollable |
280 | 289 | containerClasses={'markdown-div'} |
281 | | - containerStyles={`max-width: 500px; max-height: 100px;`} |
| 290 | + containerStyles={`max-width: ${Math.floor(windowWidth*0.3)}px;`} |
282 | 291 | text={rule.json_args} |
283 | 292 | /> |
284 | 293 | </BotsharpTooltip> |
|
0 commit comments