Skip to content

Commit ee4f282

Browse files
authored
Merge pull request #155 from iceljc/features/refine-chat-window
add agent utility
2 parents d9fd39c + 25290df commit ee4f282

File tree

5 files changed

+27
-27
lines changed

5 files changed

+27
-27
lines changed

src/lib/helpers/types.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@
122122
* @property {boolean} allow_routing
123123
* @property {string} icon_url - Icon
124124
* @property {string[]} profiles - The agent profiles.
125-
* @property {string[]} tools - The agent tools.
125+
* @property {string[]} utilities - The agent utilities.
126126
* @property {Date} created_datetime
127127
* @property {Date} updated_datetime
128128
* @property {AgentLlmConfig} llm_config - LLM settings.

src/lib/services/agent-service.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -77,11 +77,11 @@ export async function createAgent(agent) {
7777
}
7878

7979
/**
80-
* Get agent tools
80+
* Get agent utilities
8181
* @returns {Promise<string[]>}
8282
*/
83-
export async function getAgentTools() {
84-
const url = endpoints.agentToolsUrl;
83+
export async function getAgentUtilities() {
84+
const url = endpoints.agentUtilitiesUrl;
8585
const response = await axios.get(url);
8686
return response.data;
8787
}

src/lib/services/api-endpoints.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ export const endpoints = {
2424
agentDetailUrl: `${host}/agent/{id}`,
2525
agentRefreshUrl: `${host}/refresh-agents`,
2626
agentCreateUrl: `${host}/agent`,
27-
agentToolsUrl: `${host}/agent/tools`,
27+
agentUtilitiesUrl: `${host}/agent/utilities`,
2828

2929
// agent task
3030
agentTaskListUrl: `${host}/agent/tasks`,

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@
129129
{#if agent}
130130
<Row>
131131
<Col style="flex: 30%;">
132-
<AgentOverview agent={agent} profiles={agent.profiles || []} tools={agent.tools || []} />
132+
<AgentOverview agent={agent} profiles={agent.profiles || []} utilities={agent.utilities || []} />
133133
<AgentLlmConfig agent={agent} />
134134
{#if agent.routing_rules?.length > 0}
135135
<AgentRouting agent={agent} />

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

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
import InPlaceEdit from '$lib/common/InPlaceEdit.svelte'
44
import { format } from '$lib/helpers/datetime';
55
import { onMount } from 'svelte';
6-
import { getAgentTools } from '$lib/services/agent-service';
6+
import { getAgentUtilities } from '$lib/services/agent-service';
77
88
/** @type {import('$types').AgentModel} */
99
export let agent;
@@ -12,18 +12,18 @@
1212
export let profiles = [];
1313
1414
/** @type {string[]} */
15-
export let tools = [];
15+
export let utilities = [];
1616
1717
/** @type {string[]} */
18-
let toolOptions = [];
18+
let utilityOptions = [];
1919
2020
const profileLimit = 10;
21-
const toolLimit = 10;
21+
const utilityLimit = 10;
2222
2323
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];
2727
});
2828
});
2929
@@ -42,19 +42,19 @@
4242
agent.profiles = profiles;
4343
}
4444
45-
function addTool() {
45+
function addUtility() {
4646
if (!!!agent) return;
4747
48-
tools = [...tools, ''];
49-
agent.tools = tools;
48+
utilities = [...utilities, ''];
49+
agent.utilities = utilities;
5050
}
5151
5252
/**
5353
* @param {number} index
5454
*/
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;
5858
}
5959
6060
function chatWithAgent() {
@@ -153,14 +153,14 @@
153153
</td>
154154
</tr>
155155
<tr>
156-
<th class="agent-prop-key">Tools</th>
156+
<th class="agent-prop-key">Utilities</th>
157157
<td>
158158
<div class="agent-prop-list-container">
159-
{#each tools as tool, index}
159+
{#each utilities as utility, index}
160160
<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>
164164
{/each}
165165
</Input>
166166
<div class="delete-icon">
@@ -169,19 +169,19 @@
169169
role="link"
170170
tabindex="0"
171171
on:keydown={() => {}}
172-
on:click={() => removeTool(index)}
172+
on:click={() => removeUtility(index)}
173173
/>
174174
</div>
175175
</div>
176176
{/each}
177-
{#if tools?.length < toolLimit}
177+
{#if utilities?.length < utilityLimit}
178178
<div class="list-add">
179179
<i
180180
class="bx bx bx-list-plus"
181181
role="link"
182182
tabindex="0"
183183
on:keydown={() => {}}
184-
on:click={() => addTool()}
184+
on:click={() => addUtility()}
185185
/>
186186
</div>
187187
{/if}

0 commit comments

Comments
 (0)