From 6228b1bd53fd9ba9b3464d94efb23788dfb38dcb Mon Sep 17 00:00:00 2001 From: balibabu Date: Fri, 23 Aug 2024 17:01:35 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20Filter=20out=20disabled=20values=20?= =?UTF-8?q?=E2=80=8B=E2=80=8Bfrom=20the=20llm=20options=20#2072=20(#2073)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ### What problem does this PR solve? fix: Filter out disabled values ​​from the llm options #2072 ### Type of change - [x] Bug Fix (non-breaking change which fixes an issue) --- web/src/hooks/llm-hooks.ts | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/web/src/hooks/llm-hooks.ts b/web/src/hooks/llm-hooks.ts index 4c8eec6c5..a270c151a 100644 --- a/web/src/hooks/llm-hooks.ts +++ b/web/src/hooks/llm-hooks.ts @@ -64,8 +64,10 @@ export const useSelectLlmOptionsByModelType = () => { return { label: key, options: value - .filter((x) => - modelType ? x.model_type.includes(modelType) : true, + .filter( + (x) => + (modelType ? x.model_type.includes(modelType) : true) && + x.available, ) .map((x) => ({ label: x.llm_name, @@ -73,7 +75,8 @@ export const useSelectLlmOptionsByModelType = () => { disabled: !x.available, })), }; - }); + }) + .filter((x) => x.options.length > 0); }; return {