From ce1a681bb806b997d84d04db2940cdf4f3d59723 Mon Sep 17 00:00:00 2001 From: Faisal Amir Date: Tue, 27 Aug 2024 09:46:56 +0700 Subject: [PATCH] feat: enable model dropdown search by configured model --- 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 07c2cba3ae..de003a5d5c 100644 --- a/web/containers/ModelDropdown/index.tsx +++ b/web/containers/ModelDropdown/index.tsx @@ -430,158 +430,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) => ( - - )) - )} -
    -
  • - ) - })} - - )} - + )) + )} + + + ) + })} + )}