Skip to content

Commit cfaa874

Browse files
author
Jicheng Lu
committed
rename
1 parent f7283f5 commit cfaa874

File tree

9 files changed

+49
-47
lines changed

9 files changed

+49
-47
lines changed

src/routes/page/agent/[agentId]/+page.svelte

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@
164164
}
165165
166166
function refreshInstructions() {
167-
agentInstructionCmp?.refreshInstructions();
167+
agentInstructionCmp?.refresh();
168168
}
169169
170170
// Templates
@@ -181,7 +181,7 @@
181181
}
182182
183183
function refreshTemplates() {
184-
agentTemplateCmp?.refreshTemplates();
184+
agentTemplateCmp?.refresh();
185185
}
186186
187187
@@ -246,8 +246,8 @@
246246
setTimeout(() => {
247247
refreshInstructions();
248248
refreshTemplates();
249-
agentFunctionCmp?.reinit();
250-
agentTabsCmp?.reinit();
249+
agentFunctionCmp?.refresh();
250+
agentTabsCmp?.refresh();
251251
});
252252
}
253253
</script>

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
return content;
1313
}
1414
15-
export const reinit = () => init();
15+
export const refresh = () => init();
1616
1717
/** @type {import('svelte-jsoneditor').Content} */
1818
let content = {

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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
<script>
22
import { onMount } from 'svelte';
3+
import { _ } from 'svelte-i18n';
4+
import { v4 as uuidv4 } from 'uuid';
5+
import util from "lodash";
36
import { Card, CardBody, FormGroup, Input, CardHeader } from '@sveltestrap/sveltestrap';
47
import NavBar from '$lib/common/nav-bar/NavBar.svelte';
58
import NavItem from '$lib/common/nav-bar/NavItem.svelte';
6-
import { v4 as uuidv4 } from 'uuid';
7-
import util from "lodash";
8-
import { _ } from 'svelte-i18n';
99
1010
const defaultChannel = "default";
1111
@@ -44,7 +44,7 @@
4444
};
4545
}
4646
47-
export const refreshInstructions = () => init();
47+
export const refresh = () => init();
4848
4949
5050
/** @type {import('$agentTypes').ChannelInstruction} */

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

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -31,15 +31,15 @@
3131
}
3232
});
3333
34-
refresh(knowledgeBases);
34+
innerRefresh(knowledgeBases);
3535
return knowledgeBases;
3636
}
3737
3838
export const fetchOriginalKnowledgeBases = () => {
3939
return innerKnowledgeBases;
4040
}
4141
42-
export const reinit = () => init();
42+
export const refresh = () => init();
4343
4444
/** @type {any[]} */
4545
let knowledgeBaseOptions = [];
@@ -72,7 +72,7 @@
7272
displayName: getDisplayOption(x),
7373
};
7474
}) || [];
75-
refresh(list);
75+
innerRefresh(list);
7676
}
7777
7878
/** @param {import('$agentTypes').AgentKnowledgeBase | any} b */
@@ -93,7 +93,7 @@
9393
found.name = vals[0];
9494
found.type = vals[1];
9595
handleAgentChange();
96-
refresh(innerKnowledgeBases);
96+
innerRefresh(innerKnowledgeBases);
9797
}
9898
9999
function addKnowledgeBase() {
@@ -125,12 +125,12 @@
125125
126126
found.disabled = !e.target.checked;
127127
handleAgentChange();
128-
refresh(innerKnowledgeBases);
128+
innerRefresh(innerKnowledgeBases);
129129
}
130130
131131
132132
/** @param {import('$agentTypes').AgentKnowledgeBase[]} list */
133-
function refresh(list) {
133+
function innerRefresh(list) {
134134
innerKnowledgeBases = list?.map(x => {
135135
return {
136136
name: x.name,

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

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3,23 +3,28 @@
33
import { Card, CardBody, Input } from '@sveltestrap/sveltestrap';
44
import { getLlmProviders, getLlmProviderModels } from '$lib/services/llm-provider-service';
55
6-
/** @type {string[]} */
7-
let providers = [];
8-
96
/** @type {import('$agentTypes').AgentModel} */
107
export let agent;
118
12-
/** @type {import('$commonTypes').LlmModelSetting[]} */
13-
let models = [];
14-
159
/** @type {() => void} */
1610
export let handleAgentChange = () => {};
1711
12+
export const refresh = () => {
13+
config = agent.llm_config;
14+
init();
15+
};
16+
1817
const recursiveDepthLowerLimit = 1;
1918
const recursiveDepthUpperLimit = 10;
2019
2120
let config = agent.llm_config;
2221
22+
/** @type {string[]} */
23+
let providers = [];
24+
25+
/** @type {import('$commonTypes').LlmModelSetting[]} */
26+
let models = [];
27+
2328
onMount(async () =>{
2429
await init();
2530
});
@@ -36,10 +41,7 @@
3641
config.model = foundModel?.name || null;
3742
}
3843
39-
export const reinit = () => {
40-
config = agent.llm_config;
41-
init();
42-
};
44+
4345
4446
/** @param {any} e */
4547
async function changeProvider(e) {

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

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -31,15 +31,15 @@
3131
}
3232
});
3333
34-
refresh(rules);
34+
innerRefresh(rules);
3535
return rules;
3636
}
3737
3838
export const fetchOriginalRules = () => {
3939
return innerRules;
4040
}
4141
42-
export const reinit = () => init();
42+
export const refresh = () => init();
4343
4444
/** @type {any[]} */
4545
let ruleOptions = [];
@@ -70,7 +70,7 @@
7070
displayName: "",
7171
};
7272
}) || [];
73-
refresh(list);
73+
innerRefresh(list);
7474
}
7575
7676
/**
@@ -84,7 +84,7 @@
8484
const val = e.target.value;
8585
found.trigger_name = val;
8686
handleAgentChange();
87-
refresh(innerRules);
87+
innerRefresh(innerRules);
8888
}
8989
9090
function addRule() {
@@ -116,7 +116,7 @@
116116
117117
found.disabled = !e.target.checked;
118118
handleAgentChange();
119-
refresh(innerRules);
119+
innerRefresh(innerRules);
120120
}
121121
122122
/**
@@ -133,12 +133,12 @@
133133
found.criteria = val;
134134
}
135135
handleAgentChange();
136-
refresh(innerRules);
136+
innerRefresh(innerRules);
137137
}
138138
139139
140140
/** @param {import('$agentTypes').AgentRule[]} list */
141-
function refresh(list) {
141+
function innerRefresh(list) {
142142
innerRules = list?.map(x => {
143143
return {
144144
trigger_name: x.trigger_name,

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@
4141
};
4242
}
4343
44-
export const refreshTemplates = () => init();
44+
export const refresh = () => init();
4545
4646
4747
/** @type {import('$agentTypes').AgentTemplate} */

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

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -47,15 +47,15 @@
4747
};
4848
});
4949
50-
refresh(candidates);
50+
innerRefresh(candidates);
5151
return candidates;
5252
}
5353
5454
export const fetchOriginalUtilities = () => {
5555
return innerUtilities;
5656
}
5757
58-
export const reinit = () => init();
58+
export const refresh = () => init();
5959
6060
/** @type {any} */
6161
let utilityMapper = {};
@@ -121,7 +121,7 @@
121121
})) || []
122122
};
123123
}) || [];
124-
refresh(list);
124+
innerRefresh(list);
125125
}
126126
127127
/**
@@ -142,7 +142,7 @@
142142
// @ts-ignore
143143
...utilityMapper[name].templates?.filter(x => !!x.name) || []
144144
];
145-
refresh(innerUtilities);
145+
innerRefresh(innerUtilities);
146146
}
147147
148148
function addUtility() {
@@ -176,7 +176,7 @@
176176
found.templates.push({ name: '', displayName: '' });
177177
}
178178
179-
refresh(innerUtilities);
179+
innerRefresh(innerUtilities);
180180
}
181181
182182
/**
@@ -196,7 +196,7 @@
196196
found.templates = tps;
197197
}
198198
199-
refresh(innerUtilities);
199+
innerRefresh(innerUtilities);
200200
}
201201
202202
@@ -224,7 +224,7 @@
224224
tp.displayName = vals[1];
225225
}
226226
}
227-
refresh(innerUtilities);
227+
innerRefresh(innerUtilities);
228228
}
229229
230230
/**
@@ -236,12 +236,12 @@
236236
if (!found) return;
237237
238238
found.disabled = !e.target.checked;
239-
refresh(innerUtilities);
239+
innerRefresh(innerUtilities);
240240
}
241241
242242
243243
/** @param {import('$agentTypes').AgentUtility[]} list */
244-
function refresh(list) {
244+
function innerRefresh(list) {
245245
innerUtilities = list?.map(x => {
246246
return {
247247
name: x.name,

src/routes/page/agent/[agentId]/agent-tabs.svelte

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -39,11 +39,11 @@
3939
};
4040
}
4141
42-
export const reinit = () => {
43-
agentLlmConfigCmp?.reinit();
44-
agentUtilityCmp?.reinit();
45-
agentKnowledgeBaseCmp?.reinit();
46-
agentEventRuleCmp?.reinit();
42+
export const refresh = () => {
43+
agentLlmConfigCmp?.refresh();
44+
agentUtilityCmp?.refresh();
45+
agentKnowledgeBaseCmp?.refresh();
46+
agentEventRuleCmp?.refresh();
4747
}
4848
4949
/** @type {any} */

0 commit comments

Comments
 (0)