Skip to content

Commit f64ba3a

Browse files
author
Jicheng Lu
committed
add func vis mode
1 parent 3a7b02e commit f64ba3a

3 files changed

Lines changed: 43 additions & 3 deletions

File tree

src/lib/helpers/enums.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,12 @@ const routingMode = {
8383
};
8484
export const RoutingMode = Object.freeze(routingMode);
8585

86+
const functionVisMode = {
87+
Manual: "manual",
88+
Auto: "auto"
89+
};
90+
export const FunctionVisMode = Object.freeze(functionVisMode);
91+
8692
const agentTaskStatus = {
8793
Scheduled: 'scheduled',
8894
New: 'new',

src/lib/helpers/types/agentTypes.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@
4646
* @property {string} description - Agent description.
4747
* @property {string} type - Agent type
4848
* @property {string?} mode - Agent routing mode
49+
* @property {string?} function_visibility_mode - Agent function visibility mode
4950
* @property {string} instruction - System prompt
5051
* @property {ChannelInstruction[]} channel_instructions - Channel instructions
5152
* @property {boolean} disabled

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

Lines changed: 36 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,9 @@
33
import { Button, Card, CardBody, CardHeader, Input, Table } from '@sveltestrap/sveltestrap';
44
import { _ } from 'svelte-i18n';
55
import InPlaceEdit from '$lib/common/InPlaceEdit.svelte';
6+
import Select from '$lib/common/Select.svelte';
67
import { utcToLocal } from '$lib/helpers/datetime';
7-
import { RoutingMode, AgentType } from '$lib/helpers/enums';
8+
import { RoutingMode, AgentType, FunctionVisMode } from '$lib/helpers/enums';
89
import { AgentExtensions } from '$lib/helpers/utils/agent';
910
1011
const limit = 10;
@@ -27,6 +28,9 @@
2728
{ id: v, name: v }
2829
));
2930
31+
const functionVisibilityModeOptions = Object.entries(FunctionVisMode).map(([k, v]) => (
32+
{ label: v, value: v }
33+
));
3034
3135
onMount(() => {
3236
init();
@@ -73,12 +77,22 @@
7377
/**
7478
* @param {any} e
7579
*/
76-
function changeMode(e) {
80+
function changeRoutingMode(e) {
7781
const value = e.target.value || null;
7882
agent.mode = value;
7983
handleAgentChange();
8084
}
8185
86+
/**
87+
* @param {any} e
88+
*/
89+
function changeFunctionVisibilityMode(e) {
90+
// @ts-ignore
91+
const values = e?.detail?.selecteds?.map(x => x.value) || [];
92+
agent.function_visibility_mode = values[0] || null;
93+
handleAgentChange();
94+
}
95+
8296
function chatWithAgent() {
8397
if (!!!agent?.id) return;
8498
@@ -145,7 +159,7 @@
145159
<div class="mt-2 mb-2" style="width: fit-content;">
146160
<Input
147161
type="select"
148-
on:change={e => changeMode(e)}
162+
on:change={e => changeRoutingMode(e)}
149163
>
150164
{#each [...routingModeOptions] as option}
151165
<option value={option.id} selected={option.id === agent.mode}>
@@ -302,6 +316,25 @@
302316
</div>
303317
</td>
304318
</tr>
319+
<tr>
320+
<th class="agent-prop-key" style="vertical-align: middle">
321+
<div class="mt-1">
322+
Function visibility mode
323+
</div>
324+
</th>
325+
<td>
326+
<div class="mt-2 mb-2">
327+
<Select
328+
tag={'function-visibility-mode-select'}
329+
containerStyles={'width: 50%; min-width: 100px;'}
330+
placeholder={'Select'}
331+
selectedValues={agent.function_visibility_mode ? [agent.function_visibility_mode] : []}
332+
options={functionVisibilityModeOptions}
333+
on:select={e => changeFunctionVisibilityMode(e)}
334+
/>
335+
</div>
336+
</td>
337+
</tr>
305338
<tr>
306339
<th class="agent-prop-key" style="vertical-align: middle">
307340
<div class="mt-1">

0 commit comments

Comments
 (0)