From 943baad689776f5664451eb6ab65753e99f6135c Mon Sep 17 00:00:00 2001 From: "Timothy J. Baek" Date: Tue, 28 May 2024 18:24:39 -0700 Subject: [PATCH] feat: allow valve pipelines edit --- backend/main.py | 4 ++-- src/lib/components/admin/Settings/Pipelines.svelte | 8 ++++++++ 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/backend/main.py b/backend/main.py index f3d8371b0..edf0f212e 100644 --- a/backend/main.py +++ b/backend/main.py @@ -250,8 +250,8 @@ class PipelineMiddleware(BaseHTTPMiddleware): and ( model["pipeline"]["pipelines"] == ["*"] or any( - model_id == target_model["id"] - for target_model in model["pipeline"]["pipelines"] + model_id == target_model_id + for target_model_id in model["pipeline"]["pipelines"] ) ) ] diff --git a/src/lib/components/admin/Settings/Pipelines.svelte b/src/lib/components/admin/Settings/Pipelines.svelte index 6a6d9a40e..60905e99c 100644 --- a/src/lib/components/admin/Settings/Pipelines.svelte +++ b/src/lib/components/admin/Settings/Pipelines.svelte @@ -32,6 +32,10 @@ const pipeline = pipelines[selectedPipelineIdx]; if (pipeline && (pipeline?.pipeline?.valves ?? false)) { + if (valves?.pipelines ?? false) { + valves.pipelines = valves.pipelines.split(',').map((v) => v.trim()); + } + const res = await updatePipelineValves(localStorage.token, pipeline.id, valves).catch( (error) => { toast.error(error); @@ -52,6 +56,10 @@ const getValves = async (idx) => { valves_spec = await getPipelineValvesSpec(localStorage.token, pipelines[idx].id); valves = await getPipelineValves(localStorage.token, pipelines[idx].id); + + if (valves?.pipelines ?? false) { + valves.pipelines = valves.pipelines.join(','); + } }; const setPipelines = async () => {