|
3 | 3 | import { Button, Card, CardBody, CardHeader, Input, Table } from '@sveltestrap/sveltestrap'; |
4 | 4 | import { _ } from 'svelte-i18n'; |
5 | 5 | import InPlaceEdit from '$lib/common/InPlaceEdit.svelte'; |
| 6 | + import Select from '$lib/common/Select.svelte'; |
6 | 7 | import { utcToLocal } from '$lib/helpers/datetime'; |
7 | | - import { RoutingMode, AgentType } from '$lib/helpers/enums'; |
| 8 | + import { RoutingMode, AgentType, FunctionVisMode } from '$lib/helpers/enums'; |
8 | 9 | import { AgentExtensions } from '$lib/helpers/utils/agent'; |
9 | 10 |
|
10 | 11 | const limit = 10; |
|
27 | 28 | { id: v, name: v } |
28 | 29 | )); |
29 | 30 |
|
| 31 | + const functionVisibilityModeOptions = Object.entries(FunctionVisMode).map(([k, v]) => ( |
| 32 | + { label: v, value: v } |
| 33 | + )); |
30 | 34 | |
31 | 35 | onMount(() => { |
32 | 36 | init(); |
|
73 | 77 | /** |
74 | 78 | * @param {any} e |
75 | 79 | */ |
76 | | - function changeMode(e) { |
| 80 | + function changeRoutingMode(e) { |
77 | 81 | const value = e.target.value || null; |
78 | 82 | agent.mode = value; |
79 | 83 | handleAgentChange(); |
80 | 84 | } |
81 | 85 |
|
| 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 | +
|
82 | 96 | function chatWithAgent() { |
83 | 97 | if (!!!agent?.id) return; |
84 | 98 | |
|
145 | 159 | <div class="mt-2 mb-2" style="width: fit-content;"> |
146 | 160 | <Input |
147 | 161 | type="select" |
148 | | - on:change={e => changeMode(e)} |
| 162 | + on:change={e => changeRoutingMode(e)} |
149 | 163 | > |
150 | 164 | {#each [...routingModeOptions] as option} |
151 | 165 | <option value={option.id} selected={option.id === agent.mode}> |
|
302 | 316 | </div> |
303 | 317 | </td> |
304 | 318 | </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> |
305 | 338 | <tr> |
306 | 339 | <th class="agent-prop-key" style="vertical-align: middle"> |
307 | 340 | <div class="mt-1"> |
|
0 commit comments