Skip to content

Commit 6bf25ee

Browse files
author
Jicheng Lu
committed
remove agent rule actions and configs
1 parent 2869853 commit 6bf25ee

6 files changed

Lines changed: 3 additions & 258 deletions

File tree

src/lib/helpers/http.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -235,7 +235,6 @@ function skipLoader(config) {
235235
new RegExp('http(s*)://(.*?)/agent/(.*?)/code-scripts', 'g'),
236236
new RegExp('http(s*)://(.*?)/rule/triggers', 'g'),
237237
new RegExp('http(s*)://(.*?)/rule/criteria-providers', 'g'),
238-
new RegExp('http(s*)://(.*?)/rule/actions', 'g'),
239238
new RegExp('http(s*)://(.*?)/conversation/state/keys', 'g'),
240239
new RegExp('http(s*)://(.*?)/conversation/(.*?)/files/(.*?)', 'g'),
241240
new RegExp('http(s*)://(.*?)/llm-configs', 'g'),

src/lib/helpers/types/agentTypes.js

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -232,7 +232,6 @@
232232
* @property {string?} [displayName]
233233
* @property {boolean} disabled
234234
* @property {AgentRuleCriteria?} [rule_criteria]
235-
* @property {AgentRuleAction[]} rule_actions
236235
* @property {any?} [output_args]
237236
* @property {string?} [json_args]
238237
* @property {string?} [statement]
@@ -247,14 +246,6 @@
247246
* @property {any} [config]
248247
*/
249248

250-
/**
251-
* @typedef {Object} AgentRuleAction
252-
* @property {string?} [name]
253-
* @property {boolean} disabled
254-
* @property {any} [config]
255-
* @property {string?} [skippingExpression]
256-
*/
257-
258249

259250
/**
260251
* @typedef {Object} AgentTaskSearchOption

src/lib/services/agent-service.js

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -125,16 +125,6 @@ export async function getAgentRuleCriteriaProviders() {
125125
return response.data;
126126
}
127127

128-
/**
129-
* Get agent rule actions
130-
* @returns {Promise<import('$commonTypes').KeyValuePair[]>}
131-
*/
132-
export async function getAgentRuleActions() {
133-
const url = endpoints.agentRuleActionsUrl;
134-
const response = await axios.get(url);
135-
return response.data;
136-
}
137-
138128
/**
139129
* Get agent labels
140130
* @param {number?} [size]

src/lib/services/api-endpoints.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,6 @@ export const endpoints = {
4141
agentUtilityOptionsUrl: `${host}/agent/utility/options`,
4242
agentRuleOptionsUrl: `${host}/rule/triggers`,
4343
agentRuleCriteriaProvidersUrl: `${host}/rule/criteria-providers`,
44-
agentRuleActionsUrl: `${host}/rule/actions`,
4544
agentLabelsUrl: `${host}/agent/labels`,
4645

4746
// agent code script:

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

Lines changed: 0 additions & 168 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111
1212
const duration = 200;
1313
const textLimit = 1024;
14-
const actionLimit = 10;
1514
1615
/** @type {import('$agentTypes').AgentRule} */
1716
export let rule;
@@ -31,9 +30,6 @@
3130
/** @type {any[]} */
3231
export let criteriaOptions = [];
3332
34-
/** @type {any[]} */
35-
export let actionOptions = [];
36-
3733
/** @type {number} */
3834
export let windowWidth;
3935
@@ -62,44 +58,6 @@
6258
});
6359
}
6460
65-
/**
66-
* @param {any} e
67-
* @param {string} field
68-
* @param {number} idx
69-
*/
70-
function toggleRuleAction(e, field, idx) {
71-
svelteDispatch('toggle', {
72-
ruleIdx: ruleIndex,
73-
field: field,
74-
itemIdx: idx,
75-
checked: e.target.checked
76-
});
77-
}
78-
79-
/**
80-
* @param {any} e
81-
* @param {string} field
82-
* @param {number} idx
83-
*/
84-
function changeRuleAction(e, field, idx) {
85-
svelteDispatch('change', {
86-
ruleIdx: ruleIndex,
87-
field: field,
88-
itemIdx: idx,
89-
value: e?.target?.value || e?.detail?.text || ''
90-
});
91-
}
92-
93-
/**
94-
* @param {string} field
95-
*/
96-
function addRuleItem(field) {
97-
svelteDispatch('add', {
98-
ruleIdx: ruleIndex,
99-
field: field
100-
});
101-
}
102-
10361
/**
10462
* @param {string} field
10563
*/
@@ -110,18 +68,6 @@
11068
});
11169
}
11270
113-
/**
114-
* @param {string} field
115-
* @param {number} idx
116-
*/
117-
function deleteRuleItem(field, idx) {
118-
svelteDispatch('delete', {
119-
ruleIdx: ruleIndex,
120-
field: field,
121-
itemIdx: idx
122-
});
123-
}
124-
12571
function toggleCollapse() {
12672
svelteDispatch('collapse', {
12773
ruleIdx: ruleIndex,
@@ -343,119 +289,5 @@
343289
{/if}
344290
</div>
345291
</div>
346-
347-
<div class="utility-row utility-row-secondary" transition:slide={{ duration: duration }}>
348-
{#each rule.rule_actions || [] as action, aid (aid)}
349-
<div class="utility-content" style={`${aid > 0 ? 'border-top-style: none' : ''}`}>
350-
<div class="utility-list-item">
351-
<div class="utility-label line-align-center">
352-
<div class="d-flex gap-1">
353-
<div class="line-align-center">
354-
{`Action #${aid + 1}`}
355-
</div>
356-
<div class="line-align-center">
357-
<Input
358-
type="checkbox"
359-
checked={!action?.disabled}
360-
on:change={e => toggleRuleAction(e, 'action', aid)}
361-
/>
362-
</div>
363-
</div>
364-
</div>
365-
<div class="utility-value">
366-
<div class="utility-input line-align-center">
367-
<Input
368-
type="select"
369-
disabled={!!action?.disabled}
370-
on:change={e => changeRuleAction(e, 'action', aid)}
371-
>
372-
{#each [...actionOptions] as option}
373-
<option value={`${option.name}#${option.defaultConfig}`} selected={option.name == action?.name}>
374-
{option.name}
375-
</option>
376-
{/each}
377-
</Input>
378-
</div>
379-
<div class="utility-delete line-align-center">
380-
<i
381-
class="bx bxs-no-entry text-danger clickable fs-6"
382-
role="link"
383-
tabindex="0"
384-
on:keydown={() => {}}
385-
on:click={() => deleteRuleItem('action', aid)}
386-
/>
387-
</div>
388-
</div>
389-
</div>
390-
{#if action?.name}
391-
<div class="utility-list-item">
392-
<div class="utility-label line-align-center">
393-
<div class="d-flex gap-1">
394-
<div class="line-align-center">
395-
{'Skipping'}
396-
</div>
397-
</div>
398-
</div>
399-
<div class="utility-value">
400-
<div class="utility-input line-align-center">
401-
<Input
402-
type="text"
403-
disabled={!!action?.disabled}
404-
maxlength={4096}
405-
value={action?.skippingExpression}
406-
on:input={e => changeRuleAction(e, 'action-skipping-expression', aid)}
407-
/>
408-
</div>
409-
<div class="utility-delete line-align-center"></div>
410-
</div>
411-
</div>
412-
<div class="utility-list-item">
413-
<div class="utility-label line-align-center">
414-
<div class="d-flex gap-1">
415-
<div class="line-align-center">
416-
{'Config'}
417-
</div>
418-
</div>
419-
</div>
420-
<div class="utility-value">
421-
<div class="utility-input line-align-center">
422-
<CodeScript
423-
language="json"
424-
containerClasses="agent-rule-config"
425-
hideLineNumber={true}
426-
editable={!action?.disabled}
427-
scriptText={JSON.stringify(action?.config || {}, null, 2)}
428-
on:change={(e) => changeRuleAction(e, 'action-config', aid)}
429-
/>
430-
</div>
431-
<div class="utility-delete line-align-center"></div>
432-
</div>
433-
</div>
434-
{/if}
435-
</div>
436-
{/each}
437-
438-
{#if rule.rule_actions?.length < actionLimit}
439-
<div class="utility-content" style="border-top: none;">
440-
<div class="utility-list-item">
441-
<div class="utility-label">
442-
{rule.rule_actions.length === 0 ? 'Actions' : ''}
443-
</div>
444-
<div class="utility-value">
445-
<i
446-
class="bx bx-list-plus add-list clickable fs-6"
447-
data-bs-toggle="tooltip"
448-
data-bs-placement="top"
449-
title="Add action"
450-
role="link"
451-
tabindex="0"
452-
on:keydown={() => {}}
453-
on:click={() => addRuleItem('action')}
454-
/>
455-
</div>
456-
</div>
457-
</div>
458-
{/if}
459-
</div>
460292
{/if}
461293
</div>

0 commit comments

Comments
 (0)