diff --git a/src/lib/components/chat/Chat.svelte b/src/lib/components/chat/Chat.svelte index 2bd65e88f..1acf3aa3f 100644 --- a/src/lib/components/chat/Chat.svelte +++ b/src/lib/components/chat/Chat.svelte @@ -104,6 +104,7 @@ }; let params = {}; + let valves = {}; $: if (history.currentId !== null) { let _messages = []; @@ -1541,6 +1542,18 @@ - + { + const model = $models.find((m) => m.id === e); + + if (model) { + return [...a, model]; + } + return a; + }, [])} + bind:show={showControls} + bind:params + bind:valves + /> {/if} diff --git a/src/lib/components/chat/ChatControls.svelte b/src/lib/components/chat/ChatControls.svelte index 612af3378..72c083e99 100644 --- a/src/lib/components/chat/ChatControls.svelte +++ b/src/lib/components/chat/ChatControls.svelte @@ -6,7 +6,11 @@ export let show = false; + export let models = []; + export let chatId = null; + export let valves = {}; + export let params = {}; let largeScreen = false; @@ -43,6 +47,8 @@ on:close={() => { show = false; }} + {models} + bind:valves bind:params /> @@ -56,6 +62,8 @@ on:close={() => { show = false; }} + {models} + bind:valves bind:params /> diff --git a/src/lib/components/chat/Controls/Controls.svelte b/src/lib/components/chat/Controls/Controls.svelte index 2cb3bceeb..a7095b8d6 100644 --- a/src/lib/components/chat/Controls/Controls.svelte +++ b/src/lib/components/chat/Controls/Controls.svelte @@ -5,7 +5,10 @@ import XMark from '$lib/components/icons/XMark.svelte'; import AdvancedParams from '../Settings/Advanced/AdvancedParams.svelte'; + import Valves from '$lib/components/common/Valves.svelte'; + export let models = []; + export let valves = {}; export let params = {}; @@ -23,6 +26,18 @@
+ {#if models.length === 1 && models[0]?.pipe?.valves_spec} +
+
Valves
+ +
+ +
+
+ +
+ {/if} +
System Prompt
diff --git a/src/lib/components/chat/Settings/Valves.svelte b/src/lib/components/chat/Settings/Valves.svelte index ca97ade05..579779162 100644 --- a/src/lib/components/chat/Settings/Valves.svelte +++ b/src/lib/components/chat/Settings/Valves.svelte @@ -19,6 +19,7 @@ import Tooltip from '$lib/components/common/Tooltip.svelte'; import Spinner from '$lib/components/common/Spinner.svelte'; import Switch from '$lib/components/common/Switch.svelte'; + import Valves from '$lib/components/common/Valves.svelte'; const dispatch = createEventDispatcher(); @@ -170,91 +171,7 @@
{#if !loading} - {#if valvesSpec} - {#each Object.keys(valvesSpec.properties) as property, idx} -
-
-
- {valvesSpec.properties[property].title} - - {#if (valvesSpec?.required ?? []).includes(property)} - *required - {/if} -
- - -
- - {#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} - - {#if (valvesSpec.properties[property]?.description ?? null) !== null} -
- {valvesSpec.properties[property].description} -
- {/if} -
- {/each} - {:else} -
No valves
- {/if} + {:else} {/if} diff --git a/src/lib/components/common/Valves.svelte b/src/lib/components/common/Valves.svelte new file mode 100644 index 000000000..f15a4fb23 --- /dev/null +++ b/src/lib/components/common/Valves.svelte @@ -0,0 +1,95 @@ + + +{#if valvesSpec} + {#each Object.keys(valvesSpec.properties) as property, idx} +
+
+
+ {valvesSpec.properties[property].title} + + {#if (valvesSpec?.required ?? []).includes(property)} + *required + {/if} +
+ + +
+ + {#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} + + {#if (valvesSpec.properties[property]?.description ?? null) !== null} +
+ {valvesSpec.properties[property].description} +
+ {/if} +
+ {/each} +{:else} +
No valves
+{/if} diff --git a/src/lib/components/workspace/common/ValvesModal.svelte b/src/lib/components/workspace/common/ValvesModal.svelte index 12315f9e6..1f23c510e 100644 --- a/src/lib/components/workspace/common/ValvesModal.svelte +++ b/src/lib/components/workspace/common/ValvesModal.svelte @@ -13,6 +13,7 @@ import { getToolValvesById, getToolValvesSpecById, updateToolValvesById } from '$lib/apis/tools'; import Spinner from '../../common/Spinner.svelte'; import Switch from '$lib/components/common/Switch.svelte'; + import Valves from '$lib/components/common/Valves.svelte'; const i18n = getContext('i18n'); const dispatch = createEventDispatcher(); @@ -127,91 +128,7 @@ >
{#if !loading} - {#if valvesSpec} - {#each Object.keys(valvesSpec.properties) as property, idx} -
-
-
- {valvesSpec.properties[property].title} - - {#if (valvesSpec?.required ?? []).includes(property)} - *required - {/if} -
- - -
- - {#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} - - {#if (valvesSpec.properties[property]?.description ?? null) !== null} -
- {valvesSpec.properties[property].description} -
- {/if} -
- {/each} - {:else} -
No valves
- {/if} + {:else} {/if}