diff --git a/src/lib/components/chat/Settings/Valves.svelte b/src/lib/components/chat/Settings/Valves.svelte index eb4554871..ca97ade05 100644 --- a/src/lib/components/chat/Settings/Valves.svelte +++ b/src/lib/components/chat/Settings/Valves.svelte @@ -18,6 +18,7 @@ import ManageModal from './Personalization/ManageModal.svelte'; import Tooltip from '$lib/components/common/Tooltip.svelte'; import Spinner from '$lib/components/common/Spinner.svelte'; + import Switch from '$lib/components/common/Switch.svelte'; const dispatch = createEventDispatcher(); @@ -185,7 +186,10 @@ class="p-1 px-3 text-xs flex rounded transition" type="button" on:click={() => { - valves[property] = (valves[property] ?? null) === null ? '' : null; + valves[property] = + (valves[property] ?? null) === null + ? valvesSpec.properties[property]?.default ?? '' + : null; }} > {#if (valves[property] ?? null) === null} @@ -203,16 +207,40 @@ {#if (valves[property] ?? null) !== null} +
- + {#if valvesSpec.properties[property]?.enum ?? null} + + {:else if (valvesSpec.properties[property]?.type ?? null) === 'boolean'} +
+
+ {valves[property] ? 'Enabled' : 'Disabled'} +
+ +
+ +
+
+ {:else} + + {/if}
{/if} diff --git a/src/lib/components/workspace/common/ValvesModal.svelte b/src/lib/components/workspace/common/ValvesModal.svelte index e4bdfb567..12315f9e6 100644 --- a/src/lib/components/workspace/common/ValvesModal.svelte +++ b/src/lib/components/workspace/common/ValvesModal.svelte @@ -12,6 +12,7 @@ } from '$lib/apis/functions'; import { getToolValvesById, getToolValvesSpecById, updateToolValvesById } from '$lib/apis/tools'; import Spinner from '../../common/Spinner.svelte'; + import Switch from '$lib/components/common/Switch.svelte'; const i18n = getContext('i18n'); const dispatch = createEventDispatcher(); @@ -142,7 +143,10 @@ class="p-1 px-3 text-xs flex rounded transition" type="button" on:click={() => { - valves[property] = (valves[property] ?? null) === null ? '' : null; + valves[property] = + (valves[property] ?? null) === null + ? valvesSpec.properties[property]?.default ?? '' + : null; }} > {#if (valves[property] ?? null) === null} @@ -160,16 +164,40 @@ {#if (valves[property] ?? null) !== null} +
- + {#if valvesSpec.properties[property]?.enum ?? null} + + {:else if (valvesSpec.properties[property]?.type ?? null) === 'boolean'} +
+
+ {valves[property] ? 'Enabled' : 'Disabled'} +
+ +
+ +
+
+ {:else} + + {/if}
{/if}