Skip to content

Commit

Permalink
fix: remote model added manually does not shown in model drop down (#…
Browse files Browse the repository at this point in the history
…3261)

* fix: remote model added manually does not shown in model drop down

* Bump cortex 0.5.0-27 in version.txt

---------

Co-authored-by: Van Pham <64197333+Van-QA@users.noreply.github.com>
  • Loading branch information
namchuai and Van-QA authored Aug 5, 2024
1 parent 5e06ed8 commit 224ca3f
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 10 deletions.
2 changes: 1 addition & 1 deletion electron/resources/version.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.5.0-7
0.5.0-27
17 changes: 12 additions & 5 deletions web/hooks/useGetModelsByEngine.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,14 +31,21 @@ const useGetModelsByEngine = () => {
})
}

const availableModels = downloadedModels.filter(
(m) => m.engine === engine
)
// engine is remote engine
const data = queryClient.getQueryData(cortexHubModelsQueryKey)
if (!data) return []
if (!data) return availableModels

const modelEntries = data as HfModelEntry[]
const models: Model[] = []
const models: Model[] = [...availableModels]
for (const entry of modelEntries) {
if (entry.model && entry.engine === engine) {
models.push(entry.model)
}
const entryModel = entry.model
if (!entryModel) continue
if (entry.engine !== engine) continue
if (models.some((m) => m.model === entryModel.model)) continue
models.push(entryModel)
}

return models.filter((m) => {
Expand Down
1 change: 0 additions & 1 deletion web/hooks/useModelHub.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import {
fetchCortexHubModels,
} from '@/utils/huggingface'

// TODO: change curated models to built in models
type CuratedModelResponse = {
quickstart_models: QuickStartModel[]
popular_models: CuratedModel[]
Expand Down
3 changes: 0 additions & 3 deletions web/utils/thread.ts

This file was deleted.

0 comments on commit 224ca3f

Please sign in to comment.