Skip to content

Commit 274c817

Browse files
author
Jicheng Lu
committed
add agent mode
1 parent 2dee0fa commit 274c817

File tree

3 files changed

+45
-3
lines changed

3 files changed

+45
-3
lines changed

src/lib/helpers/enums.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,12 @@ const agentType = {
7171
};
7272
export const AgentType = Object.freeze(agentType);
7373

74+
const agentMode = {
75+
Eager: "eager",
76+
Lazy: "lazy"
77+
};
78+
export const AgentMode = Object.freeze(agentMode);
79+
7480
const agentTaskStatus = {
7581
Scheduled: 'scheduled',
7682
New: 'new',

src/lib/helpers/types/agentTypes.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@
4444
* @property {string} name - Agent name.
4545
* @property {string} description - Agent description.
4646
* @property {string} type - Agent type
47+
* @property {string} mode - Agent mode
4748
* @property {string} instruction - System prompt
4849
* @property {ChannelInstruction[]} channel_instructions - Channel instructions
4950
* @property {boolean} disabled

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

Lines changed: 38 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
<script>
22
import { onMount } from 'svelte';
33
import { Button, Card, CardBody, CardHeader, Input, Table } from '@sveltestrap/sveltestrap';
4-
import { _ } from 'svelte-i18n'
5-
import InPlaceEdit from '$lib/common/InPlaceEdit.svelte'
4+
import { _ } from 'svelte-i18n';
5+
import InPlaceEdit from '$lib/common/InPlaceEdit.svelte';
66
import { utcToLocal } from '$lib/helpers/datetime';
7-
import { AgentType } from '$lib/helpers/enums';
7+
import { AgentMode, AgentType } from '$lib/helpers/enums';
88
import { AgentExtensions } from '$lib/helpers/utils/agent';
99
1010
const limit = 10;
@@ -24,6 +24,11 @@
2424
2525
onMount(() => {});
2626
27+
/** @type {import('$commonTypes').IdName[]} */
28+
const agentModeOptions = Object.entries(AgentMode).map(([k, v]) => (
29+
{ id: v, name: v }
30+
));
31+
2732
function addProfile() {
2833
if (!!!agent) return;
2934
@@ -58,6 +63,15 @@
5863
handleAgentChange();
5964
}
6065
66+
/**
67+
* @param {any} e
68+
*/
69+
function changeMode(e) {
70+
const value = e.target.value;
71+
agent.mode = value;
72+
handleAgentChange();
73+
}
74+
6175
function chatWithAgent() {
6276
if (!!!agent?.id) return;
6377
@@ -258,6 +272,27 @@
258272
</div>
259273
</td>
260274
</tr>
275+
<tr>
276+
<th class="agent-prop-key" style="vertical-align: middle">
277+
<div class="mt-1">
278+
Mode
279+
</div>
280+
</th>
281+
<td>
282+
<div class="mt-2 mb-2" style="width: fit-content;">
283+
<Input
284+
type="select"
285+
on:change={e => changeMode(e)}
286+
>
287+
{#each [...agentModeOptions] as option}
288+
<option value={option.id} selected={option.id === agent.mode}>
289+
{option.name}
290+
</option>
291+
{/each}
292+
</Input>
293+
</div>
294+
</td>
295+
</tr>
261296
<tr>
262297
<th class="agent-prop-key" style="vertical-align: middle">
263298
<div class="mt-1">

0 commit comments

Comments
 (0)