fix: remote model added manually does not shown in model drop down (#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>
This commit is contained in:
NamH 2024-08-05 20:40:56 +07:00 committed by GitHub
parent 5e06ed8a12
commit 224ca3f7cc
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 13 additions and 10 deletions

View File

@ -1 +1 @@
0.5.0-7 0.5.0-27

View File

@ -31,14 +31,21 @@ const useGetModelsByEngine = () => {
}) })
} }
const availableModels = downloadedModels.filter(
(m) => m.engine === engine
)
// engine is remote engine
const data = queryClient.getQueryData(cortexHubModelsQueryKey) const data = queryClient.getQueryData(cortexHubModelsQueryKey)
if (!data) return [] if (!data) return availableModels
const modelEntries = data as HfModelEntry[] const modelEntries = data as HfModelEntry[]
const models: Model[] = [] const models: Model[] = [...availableModels]
for (const entry of modelEntries) { for (const entry of modelEntries) {
if (entry.model && entry.engine === engine) { const entryModel = entry.model
models.push(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) => { return models.filter((m) => {

View File

@ -8,7 +8,6 @@ import {
fetchCortexHubModels, fetchCortexHubModels,
} from '@/utils/huggingface' } from '@/utils/huggingface'
// TODO: change curated models to built in models
type CuratedModelResponse = { type CuratedModelResponse = {
quickstart_models: QuickStartModel[] quickstart_models: QuickStartModel[]
popular_models: CuratedModel[] popular_models: CuratedModel[]

View File

@ -1,3 +0,0 @@
export const generateThreadId = (assistantId: string) => {
return `${assistantId}_${(Date.now() / 1000).toFixed(0)}`
}