From f759fae55fb46279f7c82535c6f2d06a7bffe6d0 Mon Sep 17 00:00:00 2001 From: Faisal Amir Date: Thu, 5 Sep 2024 14:10:41 +0700 Subject: [PATCH] feat: enable model dropdown search by configured model (#3466) --- web/containers/ModelDropdown/index.tsx | 256 +++++++++++-------------- 1 file changed, 109 insertions(+), 147 deletions(-) diff --git a/web/containers/ModelDropdown/index.tsx b/web/containers/ModelDropdown/index.tsx index d57119b13..92d8addd0 100644 --- a/web/containers/ModelDropdown/index.tsx +++ b/web/containers/ModelDropdown/index.tsx @@ -465,158 +465,73 @@ const ModelDropdown = ({ {engine === InferenceEngine.nitro && !isDownloadALocalModel && - showModel && ( - <> - {!searchText.length ? ( - - ) : ( - <> - {filteredDownloadedModels - .filter( - (x) => x.engine === InferenceEngine.nitro - ) - .filter((x) => { - if (searchText.length === 0) { - return downloadedModels.find( - (c) => c.id === x.id - ) - } else { - return x - } - }) - .map((model) => { - const isDownloading = downloadingModels.some( - (md) => md.id === model.id - ) - const isdDownloaded = downloadedModels.some( - (c) => c.id === model.id - ) - return ( -
  • { - if (isdDownloaded) { - onClickModelItem(model.id) - } - }} - > -
    -

    - {model.name} -

    - -
    -
    - {!isdDownloaded && ( - - {toGibibytes(model.metadata.size)} - - )} - {!isDownloading && !isdDownloaded ? ( - downloadModel(model)} - /> - ) : ( - Object.values(downloadStates) - .filter( - (x) => x.modelId === model.id - ) - .map((item) => ( - - )) - )} -
    -
  • - ) - })} - - )} - + )) + )} + + + ) + })} + )}