|
3 | 3 | import InPlaceEdit from '$lib/common/InPlaceEdit.svelte' |
4 | 4 | import { format } from '$lib/helpers/datetime'; |
5 | 5 | import { onMount } from 'svelte'; |
6 | | - import { getAgentTools } from '$lib/services/agent-service'; |
| 6 | + import { getAgentUtilities } from '$lib/services/agent-service'; |
7 | 7 |
|
8 | 8 | /** @type {import('$types').AgentModel} */ |
9 | 9 | export let agent; |
|
12 | 12 | export let profiles = []; |
13 | 13 |
|
14 | 14 | /** @type {string[]} */ |
15 | | - export let tools = []; |
| 15 | + export let utilities = []; |
16 | 16 |
|
17 | 17 | /** @type {string[]} */ |
18 | | - let toolOptions = []; |
| 18 | + let utilityOptions = []; |
19 | 19 |
|
20 | 20 | const profileLimit = 10; |
21 | | - const toolLimit = 10; |
| 21 | + const utilityLimit = 10; |
22 | 22 |
|
23 | 23 | onMount(() => { |
24 | | - getAgentTools().then(data => { |
25 | | - const tools = data?.filter(x => x?.trim()?.length > 0) || []; |
26 | | - toolOptions = ["", ...tools]; |
| 24 | + getAgentUtilities().then(data => { |
| 25 | + const list = data?.filter(x => x?.trim()?.length > 0) || []; |
| 26 | + utilityOptions = ["", ...list]; |
27 | 27 | }); |
28 | 28 | }); |
29 | 29 |
|
|
42 | 42 | agent.profiles = profiles; |
43 | 43 | } |
44 | 44 |
|
45 | | - function addTool() { |
| 45 | + function addUtility() { |
46 | 46 | if (!!!agent) return; |
47 | 47 |
|
48 | | - tools = [...tools, '']; |
49 | | - agent.tools = tools; |
| 48 | + utilities = [...utilities, '']; |
| 49 | + agent.utilities = utilities; |
50 | 50 | } |
51 | 51 |
|
52 | 52 | /** |
53 | 53 | * @param {number} index |
54 | 54 | */ |
55 | | - function removeTool(index) { |
56 | | - tools = tools.filter((x, idx) => idx !== index); |
57 | | - agent.tools = tools; |
| 55 | + function removeUtility(index) { |
| 56 | + utilities = utilities.filter((x, idx) => idx !== index); |
| 57 | + agent.utilities = utilities; |
58 | 58 | } |
59 | 59 |
|
60 | 60 | function chatWithAgent() { |
|
153 | 153 | </td> |
154 | 154 | </tr> |
155 | 155 | <tr> |
156 | | - <th class="agent-prop-key">Tools</th> |
| 156 | + <th class="agent-prop-key">Utilities</th> |
157 | 157 | <td> |
158 | 158 | <div class="agent-prop-list-container"> |
159 | | - {#each tools as tool, index} |
| 159 | + {#each utilities as utility, index} |
160 | 160 | <div class="edit-wrapper"> |
161 | | - <Input type="select" class="edit-text-box" bind:value={tool}> |
162 | | - {#each toolOptions as option} |
163 | | - <option selected={tool === option}>{option}</option> |
| 161 | + <Input type="select" class="edit-text-box" bind:value={utility}> |
| 162 | + {#each utilityOptions as option} |
| 163 | + <option selected={utility === option}>{option}</option> |
164 | 164 | {/each} |
165 | 165 | </Input> |
166 | 166 | <div class="delete-icon"> |
|
169 | 169 | role="link" |
170 | 170 | tabindex="0" |
171 | 171 | on:keydown={() => {}} |
172 | | - on:click={() => removeTool(index)} |
| 172 | + on:click={() => removeUtility(index)} |
173 | 173 | /> |
174 | 174 | </div> |
175 | 175 | </div> |
176 | 176 | {/each} |
177 | | - {#if tools?.length < toolLimit} |
| 177 | + {#if utilities?.length < utilityLimit} |
178 | 178 | <div class="list-add"> |
179 | 179 | <i |
180 | 180 | class="bx bx bx-list-plus" |
181 | 181 | role="link" |
182 | 182 | tabindex="0" |
183 | 183 | on:keydown={() => {}} |
184 | | - on:click={() => addTool()} |
| 184 | + on:click={() => addUtility()} |
185 | 185 | /> |
186 | 186 | </div> |
187 | 187 | {/if} |
|
0 commit comments