diff --git a/backend/open_webui/utils/chat.py b/backend/open_webui/utils/chat.py
index a6a06c522..1a9d14248 100644
--- a/backend/open_webui/utils/chat.py
+++ b/backend/open_webui/utils/chat.py
@@ -397,7 +397,12 @@ async def chat_action(request: Request, action_id: str, form_data: dict, user: A
if hasattr(function_module, "valves") and hasattr(function_module, "Valves"):
valves = Functions.get_function_valves_by_id(action_id)
- function_module.valves = function_module.Valves(**(valves if valves else {}))
+ model_valves = (
+ model.get("info", {}).get("meta", {}).get("valves", {}).get(action_id, {})
+ )
+ function_module.valves = function_module.Valves(
+ **(valves if valves else {}), **model_valves
+ )
if hasattr(function_module, "action"):
try:
diff --git a/backend/open_webui/utils/filter.py b/backend/open_webui/utils/filter.py
index a11aeb092..e61b76d76 100644
--- a/backend/open_webui/utils/filter.py
+++ b/backend/open_webui/utils/filter.py
@@ -61,6 +61,17 @@ async def process_filter_functions(
# Apply valves to the function
if hasattr(function_module, "valves") and hasattr(function_module, "Valves"):
valves = Functions.get_function_valves_by_id(filter_id)
+ # overwrite global valves with model valves
+ model_valves = (
+ extra_params.get("__model__", {})
+ .get("info", {})
+ .get("meta", {})
+ .get("valves", {})
+ .get("functions", {})
+ .get(filter_id, {})
+ )
+ valves = {**valves, **model_valves}
+
function_module.valves = function_module.Valves(
**(valves if valves else {})
)
diff --git a/backend/open_webui/utils/tools.py b/backend/open_webui/utils/tools.py
index bd2a731e6..e28b9b86c 100644
--- a/backend/open_webui/utils/tools.py
+++ b/backend/open_webui/utils/tools.py
@@ -56,6 +56,18 @@ def get_tools(
extra_params["__id__"] = tool_id
if hasattr(module, "valves") and hasattr(module, "Valves"):
valves = Tools.get_tool_valves_by_id(tool_id) or {}
+ # overwrite global valves with model valves
+ valves = {
+ **valves,
+ **(
+ extra_params.get("__model__", {})
+ .get("info", {})
+ .get("meta", {})
+ .get("valves", {})
+ .get("tools", {})
+ .get(tool_id, {})
+ ),
+ }
module.valves = module.Valves(**valves)
if hasattr(module, "UserValves"):
diff --git a/src/lib/components/common/Valves.svelte b/src/lib/components/common/Valves.svelte
index 598a17558..846cfa77d 100644
--- a/src/lib/components/common/Valves.svelte
+++ b/src/lib/components/common/Valves.svelte
@@ -106,12 +106,12 @@
{/if}
- {/if}
- {#if (valvesSpec.properties[property]?.description ?? null) !== null}
-
- {valvesSpec.properties[property].description}
-
+ {#if (valvesSpec.properties[property]?.description ?? null) !== null}
+
+ {valvesSpec.properties[property].description}
+
+ {/if}
{/if}
{/each}
diff --git a/src/lib/components/workspace/Models/ActionsSelector.svelte b/src/lib/components/workspace/Models/ActionsSelector.svelte
index 8335455ed..c65cc9749 100644
--- a/src/lib/components/workspace/Models/ActionsSelector.svelte
+++ b/src/lib/components/workspace/Models/ActionsSelector.svelte
@@ -2,12 +2,17 @@
import { getContext, onMount } from 'svelte';
import Checkbox from '$lib/components/common/Checkbox.svelte';
import Tooltip from '$lib/components/common/Tooltip.svelte';
+ import Collapsible from '$lib/components/common/Collapsible.svelte';
+ import Valves from '$lib/components/common/Valves.svelte';
const i18n = getContext('i18n');
export let actions = [];
export let selectedActionIds = [];
+ export let valvesSpecs = {};
+ export let valves = {};
+
let _actions = {};
onMount(() => {
@@ -33,7 +38,7 @@
{#if actions.length > 0}
-
+
{#each Object.keys(_actions) as action, actionIdx}
+ {#if _actions[action].selected}
+
+
+
+
+
+ {/if}
{/each}
{/if}
diff --git a/src/lib/components/workspace/Models/FiltersSelector.svelte b/src/lib/components/workspace/Models/FiltersSelector.svelte
index fa595d6f8..5401882be 100644
--- a/src/lib/components/workspace/Models/FiltersSelector.svelte
+++ b/src/lib/components/workspace/Models/FiltersSelector.svelte
@@ -2,15 +2,22 @@
import { getContext, onMount } from 'svelte';
import Checkbox from '$lib/components/common/Checkbox.svelte';
import Tooltip from '$lib/components/common/Tooltip.svelte';
+ import Collapsible from '$lib/components/common/Collapsible.svelte';
+ import Valves from '$lib/components/common/Valves.svelte';
const i18n = getContext('i18n');
export let filters = [];
export let selectedFilterIds = [];
+ export let valvesSpecs = {};
+ export let valves = {};
+
let _filters = {};
onMount(() => {
+ console.log(`valvesSpecs: ${JSON.stringify(valvesSpecs)}`);
+ console.log(`valves: ${JSON.stringify(valves)}`);
_filters = filters.reduce((acc, filter) => {
acc[filter.id] = {
...filter,
@@ -34,7 +41,7 @@
{#if filters.length > 0}
-
+
{#each Object.keys(_filters) as filter, filterIdx}
+ {#if _filters[filter].selected}
+
+
+
+
+
+ {/if}
{/each}
{/if}
diff --git a/src/lib/components/workspace/Models/ModelEditor.svelte b/src/lib/components/workspace/Models/ModelEditor.svelte
index 170c37f22..54283bcbb 100644
--- a/src/lib/components/workspace/Models/ModelEditor.svelte
+++ b/src/lib/components/workspace/Models/ModelEditor.svelte
@@ -1,6 +1,7 @@